Folks - I need to learn SQL and SQL batch scripting.
The last programming language I learned was BASIC in 1985. Where should I start?
(...I knew BASIC REALLY well, though...REALLY REALLY well....)
The last programming language I learned was BASIC in 1985. Where should I start?
(...I knew BASIC REALLY well, though...REALLY REALLY well....)
no subject
Date: 2007-10-18 11:07 am (UTC)The first option is MySQL. It's a very basic relational database system. Many DBAs will thumb their nose at it claiming it isn't a real database. As I mentioned earlier, MySQL is primarily designed for being website backends. It's simple, fast, free, and has a fairly good community online.
If you want something a little closer to professional, there's Oracle 10g Express. Oracle has been in databases since what seems the beginning of time. In the middleware world, it's only rival is IBM's DB2. Oracle Express is a free edition of the Oracle database server that comes with a few limitations -- such as the number of tablespaces you can create, and the size of the tablespace. Neither of which really matter at this point because we just want something we can play around with.
Now I realize that none of this teaches you SQL, but it does help you create a learning environment for yourself. If you like, I can teach you what I know about relational database theory and SQL over Skype or IM in the evenings.
no subject
Date: 2007-10-18 12:04 pm (UTC)I'm not sure where to point you to learn this because i kinda figured most of it out on the job. Fortunately i'm not a DBA so i've gotten by with just the basics too. Make sure you know what database you're going to be using on the job because even though SQL is a standard, each database has its own additional syntax, and some databases don't even implement the standard properly. Imho the best database to learn on is Microsoft Access because it's GUI-based and simple, but keep an eye on the differences in syntax with the database you'll be using in production.
I reckon MSDN is one of the best online resources for learning about anything to do with IT. Clicky. Just look up the main commands (the four i named above, plus if you need to CREATE TABLE and DROP TABLE). The stuff you read there will work on SQL Server and most Sybase, and if you stick to the basic stuff it'll work anywhere.
SQL 101?
Let's say we have a "names" table with three columns in it - id (number), firstname (string) and surname (string).
Add two new people into the "names" table:
INSERT INTO names (id, firstname, surname)
VALUES 1, 'john', 'smith'
INSERT INTO names (id, firstname, surname)
VALUES 2, 'jane', 'doe'
Update John's name to Jan:
UPDATE names
SET firstname = 'jan'
WHERE id = 1
Return a list in surname-firstname order of all the people in the table with a surname of Smith:
SELECT surname, firstname
FROM names
WHERE surname = 'smith'
Delete Jan Smith from the table.
DELETE FROM names
WHERE id = 1
The only other think you'll probably need to learn is how to join tables. That can be a bit tricky to understand, but essentially it just involves adding a second clause to the "FROM" sections. Check out the Wikipedia page on joins - clicky. You'll probably only ever use INNER JOIN and LEFT OUTER JOIN.
no subject
Date: 2007-10-18 03:22 pm (UTC)Drop Database databasename;
Then quit. Thaaaat would delete everything in the database.
Seriously, if they have you manually doing something in SQL, you should be being paid 25$/hr as a programmer/database administration.
no subject
Date: 2007-10-19 07:48 am (UTC)no subject
To combine this topic with a fragment of a previous one:
http://xkcd.com/327/
no subject
Date: 2007-10-19 08:05 am (UTC)no subject
Date: 2007-10-18 06:01 pm (UTC)http://www.managedtime.com/freesqlbook.php
no subject
Date: 2007-10-18 11:09 pm (UTC)Were you asking for specific sites/books/etc.?
Start here
Date: 2007-10-19 01:39 am (UTC)All told it should be about 2 hours or so. I can't help with batch scripting.
Start here:
http://sqlcourse.com/
The go here for advanced studies:
http://sqlcourse2.com/intro2.html