Page 1 of 1

I feel like a nerd

Posted: Thu Oct 23, 2008 2:23 pm
by MarauderIIC
Today, I feel like a true nerd again. It's not often I use Linux shells any more, but one of my homework problems was
hw wrote:# (1pt) Visit MultiLab. Login to a machine, and login into MySQL. Create table customers(lname,fname,address). Insert marek's record, print contents of the table and attach to hw4.
So after spending about 40 minutes (I was not yet a nerd again) trying to figure out what sql they had installed in multilab (mysqld nonexistent, ps au | grep mysqld showed) remotely -- using PuTTy -- because I didn't want to drive to campus,

ls /usr/bin/*sql* turned up 'sqlite' and 'sqlite3' which looked promising
So,

Code: Select all

penstemon:~> man sqlite3
penstemon:~> sqlite3 data1.db
SQLite version 3.4.2
Enter ".help" for instructions
sqlite> CREATE TABLE Customers(lname, fname, address);
sqlite> INSERT INTO Customers(lname, fname, address)
...> VALUES('Marek', 'Victor', '22 Broadway Lexington KY');
sqlite> SELECT * FROM Customers;
Marek|Victor|22 Broadway Lexington KY
sqlite> .headers ON
sqlite> SELECT * FROM Customers;
lname|fname|address
Marek|Victor|22 Broadway Lexington KY
sqlite> .mode TABS
mode should be one of: column csv html insert line list tabs tcl
sqlite> .mode tabs
sqlite> SELECT * FROM Customers;
lname fname address
Marek Victor 22 Broadway Lexington KY
sqlite> .exit
penstemon:~> exit
Hooray! Now I'm just confused as to why it let me do it without types.

Re: I feel like a nerd

Posted: Thu Oct 23, 2008 3:44 pm
by trufun202
SQLite ignores the datatype specification of columns and allows any kind of data to be put in a column regardless of its declared datatype.
Sounds like SQLite doesn't care about the datatype. (scary)

But, gratz on working smarter, not harder. You win!

Re: I feel like a nerd

Posted: Fri Oct 24, 2008 1:10 pm
by sparda
Whoa, I'll completely dodge this one. I have absolutely no experience with server-side stuff, or SQL for that matter (embarrassing, I know).

Re: I feel like a nerd

Posted: Fri Oct 24, 2008 3:08 pm
by dandymcgee
So was this on your account, or was everyone assigned a different entry? I'm wondering how every student created a table called "Customers" for their HW.

Re: I feel like a nerd

Posted: Fri Oct 24, 2008 3:37 pm
by Falco Girgis
I only have slight database experience, but I have server side experience with Perl (back in the day) and minor PHP things.

So what the hell? Databasing is now part of your "Computer Science" degree's cirriculum?

Re: I feel like a nerd

Posted: Fri Oct 24, 2008 4:49 pm
by MarauderIIC
dandymcgee wrote:So was this on your account, or was everyone assigned a different entry? I'm wondering how every student created a table called "Customers" for their HW.
The database is local to the student.
GyroVorbis wrote:I only have slight database experience, but I have server side experience with Perl (back in the day) and minor PHP things.

So what the hell? Databasing is now part of your "Computer Science" degree's cirriculum?
I'm using a database extensively in the web application I am developing for Cycom, and it's definitely in my best professional interest to at least take a class on it. That class is a pick from one of a group of six, and I have to take one of the group. So it's like a limited-choice elective. My technical electives though are Intro to AI and Software Testing Techniques.
Or maybe software testing is one of the req group and Intro to Database Management Systems is my technical elective. I don't recall atm.

Re: I feel like a nerd

Posted: Fri Oct 24, 2008 10:57 pm
by trufun202
GyroVorbis wrote:So what the hell? Databasing is now part of your "Computer Science" degree's cirriculum?
It was for me - well at least Databases 1 was required. At the time I was already using SQL at work, so it was a blow off class for me.

Databases 2, on the other hand, was a BITCH. It was primarily a math class, which pissed me off. I was like, "WTF! I use databases at work everyday, and we never have to solve 6 page problems regarding 'tuples'."

Re: I feel like a nerd

Posted: Tue Oct 28, 2008 10:50 pm
by Arce
Databases 2, on the other hand, was a BITCH. It was primarily a math class, which pissed me off. I was like, "WTF! I use databases at work everyday, and we never have to solve 6 page problems regarding 'tuples'."
:lol: :lol: