Practical SQL

Practical SQL

A Beginner’s Guide to Storytelling with Data
by Anthony DeBarros
May 2018, 392 pp.
ISBN-13: 
978-1-59327-827-4

Practical SQL is an approachable and fast-paced guide to SQL (Structured Query Language), the standard programming language for defining, organizing, and exploring data in relational databases. The book focuses on using SQL to find the story your data tells, with the popular open-source database PostgreSQL and the pgAdmin interface as its primary tools.

You’ll first cover the fundamentals of databases and the SQL language, then build skills by analyzing data from the U.S. Census and other federal and state government agencies. With exercises and real-world examples in each chapter, this book will teach even those who have never programmed before all the tools necessary to build powerful databases and access information quickly and efficiently.

You’ll learn how to:

  • Create databases and related tables using your own data
  • Define the right data types for your information
  • Aggregate, sort, and filter data to find patterns
  • Use basic math and advanced statistical functions
  • Identify errors in data and clean them up
  • Import and export data using delimited text files
  • Write queries for geographic information systems (GIS)
  • Create advanced queries and automate tasks

Learning SQL doesn’t have to be dry and complicated. Practical SQL delivers clear examples with an easy-to-follow approach to teach you the tools you need to build and manage your own databases.

This book uses PostgreSQL, but the SQL syntax is applicable to many database applications, including Microsoft SQL Server and MySQL.

Author Bio 

Anthony DeBarros is an award-winning journalist who has combined avid interests in data analysis, coding, and storytelling for much of his career. He spent more than 25 years with the Gannett company, including the Poughkeepsie Journal, USA TODAY, and Gannett Digital. He currently lives and works in the Washington, D.C., area.

Table of contents 

Introduction
Chapter 1: Creating Your First Database and Table
Chapter 2: Beginning Data Exploration with SELECT
Chapter 3: Understanding Data Types
Chapter 4: Importing and Exporting Data
Chapter 5: Basic Math and Stats with SQL
Chapter 6: Table Joins in a Relational Database
Chapter 7: Table Design that Works for You
Chapter 8: Extracting Information by Grouping and Summarizing
Chapter 9: Inspecting and Modifying Data
Chapter 10: Statistical Functions in SQL
Chapter 11: Working with Dates and Times
Chapter 12: Advanced Query Techniques
Chapter 13: Extracting Data from Text
Chapter 14: Analyzing Spatial Data with PostGIS
Chapter 15: Saving Time with Views, Functions, and Triggers
Chapter 16: Using PostgreSQL from the Command Line
Chapter 17: Maintaining Your Database
Chapter 18: Identifying and Telling the Story Behind Your Data
Appendix: Additional PostgreSQL Resources

View the Detailed Table of Contents
View the Index

Reviews 

“One of the best-organized travelogues we've seen into the SQL realm.”
Newstips Bulletin

Updates 

Figure 1 on page xxxiii of the Introduction shows the pgAdmin app's opening screen. Beginning with version 3.0 of pgAdmin, released in April 2018, the application loads as a tab within your default web browser. Previous versions of pgAdmin run as a standalone desktop application. All other functionality for pgAdmin described in the book remains the same.