dolari: (Allison)
[personal profile] dolari
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....)

Date: 2007-10-18 11:07 am (UTC)
From: [identity profile] soltice.livejournal.com
Whenever I set about learning a new technology, I try to come up with some project for it. When I wanted to learn database tech, I taught myself MySQL and relation database theory and used it as a backend of my website. Given your server situation, this probably won't work, but that doesn't prevent you from installing a DB server on your home system.

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.

Date: 2007-10-18 12:04 pm (UTC)
From: [identity profile] amw.livejournal.com
SQL isn't a programming language so don't freak out too much. It's really pretty simple. You only have four main commands - INSERT (put data into a table), SELECT (get data out of a table), UPDATE (update data in a table) and DELETE (delete data out of a table). They all use pretty much the same syntax. It can get pretty overwhelming when you delve into the deep dark options, but i'm guessing you don't need to be a pro at this stuff for what you'll be doing.

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.

Date: 2007-10-18 03:22 pm (UTC)
From: [identity profile] kisai.livejournal.com
You could get away with this:

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.

Date: 2007-10-19 07:48 am (UTC)
From: [identity profile] jenndolari.livejournal.com
Maybe the day before I leave.... ;)

Date: 2007-10-18 03:26 pm (UTC)
From: [identity profile] http://users.livejournal.com/strangelv__/
PostgreSQL is a heavier-duty solution you might play with that isn't Oracle.

To combine this topic with a fragment of a previous one:

http://xkcd.com/327/

Date: 2007-10-19 08:05 am (UTC)
From: [identity profile] kisai.livejournal.com
(regarding the comic), hah, though that comic would require beforehand knowledge of the school and data structure, though it wouldn't be that far fetched to have a badly programmed interface using obvious table names.

Date: 2007-10-18 06:01 pm (UTC)
From: [identity profile] carly-kai.livejournal.com
I ran across a downloadble Introduction to SQL

http://www.managedtime.com/freesqlbook.php

Date: 2007-10-18 11:09 pm (UTC)
From: [identity profile] chaoticset.livejournal.com
There's a number of reasonably good tutorials that I faked my way through with. I'm sure you could pick it up. :)

Were you asking for specific sites/books/etc.?

Start here

Date: 2007-10-19 01:39 am (UTC)
From: [identity profile] inefficient.livejournal.com
When I suddenly had to learn SQL for my job, I found these two sites that break down SQL basics very well. They gave me the basic tools I needed to do my job as well as learn some advanced techniques on my own.
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
Page generated Apr. 24th, 2026 05:47 pm
Powered by Dreamwidth Studios