I highly recommend “The Language of SQL – Second Edition” to any beginner wanting to learn SQL. The presentation of material is clear and concise. The key elements of SQL, including some more advanced topics, are introduced in a logical and intuitive manner.
The back of the book’s claim to “Get Started Fast with SQL!” is more fact than fiction. At approximately 20 minutes of reading time per chapter, this book can be completed within a relatively short period of time.
Larry Rockoff, The Language of SQL – Second Edition, Addison-Wesley, Copyright 2017 by Pearson Education, Inc. – 224 pages. ISBN-13: 978-0-13-465825-4, ISBN-10: 0-13-465825-6
After purchasing your book, you can register your copy at informit.com/register where you will also have access to downloads, updates, or errata. The companion website for the book includes files containing all of the SQL scripts and statements to setup the databases and tables used in the examples.
Although learning by doing is preferred, you can read through the text and learn the context of the language statements, expressions, and constructs without the need for installing and setting up a SQL database.
This book is the perfect starting point for anyone using SQL Server, Oracle, or MySQL. Though almost all relational database management systems share common SQL features, there are differences between them.
Example SQL code listings are presented for SQL Server. Where differences in syntax or language features occur, alternate code for Oracle and / or MySQL are presented and explained in the sidebars.
At first glance, SQL is a relatively simple language especially since the SELECT statement used to retrieve data from a database appears to only require the use of a few key words. The book presents a simplified version of a full SQL statement that serves as the baseline to develop queries and support the discussions that follow:
GROUP BY columnlist
ORDER BY columnlist
As anyone who has used SQL will tell you, this is no reflection of the powerful capabilities that SQL has to offer. Having just finished reading and working through more than 700 pages of “SQL Queries For Mere Mortals – Third Edition” by John L. Viescas and Michael J. Hernandez (Addison-Wesley), there is clearly more to SQL than knowing more than a few key words.
“The Language of SQL – Second Edition” is comprised of 20 chapters, each following a logical progression of focused topics throughout the book. A chapter listing and the key words introduced follows:
- Chapter 1: Relational Databases and SQL
- Chapter 2: Basic Data Retrieval – SELECT, FROM
- Chapter 3: Calculated Fields and Aliases – AS
- Chapter 4: Using Functions – LEFT, RIGHT, SUBSTRING, LTRIM, RTRIM, UPPER, LOWER, GETDATE, DATEPART, DATEDIFF, ROUND, PI, POWER, ISNULL
- Chapter 5: Sorting Data – ORDER BY, ASC, DESC
- Chapter 6: Selection Criteria – WHERE, TOP, LIKE
- Chapter 7: Boolean Logic – AND, OR, NOT, BETWEEN, IN, IS NULL
- Chapter 8: Conditional Logic – CASE, WHEN, THEN, ELSE, END
- Chapter 9: Summarizing Data – DISTINCT, SUM, AVG, MIN, MAX, COUNT, GROUP BY, HAVING, ROW_NUMBER, RANK, DENSE RANK, NTILE, OVER, PARTITION BY
- Chapter 10: Subtotals and Crosstabs – ROLLUP, GROUPING, CUBE, PIVOT, FOR
- Chapter 11: Inner Joins – INNER JOIN, ON
- Chapter 12: Outer Joins – LEFT JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN
- Chapter 13: Self Joins and Views – CREATE VIEW, ALTER VIEW, DROP VIEW
- Chapter 14: Subqueries – EXISTS, WITH
- Chapter 15: Set Logic – UNION, UNION ALL, INTERSECT, EXCEPT
- Chapter 16: Stored Procedures and Parameters – CREATE PROCEDURE, BEGIN, EXEC/CALL, ALTER PROCEDURE, DROP PROCEDURE
- Chapter 17: Modifying Data – INSERT INTO, VALUES, DELETE, TRUNCATE TABLE, UPDATE, SET
- Chapter 18: Maintaining Tables – CREATE TABLE, DROP TABLE, CREATE INDEX, DROP INDEX
- Chapter 19: Principles of Database Design
- Chapter 20: Strategies for Displaying Data
The chapter titles and keywords are indicative of the comprehensive coverage this book has to offer in only 224 pages. The examples presented are simple and very easy to follow as their purpose is to demonstrate the capabilities of the SQL statements or concepts presented.
It would be unreasonable and virtually impossible for a single book to cover every nuance of SQL. Some topics are database implementation specific and best referred to the manuals and books that pertain to them. Other topics are simply beyond the scope of the book.
The topical discussions in the book are not exhaustive and some are cause for a complete book of their own. For example, a brief discussion of Common Table Expressions in chapter 14 is the sole subject of an excellent book titled “Common Table Expressions Joes 2 Pros: A Solution Series Tutorial on Everything You Ever Wanted to Know about Common Table Expressions” by Steve Stedman (2013-05-01).
Although there is more to learning SQL than this book has to offer, it serves as an excellent starting point to understanding the powerful capabilities that relational database management systems have to offer.
On a related note, if you have yet to decide what relational database management system to use, the differences between Microsoft SQL Server, Oracle, and MySQL noted in the book may provide some guidance. As the book’s primary focus is Microsoft SQL Server, it is worth noting that some functions and / or language features are not supported by Oracle and / or MySQL.
As mentioned earlier, this book presents information in a manner that is easy to comprehend and apply. As I tend to use EXCEL and Crystal Reports for some of the work I do, I was pleasantly surprised to see that the final chapter of the book includes a brief and worthwhile discussion on the use of external tools such as EXCEL’s pivot tables.
Although it doesn’t present everything SQL has to offer, “The Language of SQL – Second Edition” is certainly a good beginning.
Page 35, Numeric Functions: The RAND function is NOT covered in this section as stated in the last (3rd) line of the first paragraph:
The functions we’ll cover are ROUND, RAND, PI, and POWER.
Page 161, Looking Ahead: Beginning at line 5 in the first paragraph, the word INTERCEPT should be replaced with the word INTERSECT and the text should read as follows:
Similarly, the INTERSECT operator allows data to be presented if it is in both of the sets of data being combined. The INTERSECT is analogous to the AND operator.
Larry Rockoff, The Language of SQL 2nd Edition, Addison-Wesley, Copyright 2017 by Pearson Education, Inc. – 224 pages. ISBN-13: 978-0-13-465825-4, ISBN-10: 0-13-465825-6
Until Next Time!