Decent or good sql query writing tutorial??

KAMAZON

Golden Member
Apr 4, 2001
1,300
0
76
www.alirazeghi.com

Here is the problem I am running into guys, maybe some of you propellerhead or informed people can help me out. Every single SQL book I have read such as SQL for Dummies, Beginning SQL, and SQL for Beginners, et. al, and every single SQL training video I've watched whether it's from CBT Nuggets to other vendors, totally lacks a comprehensive review of writing queries using various commands. Heck, I've even gone to various websites that teach SQL such as SQL-Tutorial.Com, SQL-Tutorial2.Com, W3Schools.Com, and several others. All seem to go through some basic Select queries (whoop de do) and don't go in depth. After that they seem to jump straight into writing SPs. Books online is a great resource but it gets complicated for a brand new SQL programmer who has no programming background (Except I knew how to draw a mean animated comic in QBasic 15 years ago loll).

I don't want to jump into writing SPs as I can't even write a decent query, and correct me if I am wrong, but I need to know how to do this before I can write decent SPs. Don't I need to spend the bulk of my time in learning how to write a proper query before I can write SPs really well?
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
Basic SELECT statements are just about all SQL offers. The ony thing advanced about SQL is how to adapt it to your specific database.

Once you have mastered SELECT, INSERT and UPDATE you then put them together in stored prcoedures. All other statements tend to be database specific so most tutorials won't go into them. What advanced techniques exactly are you trying to learn? I would recommend a book that specifically covers your choosen database.
 

KAMAZON

Golden Member
Apr 4, 2001
1,300
0
76
www.alirazeghi.com
What I was trying to learn was how to use the most common used statements such as Join, Union, Case, As, etc. I guess I just need to work very hard at trying to find varius examples and making them work for me, or just go straight into learning SPs.

I was also confused still about Variables, but those I can just go find info on. Thanks for the reply.
 

KLin

Lifer
Feb 29, 2000
30,954
1,080
126
Originally posted by: KAMAZON
What I was trying to learn was how to use the most common used statements such as Join, Union, Case, As, etc. I guess I just need to work very hard at trying to find varius examples and making them work for me, or just go straight into learning SPs.

I was also confused still about Variables, but those I can just go find info on. Thanks for the reply.

You can find examples of all those you mentioned in SQL online books.


SQL Server 2005 books online

 

Rage187

Lifer
Dec 30, 2000
14,276
4
81
By far the easiest and best book to use is the SAMS Learn SQL in 10 minutes.

It's great and is damn easy to follow as it is a collection of 10 minute lessons in writing sql statements.

You'll find lessons on Joins, Creates, Updates etc etc.


So easy to follow. Plus you can download a free database and follow along in the lessons seeing the exact same results. I brought a copy to work and everyone borrows it as the "SQL for mere Mortals" looks like an encyclopedia.
 

pontifex

Lifer
Dec 5, 2000
43,804
46
91
check w3schools.com or something similar to that. they have a lot of info and its free.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Pick a database. Read the manual. Anything beyond basic queries is going to get into database specific stuff anyway. The concepts will be portable but the details of the syntax will not. I'd personally recommend postgres, as they take care to mention whenever a piece of syntax is not part of official standards and the manual in general is quite good (I thought).

You'll also want to look into creating relatively complex schemas (learn ddl) because you really can't practise interesting queries without interesting relationships.