Cover of SQL in 10 Minutes Sams Teach Yourself by Ben Forta, featuring the book's title against a clean structured design representing database concepts

Pages

287

Published

2012

SQL ✨ New

SQL in 10 Minutes, Sams Teach Yourself

A beginner-friendly, lesson-by-lesson introduction to SQL for real-world data retrieval and manipulation

Learn to write SQL queries that actually work β€” one focused 10-minute lesson at a time.

SQL in 10 Minutes gives you exactly what it promises: short, focused lessons that build your SQL skills from the ground up. Ben Forta strips away the noise and teaches you to retrieve, filter, sort, join, and manipulate data using plain, portable SQL. Each lesson fits inside a coffee break, and by the end you can write queries that work across MySQL, PostgreSQL, Oracle, SQL Server, and SQLite without needing a formal database course to get there.

About this book

Most SQL books start with database theory. This one starts with results. Ben Forta's approach is direct: each lesson is designed to fit inside ten minutes, cover one concrete skill, and leave you with working SQL you can immediately apply to your own data.

The book moves in a straight line from your first SELECT statement through filtering with WHERE, sorting with ORDER BY, and grouping with GROUP BY β€” then into joins, subqueries, stored procedures, and transactions. Nothing is padded. Every example uses realistic table structures you'll recognize from actual work: customers, orders, products, vendors.

The SQL Forta teaches is standard enough to run on the databases you're actually likely to use. The book explicitly covers MySQL, MariaDB, Oracle, Microsoft SQL Server, PostgreSQL, and SQLite, noting where syntax differs so you don't spend an afternoon debugging a dialect mismatch.

This is not a reference book you keep on a shelf and open once a year. It's a short course you finish in a weekend, after which you can write and read SQL without guessing. That makes it useful both for people who have never opened a database client and for analysts or developers who pick up SQL by copying examples and want to fill in the gaps they've been papering over.

  • 22 self-contained lessons β€” each designed to be completed in about 10 minutes
  • Covers SELECT, INSERT, UPDATE, DELETE, joins, subqueries, views, stored procedures, and transactions
  • Explicit syntax notes for MySQL, Oracle, SQL Server, PostgreSQL, SQLite, and MariaDB
  • Appendices with SQL syntax references and worked solutions to all challenges
  • Challenge questions at the end of each lesson to test what you just learned

At 287 pages, this book respects your time. You do not need to read it cover to cover to get value from it, though most readers do exactly that because the pacing makes it easy to keep going. If you are starting from zero or want a clean, fast foundation before moving to more advanced material, this is the right starting point.

🎯 What you'll learn

  • Write SELECT statements that retrieve exactly the rows and columns you need
  • Filter data precisely using WHERE clauses, wildcards, and regular expressions
  • Join multiple tables together using INNER, LEFT, RIGHT, and self-joins
  • Aggregate and group data with SUM, COUNT, AVG, and GROUP BY
  • Modify data safely with INSERT, UPDATE, and DELETE statements
  • Build reusable queries using subqueries and views
  • Understand transactions and how to use COMMIT and ROLLBACK to protect data integrity
  • Spot and handle syntax differences across MySQL, Oracle, SQL Server, PostgreSQL, and SQLite

πŸ‘€ Who is this book for?

  • Complete beginners who have never written a SQL query and want a structured, low-friction path to competence
  • Analysts and marketers who run canned reports but want to write their own queries without relying on a developer
  • Backend developers who know their ORM but need to understand what SQL it is actually generating
  • Students working through a database course who want a second, plainer explanation alongside a textbook
  • Professionals switching to a data-adjacent role who need functional SQL skills within days, not months

Table of contents

  1. 01

    Understanding SQL

    You learn what a database is, what SQL does, and why relational databases store data the way they do. By the end you have the conceptual model that every lesson after this builds on.

  2. 02

    Retrieving Data

    You write your first SELECT statement and retrieve columns from a real table. You see immediately what a result set looks like and how to control which columns come back.

  3. 03

    Sorting Retrieved Data

    You add ORDER BY to sort query results by one or more columns, in ascending or descending order, and learn why sort order is never guaranteed without it.

  4. 04

    Filtering Data

    You use the WHERE clause to return only rows that match a condition, working through comparison operators and understanding how the database evaluates filters.

  5. 05

    Advanced Data Filtering

    You combine multiple conditions with AND and OR, control evaluation order with parentheses, and use IN and NOT to write precise, readable filter logic.

  6. 06

    Using Wildcard Filtering

    You use LIKE with percent and underscore wildcards to match partial strings, and learn the performance trade-offs that come with wildcard searches.

  7. 07

    Searching with Regular Expressions

    You apply REGEXP to match complex string patterns in rows, covering character classes, repetition, and anchoring for databases that support regex filtering.

  8. 08

    Creating Calculated Fields

    You concatenate columns, perform arithmetic inside a SELECT, and alias results so your output looks exactly the way a report or application expects it.

  9. 09

    Using Data Manipulation Functions

    You use built-in text, numeric, and date functions to transform values inside queries, with a clear map of which functions differ between database platforms.

  10. 10

    Summarizing Data

    You use aggregate functions β€” COUNT, SUM, AVG, MIN, MAX β€” to compute summary statistics across entire result sets and across filtered subsets.

  11. 11

    Grouping Data

    You combine GROUP BY with aggregate functions to produce per-group summaries, and filter groups with HAVING to get exactly the breakdown you need.

  12. 12

    Working with Subqueries

    You nest one SELECT inside another to answer questions that require two passes through the data, and learn where subqueries outperform joins and where they do not.

  13. 13

    Joining Tables

    You combine data from two or more tables using INNER JOIN, understand how foreign keys make joins possible, and see what a Cartesian product looks like so you know to avoid it.

  14. 14

    Creating Advanced Joins

    You use self-joins, natural joins, and outer joins to handle more complex relationships between tables, including rows that have no matching record on the other side.

  15. 15

    Combining Queries

    You merge the results of multiple SELECT statements into one result set using UNION, and learn when UNION ALL is the right choice over UNION.

  16. 16

    Inserting Data

    You write INSERT statements to add single rows and batches of rows, and insert data derived from another SELECT rather than hard-coded values.

  17. 17

    Updating and Deleting Data

    You use UPDATE to change existing rows and DELETE to remove them, with clear guidance on using WHERE to avoid the most common and costly mistakes.

  18. 18

    Creating and Manipulating Tables

    You write CREATE TABLE statements with appropriate data types and constraints, then use ALTER TABLE to modify a table's structure after it exists.

  19. 19

    Using Views

    You create views to save complex queries as reusable named objects, and understand what views can and cannot do depending on your database platform.

  20. 20

    Working with Stored Procedures

    You create and execute stored procedures to encapsulate logic on the database server, covering parameter passing and the syntax variations between platforms.

  21. 21

    Using Cursors

    You step through a result set row by row using a cursor, learning when cursor-based processing is appropriate and how to open, fetch, and close one correctly.

  22. 22

    Understanding Transactions

    You use BEGIN TRANSACTION, COMMIT, and ROLLBACK to group statements into atomic units of work, protecting your data when something goes wrong mid-operation.

Frequently asked questions

Do I need any prior database or programming experience to read this book?

No. The book assumes no prior knowledge of SQL or databases. It starts from the very beginning and builds up one small skill at a time.

Which databases does this book cover?

The examples are written in standard SQL that runs on MySQL, MariaDB, Oracle, Microsoft SQL Server, PostgreSQL, and SQLite. Where syntax differs between platforms, Forta calls it out explicitly.

Is this book still relevant given it was published in 2012?

Standard SQL has not changed fundamentally since 2012. The core SELECT, JOIN, and data-modification syntax this book teaches is as valid today as it was then. You will not find coverage of window functions or JSON columns, but for foundational SQL it remains accurate.

Is this a reference book or a book I read from start to finish?

It works both ways. Most readers go cover to cover because the lessons are short and build on each other. You can also jump to a specific lesson if you already know the basics and want to fill a gap.

Are there exercises or practice problems included?

Yes. Each lesson ends with a set of challenge questions, and the solutions are included in an appendix at the back of the book.

Is this suitable for someone who needs SQL for data analysis rather than software development?

Yes. The book focuses on retrieving and understanding data, which maps directly to analyst work. It does not require you to set up a full application stack or know any programming language.

You might also like

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.