views:

59

answers:

2

I'm just starting out with SQL Server 2008 Express and spent the last hour or so trying out some basic queries. How does SQL scripting (correct term?) compare to general computer programming? Is writing SQL queries as involved, lengthy to learn, needs as much practice, etc. as software development? Is writing advanced SQL queries comparable to software development, at least to some degree, and if so could you explain that?

Also, I found a couple of tutorial and reference sites for learning SQL but could you also recommend some other sites.

Also(2), I was playing around with the SQL query designer in SQL Server and it seems like a good tool to learn writing SQL commands, but is there a way to use the designer to INSERT data. it seems that it's only for SELECT ing data.

Any other general comments for learning, better understanding, etc SQL would be appreciated. thanks

+4  A: 

SQL is a declarative language and it primarily deals with sets.

As such it it very different from procedural languages.

I would say it is somewhere between procedural languages and functional languages in terms of style.

I would recommend Joe Celko's books, this one by Hernandez, and this one by Bowman.

In SSMS, you can paste data into a table (usually from Excel).

Typically no users enter data through SSMS, usually loading data using a tool like SSIS.

You can INSERT data using INSERT INTO tbl VALUES (x, y, z), and SQL Server 2008 has a multi-row insertion ability through row constructors: INSERT INTO tbl VALUES (x, y, z), (a, b, c)

Cade Roux
In addition, right-clicking the query designer will pop up a menu with the 'change type' option, which will allow you (often) to start building the query as a SELECT, and turn it into an INSERT later.
Tobiasopdenbrouw
A: 

Cade's answer is good. I'd like to add that (advanced) SQL is a slightly different mindset - one where you play with sets, indeed (check out mathematics manuals for the basics, if you like). It's possible to generate really advanced SQL queries, resulting in very complex sets, but often you'll find you'll want a stored procedure at some point (even if just for legibility). Once you're at that point, it becomes much more like traditional programming.

Tobiasopdenbrouw