SQL (Structured Query Language) is a standard programming language for generating, manipulating, and retrieving information from a relational database. If you're working with a relational database--whether you're writing applications, performing administrative tasks, or generating reports--you need to know how to interact with your data. Even if you are using a tool that generates SQL for you, such as a reporting tool, there may still be cases where you need to bypass the automatic generation feature and write your own SQL statements.
To help you attain this fundamental SQL knowledge, look to Learning SQL, an introductory guide to SQL, designed primarily for developers just cutting their teeth on the language.
Learning SQL moves you quickly through the basics and then on to some of the more commonly used advanced features. Among the topics discussed:
The history of the computerized database
SQL Data Statements--those used to create, manipulate, and retrieve data stored in your database; example statements include select, update, insert, and delete
SQL Schema Statements--those used to create database objects, such as tables, indexes, and constraints
How data sets can interact with queries
The importance of subqueries
Data conversion and manipulation via SQL's built-in functions
How conditional logic can be used in Data Statements
Best of all, Learning SQL talks to you in a real-world manner, discussing various platform differences that you're likely to encounter and offering a series of chapter exercises that walk you through the learning process. Whenever possible, the book sticks to the features included in the ANSI SQL standards. This means you'll be able to apply what you learn to any of several different databases; the book covers MySQL, Microsoft SQL Server, and Oracle Database, but the features and syntax should apply just as well (perhaps with some tweaking) to IBM DB2, Sybase Adaptive Server, and PostgreSQL.
Put the power and flexibility of SQL to work. With Learning SQL you can master this important skill and know that the SQL statements you write are indeed correct.
Chapter 1 A Little Background
Introduction to Databases
What Is SQL?
What Is MySQL?
What's in Store
Chapter 2 Creating and Populating a Database
Creating a MySQL Database
Using the mysql Command-Line Tool
MySQL Data Types
Table Creation
Populating and Modifying Tables
When Good Statements Go Bad
The Bank Schema
Chapter 3 Query Primer
Query Mechanics
Query Clauses
The select Clause
The from Clause
The where Clause
The group by and having Clauses
The order by Clause
Exercises
Chapter 4 Filtering
Condition Evaluation
Building a Condition
Condition Types
NULL: That Four-Letter Word
Exercises
Chapter 5 Querying Multiple Tables
What Is a Join?
Joining Three or More Tables
Self-Joins
Equi-Joins Versus Non-Equi-Joins
Join Conditions Versus Filter Conditions
Exercises
Chapter 6 Working with Sets
Set Theory Primer
Set Theory in Practice
Set Operators
Set Operation Rules
Exercises
Chapter 7 Data Generation, Conversion, and Manipulation
Alan Beaulieu has been designing, building, and implementing custom database applications for over 13 years. He currently runs his own consulting company that specializes in designing Oracle databases and supporting services in the fields of Financial Services and Telecommunications. In building large databases for both OLTP and OLAP environments, Alan utilizes such Oracle features as Parallel Query, Partitioning, and Parallel Server. Alan has a Bachelor of Science degree in Operations Research from the Cornell University School of Engineering. He lives in Massachusetts with his wife and two daughters and can be reached at albeau_mosql@yahoo.com.
the review of johns2947 was very helpful. I was using \ while using windows but after the clue from the reviewer johns2947 i changed the command accordingly and it worked.
thanks
jaggi bn
11/14/2008
(4 of 6 customers found this review helpful)
3.0
Failed to open file error
By johns2947
from Undisclosed
Comments about oreilly Learning SQL:
Check the name of your file. When you download it, it should be :
LearningSQLExample.sql
You can use that at is, without changing it to a .txt file
Make sure you opened the database first, as in the book instruction.
mysql> use bank;
then run source
11/14/2008
(4 of 7 customers found this review helpful)
3.0
Using the example
By johns2947
from Undisclosed
Comments about oreilly Learning SQL:
The example does work (in Windows) if you follow the directions in the book.
The book tells you to login to mysql and then to create a database named 'bank'.
mysql> create database bank;
Then run the command
mysql> use bank;
Now you can run the source command for the example that you downloaded.
For example, I downloaded the example into my e: drive, so the source command reads:
mysql> source e:learningsqlexample.sql;
Notes: Windows XP does not require the "/" or "\" for the root directory (such as C: or E:), but will need the "\" if you go to a subdirectory.
What a pain learning this stuff from a book is! Reminds me of the frustration of teaching myself DOS 3.1 !
11/3/2008
(0 of 1 customers found this review helpful)
4.0
Failed to open file error
By cj brown
from Undisclosed
Comments about oreilly Learning SQL:
Looks like the example needs to be compiled before I can use... I get this error.
mysql: Character set 'JDesktopLearningSQLExample_sql.txt;' is not a compiled cha
racter set and is not specified in the 'C:\mysql\\share\charsets\Index.xml' file
Charset is not found
Any assistanve will be appreciated.
Respectfully,
CJ
9/1/2008
(0 of 1 customers found this review helpful)
4.0
Failed to open file error
By Anonymous
from Undisclosed
Comments about oreilly Learning SQL:
When I try to use the source command to populate my database, I get an error that says, "Failed to open file 'C:\file location', error: 2. What am I doing wrong?
6/11/2008
(0 of 1 customers found this review helpful)
4.0
example section- is having a problem
By Anonymous
from Undisclosed
Comments about oreilly Learning SQL:
I can load the example just fine. The trick is that the example's file name does not match those in the book. So you just use the new name and it's gonna be fine.
2/13/2008
(1 of 2 customers found this review helpful)
5.0
Great start
By Lance
from Undisclosed
Comments about oreilly Learning SQL:
I'm not finished working through this book yet but I am finding it very easy to follow with great examples.
I was not a complete beginner as I had a fairly firm grasp of basic queries but I chose this book to read cover to cover for a more structured learning curve and it's doing just that.
12/22/2007
(2 of 2 customers found this review helpful)
5.0
Very very good
By Anonymous
from Undisclosed
Comments about oreilly Learning SQL:
I did not finish to read the book yet, but so far it is very clear and user friendly. I have a good experience with Filemaker DBs but never used sql (or mysql) before. This book is the right one for the absolute beginners !
I have only one question: where can i find the example database (learning_sql.sql) ?
4/24/2007
(2 of 2 customers found this review helpful)
5.0
Excellent on many levels
By barry
from Undisclosed
Comments about oreilly Learning SQL:
I am thoroughly enjoying this book. It is very well written, moves well from topic to topic, provides just the right amount of content and examples, and does it in a friendly way free of jargon. It makes SQL seem much less daunting, which is exactly what I want from an introductory book.