Sams Teach Yourself SQL in 10 Minutes has established itself as the gold standard for introductory SQL books, offering a fast-paced accessible tutorial to the major themes and techniques involved in applying the SQL language. Forta¿s examples are clear and his writing style is crisp and concise. As with earlier editions, this revision includes coverage of current versions of all major commercial SQL platforms. New this time around is coverage of MySQL, and PostgreSQL. All examples have been tested against each SQL platform, with incompatibilities or platform distinctives called out and explained.
About the Author
Ben Forta is Macromedia's Senior Technical Evangelist and has almost 20 years of experience in the computer industry in product development, support, training, and product marketing. Ben is the author of the best-selling ColdFusion Web Application Construction Kit and Advanced ColdFusion Development (both published by Que), Sams Teach Yourself Regular Expressions in 10 Minutes (in this same series), and also books on Flash, Java, WAP, Windows 2000, and other subjects. He has extensive experience in database design and development, has implemented databases for several highly successful commercial software programs, and is a frequent lecturer and columnist on Internet and database technologies. Born in London, England, and educated in London, New York, and Los Angeles, Ben now lives in Oak Park, Michigan, with his wife Marcy and their seven children. Ben welcomes your email at firstname.lastname@example.org, and invites you to visit his Web site at http://www.forta.com.
Table of Contents
Lesson 1. Understanding SQL.
Database Basics. What Is SQL? Try It Yourself. Summary.
Lesson 2. Retrieving Data.
The SELECT Statement. Retrieving Individual Columns. Retrieving Multiple Columns. Retrieving All Columns. Summary.
Lesson 3. Sorting Retrieved Data.
Sorting Data. Sorting by Multiple Columns. Sorting by Column Position. Specifying Sort Direction. Summary.
Lesson 4. Filtering Data.
Using the WHERE Clause. The WHERE Clause Operators. Summary.
Lesson 5. Advanced Data Filtering.
Combining WHERE Clauses. Using the IN Operator. Using the NOT Operator. Summary.
Lesson 6. Using Wildcard Filtering.
Using the LIKE Operator. Tips for Using Wildcards. Summary.
Lesson 7. Creating Calculated Fields.
Understanding Calculated Fields. Concatenating Fields. Performing Mathematical Calculations. Summary.
Lesson 8. Using Data Manipulation Functions.
Understanding Functions. Using Functions. Summary.
Lesson 9. Summarizing Data.
Using Aggregate Functions. Aggregates on Distinct Values. Combining Aggregate Functions. Summary.
Lesson 10. Grouping Data.
Understanding Data Grouping. Creating Groups. Filtering Groups. Grouping and Sorting. SELECT Clause Ordering. Summary.
Lesson 11. Working with Subqueries.
Understanding Subqueries. Filtering by Subquery. Using Subqueries As Calculated Fields. Summary.
Lesson 12. Joining Tables.
Understanding Joins. Creating a Join. Summary.
Lesson 13. Creating Advanced Joins.
Using Table Aliases. Using Different Join Types. Using Joins with Aggregate Functions. Using Joins and Join Conditions. Summary.
Lesson 14. Combining Queries.
Understanding Combined Queries. Creating Combined Queries. Summary.
Lesson 15. Inserting Data.
Understanding Data Insertion. Copying from One Table to Another. Summary.
Lesson 16. Updating and Deleting Data.
Updating Data. Deleting Data. Guidelines for Updating and Deleting Data. Summary.
Lesson 17. Creating and Manipulating Tables.
Creating Tables. Updating Tables. Deleting Tables. Renaming Tables. Summary.
Lesson 18. Using Views.
Understanding Views. Creating Views. Summary.
Lesson 19. Working with Stored Procedures.
Understanding Stored Procedures. Why to Use Stored Procedures. Executing Stored Procedures. Creating Stored Procedures. Summary.
Lesson 20. Managing Transaction Processing.
Understanding Transaction Processing. Controlling Transactions. Summary.
Lesson 21. Using Cursors.
Understanding Cursors. Working with Cursors. Summary.
Lesson 22. Understanding Advanced SQL Features.
Understanding Constraints. Understanding Indexes. Understanding Triggers. Database Security. Summary.
Appendix A: Sample Table Scripts.
Understanding the Sample Tables. Obtaining the Sample Tables.
Appendix B: Working in Popular Applications.
Using Aqua Data Studio. Using DB2. Using Macromedia ColdFusion. Using Microsoft Access. Using Microsoft ASP. Using Microsoft ASP.NET. Using Microsoft Query. Using Microsoft SQL Server. Using MySQL. Using Oracle. Using PHP. Using PostgreSQL. Using Query Tool. Using Sybase. Configuring ODBC Data Sources.
Appendix C: SQL Statement Syntax.
ALTER TABLE. COMMIT. CREATE INDEX. CREATE PROCEDURE. CREATE TABLE. CREATE VIEW. DELETE. DROP. INSERT. INSERT SELECT. ROLLBACK. SELECT. UPDATE.
Appendix D: Using SQL Datatypes.
String Datatypes. Numeric Datatypes. Date and Time Datatypes. Binary Datatypes.
Appendix E: SQL Reserved Words.
There are lots of SQL books out there. Some are actually very good. But they all have one thing in common: For most users they teach just too much information. Instead of teaching SQL itself, most books teach everything from database design and normalization to relational database theory and administrative concerns. Although those are all important topics, they are not of interest to most of us who just need to learn SQL.
That is where this book comes in. Sams Teach Yourself SQL in 10 Minutes will teach you SQL, starting with simple data retrieval and working on to more complex topics including the use of joins, subqueries, and table constraints. You'll learn what you need to know methodically, systematically, and simply-in lessons that will each take 10 minutes or less to complete.
So turn to Lesson 1, and get to work. You'll be writing world-class SQL in no time at all.
Who is the Teach Yourself SQL book for?
This book is for you if:
- You are new to SQL.
- You want to quickly learn how to get the most out of SQL.
- You want to do things quickly and easily in SQL without having to call someone for help.
Conventions Used in This Book
This book uses different typefaces to differentiate between code and regular English, and also to help you identify important concepts.
Text that you type and text that should appear on your screen is presented in monospace type.
It willlook like this to mimic the way text looks on your screen.
Placeholders for variables and expressions appear in monospace italic font You should replace the placeholder with the specific value it represents.
This arrow at the beginning of a line of code means that a single line of code is too long to fit on the printed page. Continue typing all characters after the as though they were part of the preceding line.
New Term icons provide clear definitions of new, essential terms. The term appears in italic.
The Input icon identifies code that you can type in yourself. It usually appears next to a listing.
The Output icon highlights the output produced by running a program. It usually appears after a listing.
The Analysis icon alerts you to the author's line-by-line analysis of a program.
Most Helpful Customer Reviews
I found this book to be a reference for beginners when utilizing SQL. It's good to have by the desk side to use as a quick reference tool and is organized in a logical format
This is a great introduction to SQL. It starts slow and gives you the essential details to do a practical 'work unit.' To use this book as intended, it is helpful if you have some programming background and/or even just a little exposure to databases.
This book is more of a quick reference on basic SQL. As a web application developer who doesn't use SQL query on a daily basis. This book is helpful on reminding me some SQL syntax that I know but cannot recall right away from my head.
Great for beginners who just want to get started with what they need.
I was very impressed having never worked with SQL before. I was writing queries within the first few pages. Being a light VB programmer, adapting was easy as pie. Highly recommended if you will be writing a front end in any programming language, or if you just want to interact with SQL from Word or Excel. Very well written
This book is simply amazing as the other books by Ben Forta. Very few typos. Very concise. Anyone serious about SQL should read this book.
An excellent primer. Read it in one nite. You can start turning out good queries, immediately.
Sure, the book is good, but let's not downplay the importance of understanding the full spectrum of SQL Server. Enormous catostraphic damage can occur from giving people the false sense of security that they can learn SQL in 10 minutes.