Leanpub Header

Skip to main content

Turn data into answers with practical SQL

A practical guide for analysts, with a practice dataset and 10 worked exercises

Turn data into answers with practical SQL
This book is 100% completeLast updated on 2026-11-10

Learn practical SQL through realistic business questions, a hands-on dataset, and 10 worked exercises. Build the confidence to query, interpret, and communicate your results.

Minimum price

$19.00

$19.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
About

About

About the Book

Turn everyday business questions into clear, reliable answers with SQL.

This practical guide takes you from understanding how data is organized to writing queries and interpreting results. Follow a fictional company’s data through realistic examples, and learn to think carefully about the definitions, assumptions, and common mistakes that can change a decision.

What you’ll learn:

• Filter and summarize data with SELECT, WHERE, GROUP BY, and HAVING.

• Combine tables with JOINs and transform values with CASE.

• Organize your thinking with CTEs and subqueries.

• Work through six business questions involving sales, products, customers, and regions.

• Recognize issues such as duplicate rows, misleading aggregations, and inconsistent definitions.

• Communicate results, interpretations, and limitations clearly.

Inside you’ll find a complete practice dataset, 10 exercises with explained answers, a SQL cheat sheet, and a glossary. Examples were checked in DuckDB and use standard SQL where possible; syntax can vary across database systems.

For aspiring and working analysts who want to move beyond memorizing syntax and use data to support better everyday decisions.

Share this book

Categories

Author

About the Author

Felipe Bueno

Felipe Bueno is a senior data engineer who works with data platforms, analytics, and SQL. He wrote this book to help analysts turn everyday questions into useful, trustworthy answers and communicate their findings with confidence.

Contents

Table of Contents

  • 1. SQL in context
  • 2. How data is organized
  • 3. Querying a table
  • 4. Combining tables and transforming values
  • 5. Six business questions
  • 6. Errors that change decisions
  • 7. Good practices and technical conversations
  • 8. Practice: exercises and answers
  • Quick reference and glossary
  • Next steps and references
  • Appendix: Build your practice dataset

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub