Need SQL lessons
January 4, 2006 10:12 AM   Subscribe

I need to learn SQL, presumably mySQL.

I don't think a book is going to do it for me. I know CSS and am learning javascript but I have an intuition that I need either a class, in New York City, or a basic but thorough and comprehensible online tutorial. Suggestions? Thanks.
posted by captainscared to Computers & Internet (22 answers total) 3 users marked this as a favorite
 
I wouldn't say you need to take a class. I'd suggest a learning-by-doing approach instead. Set yourself the task of writing a very simple database-backed weblog, for example, using PHP and MySQL -- nothing more than functionality to insert new posts and other functionality to display them in reverse-date order. You'll pick up the basics in the process.

I suggest PHP because the brilliant online reference manual at PHP.net makes the language easily discoverable. I can't point you to specific SQL references online as it's been awhile since I've used one.
posted by killdevil at 10:22 AM on January 4, 2006


I wrote a FPP awhile back about a cool SQL learning tool I found. Check it out.
posted by Rothko at 10:29 AM on January 4, 2006


you need to be more clear--do you need to learn the langugage sql or one of the db software applications out there (oracle, mssql, mysql, etc).
these are completely seperate and would require seperate classes/learning. that is, you can focus on the language but it won't help you know how to use mysql (besides writing queries). it won't help you know what good tables look like, how to index, etc.
i agree this kinda stuff (especially just learning to use the software) can be learned on your own, no class needed. if you have to learn the language (there are a few variants, make sure you pick the one that goes with your software), and you've never done this stuff before, a class would help.
posted by alkupe at 10:36 AM on January 4, 2006


Philip Greenspun's SQL For Web Nerds is an excellent quick and thorough tutorial.
posted by evariste at 10:40 AM on January 4, 2006


evariste: that sure takes me back. greenspun is the reason I took up aolserver (I was already a tcl nerd) and never looked back. I learned SQL from that link maybe 8 years ago. It's probably still pretty good.
posted by RustyBrooks at 10:53 AM on January 4, 2006


Please, for the sake of those who may have to maintain your systems after you move on, learn something about relational database design before you start cranking out SQL code.
posted by matildaben at 11:00 AM on January 4, 2006 [1 favorite]


matilda: is this the right place to chuckle about a coworker (didn't work here long) who made a table to store information about books? Each book was a *column* in the table. His program would alter the table for each new book. It was awesome. For a while we used to joke about moving our whole database to just one table with thousands of columns.
posted by RustyBrooks at 11:11 AM on January 4, 2006


Please, for the sake of those who may have to maintain your systems after you move on, learn something about relational database design before you start cranking out SQL code.

To put this another way - the learning by doing approach is very good in some respects but unless supplemented by a book or a class you're very unlikely to converge on the better ways of designing a database. As RustyBrooks' comment suggests, there are many many traps to fall into when designing a database that won't be obvious from the start, and later it's too late and you're stuck with the database design. When I took a databases class SQL wasn't even a main part of the class, it was just an afterthought that we were supposed to pick up, more or less on our own time (we had to use it for our final project). Most of the class was taught in relational algebra, which isn't even an implemented language (well, maybe there are implementations but using them wasn't the point, and we didn't).
posted by advil at 11:24 AM on January 4, 2006


A gentle introduction to SQL
posted by Wild_Eep at 11:27 AM on January 4, 2006


Response by poster: OK, to be more specific: I am looking to change careers. I've seen a number of opportunities for marinating site content on a day to day basis. Most of these jobs require CSS HTML and photoshop skills which I have. They also ask for an understanding of mySQL. I'm guessing that I will not need to design the site but will need to know how to add to the database, etc. On this subject I know nada.
posted by captainscared at 11:34 AM on January 4, 2006


Response by poster: Sorry Wild_Ep, you're link is not working.
posted by captainscared at 11:37 AM on January 4, 2006


RustyBrooks-I first read it a few weeks ago, and it was still very much useful and informative. I had no idea it was over 8 years old! That's a pretty funny story too

Wild_Eep, that sqlzoo.com website is a dirty search engine spamhole. Just as well that your link doesn't work :-)
posted by evariste at 11:47 AM on January 4, 2006


RustyBrooks - you can get your fill of those kind of stories at the Daily WTF
posted by matildaben at 12:56 PM on January 4, 2006


different database engines have more in common than some of the comments above make out. a good initial design would be very similar in all of them. most of the optimisation techniques are similar, although the analysis tools differ.

having said that, if you're looking at general database jobs then either use the very latest release of mysql or something else, since until very recently mysql has missed functionality that is pretty standard on other systems. but if you're looking for mysql specific jobs then they're probably not using those features anyway, so obviously that doesn't matter.

if you are expecting to get a job in this, then you need to reach the level where you know and understand what a normalized database is, and the advantages and disadvantages that implies. so you are going to need to do some studying, even if just to understand the vocabulary used in interviews.
posted by andrew cooke at 1:30 PM on January 4, 2006


Response by poster: andrew cooke:

Where would you suggest I start?
posted by captainscared at 2:02 PM on January 4, 2006


The W3Schools tutorials are useful in that they have an actual database you can interact with by typing your own commands, which is always better than just reading.

http://www.w3schools.com/sql/sql_tryit.asp
posted by AmbroseChapel at 2:03 PM on January 4, 2006


The first step would be to get it on your own system so you can play around with it.

I'm going to assume you're running a Windows box.

1. Turn on IIS.
2. Install PHP 4.4.1 (not the later 5.0 build)
3. Install MySQL 4.0.26 (not 5.0)
4. Install MyODBC 3.51.
5. (Optional, but highly recommended) Get a good SQL manager (I like SQLyog)

Steps 1 and 2 are not necessary to start playing around with MySQL, but if you actually plan on doing something with the database (in a web-environment) you'll probably need them.

The nice thing about SQLyog (and other database managers) is that you can view and manage your database in a very easy manner, and you also have a nice SQL entry box to test out SELECT or JOIN statements or whatever you like.
posted by Civil_Disobedient at 6:57 PM on January 4, 2006


2. Install PHP 4.4.1 (not the later 5.0 build)
3. Install MySQL 4.0.26 (not 5.0)


Care to explain why?
posted by o0o0o at 8:30 PM on January 4, 2006


Because the 5.0 versions of each don't work well without fiddling around a lot more than the OP might have wanted. And because that time could be better spent diving into a working setup. Finally, because they're simply not necessary for the purposes of learning the basics. If you find you actually have a legitimate reason for needing the bleeding edge, by all means have at it.
posted by Civil_Disobedient at 10:54 PM on January 4, 2006


where to start?

i don't know. celko has written some books that are highly regarded, but they're probably way more abstract than what you're looking for. thumb through one ina bookstore but only get it if it tickles your fancy.

i'd follow some of the links here, but also do a google search for "database design" "database normalization" "database normal form". that, and some hands on practice, and reading all the manual, and using all the features described in the manual, will probably get you a long way.

sql contains a fair amount of "optional" stuff that seems irrelevant at first. if you think about why it exists, and how sql can help detect errors in programs that use it, you'll probably be ahead of most mysql people out there....
posted by andrew cooke at 6:59 AM on January 5, 2006


in programs that use it

ie the database itself can detect/prevent errors in the program that uses the database (the php script etc). understanding that is the key to "one level above basic" sql, imho.
posted by andrew cooke at 7:01 AM on January 5, 2006


The link pointed to sqlzoo.com, FWIW.
posted by Wild_Eep at 11:53 AM on January 12, 2006


« Older Help with finding a trustworthy financial advisor?...   |   Dedicated Camera for Copying Newer »
This thread is closed to new comments.