Close Modal

Practical SQL, 2nd Edition

A Beginner's Guide to Storytelling with Data

Look inside
Paperback
$39.99 US
7"W x 9.25"H x 1"D   (17.8 x 23.5 x 2.5 cm) | 30 oz (839 g) | 18 per carton
On sale Jan 25, 2022 | 464 Pages | 9781718501065
Sales rights: World

Practical SQL, 2nd Edition pages 20-21
Practical SQL, 2nd Edition pages 74-75
Practical SQL, 2nd Edition pages 254-255
Analyze data like a pro, even if you’re a beginner.

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. Anthony DeBarros, a journalist and data analyst, focuses on using SQL to find the story within your data. The examples and code use the open-source database PostgreSQL and its companion pgAdmin interface, and the concepts you learn will apply to most database management systems, including MySQL, Oracle, SQLite, and others.*

You’ll first cover the fundamentals of databases and the SQL language, then build skills by analyzing data from real-world datasets such as US Census demographics, New York City taxi rides, and earthquakes from US Geological Survey. Each chapter includes exercises and examples that 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
  • Aggregate, sort, and filter data to find patterns
  • Use functions for basic math and advanced statistical operations
  • Identify errors in data and clean them up
  • Analyze spatial data with a geographic information system (PostGIS)
  • Create advanced queries and automate tasks

  • This updated second edition has been thoroughly revised to reflect the latest in SQL features, including additional advanced query techniques for wrangling data. This edition also has two new chapters: an expanded set of instructions on for setting up your system plus a chapter on using PostgreSQL with the popular JSON data interchange format. 

    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.

    * Microsoft SQL Server employs a variant of the language called T-SQL, which is not covered by Practical SQL.
    "Even better than the previous edition!"
    —Jakub Romanowski, LearnSQL.com

    "This book is comprehensive, well organized, and contains almost everything a new developer needs to learn SQL using Postgres. Besides, the arrangement of the sections is logical, and the writing style is not complicated where information is supported by the required examples and images, in addition to evidence from the writer's practical experiences."
    —Hadi Fadlallah, SQLShack

    "[W]ell-written and informative . . . an extremely enjoyable book that will keep the reader engaged with interesting, thought-provoking exercises . . . I highly recommend Practical SQL, 2nd Edition to anyone wanting to learn PostgreSQL and how to tell stories with data."
    —Joshua Allen Holm, Opensource.com


    REVIEWS FOR THE FIRST EDITION:

    "This book is comprehensive, well organized, and contains almost everything a new developer needs to learn SQL using Postgres. Besides, the arrangement of the sections is logical, and the writing style is not complicated where information is supported by the required examples and images, in addition to evidence from the writer's practical experiences."
    —Hadi Fadlallah, SQLShack

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

    "More fun and more engaging [than Learning SQL from O'Reilly]."
    —Giles McMullen-Klein, Python Programmer, YouTuber

    Practical SQL will take you from an absolute databases beginner towards becoming a database and SQL master. This book is one of those books that you feel like [you're] reading a novel, not a technical book. It uses an easy to follow and [understandable] approach that makes it easy to read for people from all backgrounds.”
    —Sara A. Metwalli, Towards Data Science

    "I recommend reading Practical SQL by Anthony DeBarros for a more in-depth look on how to implement regression analysis and other analytical tools using SQL."
    —Michael Grogan, Towards Data Science

    "One of the most interesting books about SQL I've ever read. At first glance, it looks like a guide for complete rookies. But the author raises topics that will interest advanced users."
    —Jakub Romanowski, LearnSQL.com
    Anthony DeBarros is a longtime journalist who has combined his interests in data analysis, coding, software product development, and storytelling for much of his career. He is a data news editor for The Wall Street Journal, focusing on topics such as the economy, trade, the U.S. Census, and politics. He previously held positions with USA TODAY, the Poughkeepsie Journal, and the DocumentCloud project for Investigative Reporters and Editors. His work has received multiple honors, including a prestigious Silver Baton from the Alfred I. duPont-Columbia University Awards.
    Available for sale exclusive:
    •     Afghanistan
    •     Aland Islands
    •     Albania
    •     Algeria
    •     Andorra
    •     Angola
    •     Anguilla
    •     Antarctica
    •     Antigua/Barbuda
    •     Argentina
    •     Armenia
    •     Aruba
    •     Australia
    •     Austria
    •     Azerbaijan
    •     Bahamas
    •     Bahrain
    •     Bangladesh
    •     Barbados
    •     Belarus
    •     Belgium
    •     Belize
    •     Benin
    •     Bermuda
    •     Bhutan
    •     Bolivia
    •     Bonaire, Saba
    •     Bosnia Herzeg.
    •     Botswana
    •     Bouvet Island
    •     Brazil
    •     Brit.Ind.Oc.Ter
    •     Brit.Virgin Is.
    •     Brunei
    •     Bulgaria
    •     Burkina Faso
    •     Burundi
    •     Cambodia
    •     Cameroon
    •     Canada
    •     Cape Verde
    •     Cayman Islands
    •     Centr.Afr.Rep.
    •     Chad
    •     Chile
    •     China
    •     Christmas Islnd
    •     Cocos Islands
    •     Colombia
    •     Comoro Is.
    •     Congo
    •     Cook Islands
    •     Costa Rica
    •     Croatia
    •     Cuba
    •     Curacao
    •     Cyprus
    •     Czech Republic
    •     Dem. Rep. Congo
    •     Denmark
    •     Djibouti
    •     Dominica
    •     Dominican Rep.
    •     Ecuador
    •     Egypt
    •     El Salvador
    •     Equatorial Gui.
    •     Eritrea
    •     Estonia
    •     Ethiopia
    •     Falkland Islnds
    •     Faroe Islands
    •     Fiji
    •     Finland
    •     France
    •     Fren.Polynesia
    •     French Guinea
    •     Gabon
    •     Gambia
    •     Georgia
    •     Germany
    •     Ghana
    •     Gibraltar
    •     Greece
    •     Greenland
    •     Grenada
    •     Guadeloupe
    •     Guam
    •     Guatemala
    •     Guernsey
    •     Guinea Republic
    •     Guinea-Bissau
    •     Guyana
    •     Haiti
    •     Heard/McDon.Isl
    •     Honduras
    •     Hong Kong
    •     Hungary
    •     Iceland
    •     India
    •     Indonesia
    •     Iran
    •     Iraq
    •     Ireland
    •     Isle of Man
    •     Israel
    •     Italy
    •     Ivory Coast
    •     Jamaica
    •     Japan
    •     Jersey
    •     Jordan
    •     Kazakhstan
    •     Kenya
    •     Kiribati
    •     Kuwait
    •     Kyrgyzstan
    •     Laos
    •     Latvia
    •     Lebanon
    •     Lesotho
    •     Liberia
    •     Libya
    •     Liechtenstein
    •     Lithuania
    •     Luxembourg
    •     Macau
    •     Macedonia
    •     Madagascar
    •     Malawi
    •     Malaysia
    •     Maldives
    •     Mali
    •     Malta
    •     Marshall island
    •     Martinique
    •     Mauritania
    •     Mauritius
    •     Mayotte
    •     Mexico
    •     Micronesia
    •     Minor Outl.Ins.
    •     Moldavia
    •     Monaco
    •     Mongolia
    •     Montenegro
    •     Montserrat
    •     Morocco
    •     Mozambique
    •     Myanmar
    •     Namibia
    •     Nauru
    •     Nepal
    •     Netherlands
    •     New Caledonia
    •     New Zealand
    •     Nicaragua
    •     Niger
    •     Nigeria
    •     Niue
    •     Norfolk Island
    •     North Korea
    •     North Mariana
    •     Norway
    •     Oman
    •     Pakistan
    •     Palau
    •     Palestinian Ter
    •     Panama
    •     PapuaNewGuinea
    •     Paraguay
    •     Peru
    •     Philippines
    •     Pitcairn Islnds
    •     Poland
    •     Portugal
    •     Puerto Rico
    •     Qatar
    •     Reunion Island
    •     Romania
    •     Russian Fed.
    •     Rwanda
    •     S. Sandwich Ins
    •     Saint Martin
    •     Samoa,American
    •     San Marino
    •     SaoTome Princip
    •     Saudi Arabia
    •     Senegal
    •     Serbia
    •     Seychelles
    •     Sierra Leone
    •     Singapore
    •     Sint Maarten
    •     Slovakia
    •     Slovenia
    •     Solomon Islands
    •     Somalia
    •     South Africa
    •     South Korea
    •     South Sudan
    •     Spain
    •     Sri Lanka
    •     St Barthelemy
    •     St. Helena
    •     St. Lucia
    •     St. Vincent
    •     St.Chr.,Nevis
    •     St.Pier,Miquel.
    •     Sth Terr. Franc
    •     Sudan
    •     Suriname
    •     Svalbard
    •     Swaziland
    •     Sweden
    •     Switzerland
    •     Syria
    •     Tadschikistan
    •     Taiwan
    •     Tanzania
    •     Thailand
    •     Timor-Leste
    •     Togo
    •     Tokelau Islands
    •     Tonga
    •     Trinidad,Tobago
    •     Tunisia
    •     Turkey
    •     Turkmenistan
    •     Turks&Caicos Is
    •     Tuvalu
    •     US Virgin Is.
    •     USA
    •     Uganda
    •     Ukraine
    •     Unit.Arab Emir.
    •     United Kingdom
    •     Uruguay
    •     Uzbekistan
    •     Vanuatu
    •     Vatican City
    •     Venezuela
    •     Vietnam
    •     Wallis,Futuna
    •     West Saharan
    •     Western Samoa
    •     Yemen
    •     Zambia
    •     Zimbabwe

    Introduction

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

    Appendix A. Additional Resources

    Photos

    Practical SQL, 2nd Edition pages 20-21
    Practical SQL, 2nd Edition pages 74-75
    Practical SQL, 2nd Edition pages 254-255

    About

    Analyze data like a pro, even if you’re a beginner.

    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. Anthony DeBarros, a journalist and data analyst, focuses on using SQL to find the story within your data. The examples and code use the open-source database PostgreSQL and its companion pgAdmin interface, and the concepts you learn will apply to most database management systems, including MySQL, Oracle, SQLite, and others.*

    You’ll first cover the fundamentals of databases and the SQL language, then build skills by analyzing data from real-world datasets such as US Census demographics, New York City taxi rides, and earthquakes from US Geological Survey. Each chapter includes exercises and examples that 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
  • Aggregate, sort, and filter data to find patterns
  • Use functions for basic math and advanced statistical operations
  • Identify errors in data and clean them up
  • Analyze spatial data with a geographic information system (PostGIS)
  • Create advanced queries and automate tasks

  • This updated second edition has been thoroughly revised to reflect the latest in SQL features, including additional advanced query techniques for wrangling data. This edition also has two new chapters: an expanded set of instructions on for setting up your system plus a chapter on using PostgreSQL with the popular JSON data interchange format. 

    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.

    * Microsoft SQL Server employs a variant of the language called T-SQL, which is not covered by Practical SQL.

    Praise

    "Even better than the previous edition!"
    —Jakub Romanowski, LearnSQL.com

    "This book is comprehensive, well organized, and contains almost everything a new developer needs to learn SQL using Postgres. Besides, the arrangement of the sections is logical, and the writing style is not complicated where information is supported by the required examples and images, in addition to evidence from the writer's practical experiences."
    —Hadi Fadlallah, SQLShack

    "[W]ell-written and informative . . . an extremely enjoyable book that will keep the reader engaged with interesting, thought-provoking exercises . . . I highly recommend Practical SQL, 2nd Edition to anyone wanting to learn PostgreSQL and how to tell stories with data."
    —Joshua Allen Holm, Opensource.com


    REVIEWS FOR THE FIRST EDITION:

    "This book is comprehensive, well organized, and contains almost everything a new developer needs to learn SQL using Postgres. Besides, the arrangement of the sections is logical, and the writing style is not complicated where information is supported by the required examples and images, in addition to evidence from the writer's practical experiences."
    —Hadi Fadlallah, SQLShack

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

    "More fun and more engaging [than Learning SQL from O'Reilly]."
    —Giles McMullen-Klein, Python Programmer, YouTuber

    Practical SQL will take you from an absolute databases beginner towards becoming a database and SQL master. This book is one of those books that you feel like [you're] reading a novel, not a technical book. It uses an easy to follow and [understandable] approach that makes it easy to read for people from all backgrounds.”
    —Sara A. Metwalli, Towards Data Science

    "I recommend reading Practical SQL by Anthony DeBarros for a more in-depth look on how to implement regression analysis and other analytical tools using SQL."
    —Michael Grogan, Towards Data Science

    "One of the most interesting books about SQL I've ever read. At first glance, it looks like a guide for complete rookies. But the author raises topics that will interest advanced users."
    —Jakub Romanowski, LearnSQL.com

    Author

    Anthony DeBarros is a longtime journalist who has combined his interests in data analysis, coding, software product development, and storytelling for much of his career. He is a data news editor for The Wall Street Journal, focusing on topics such as the economy, trade, the U.S. Census, and politics. He previously held positions with USA TODAY, the Poughkeepsie Journal, and the DocumentCloud project for Investigative Reporters and Editors. His work has received multiple honors, including a prestigious Silver Baton from the Alfred I. duPont-Columbia University Awards.

    Rights

    Available for sale exclusive:
    •     Afghanistan
    •     Aland Islands
    •     Albania
    •     Algeria
    •     Andorra
    •     Angola
    •     Anguilla
    •     Antarctica
    •     Antigua/Barbuda
    •     Argentina
    •     Armenia
    •     Aruba
    •     Australia
    •     Austria
    •     Azerbaijan
    •     Bahamas
    •     Bahrain
    •     Bangladesh
    •     Barbados
    •     Belarus
    •     Belgium
    •     Belize
    •     Benin
    •     Bermuda
    •     Bhutan
    •     Bolivia
    •     Bonaire, Saba
    •     Bosnia Herzeg.
    •     Botswana
    •     Bouvet Island
    •     Brazil
    •     Brit.Ind.Oc.Ter
    •     Brit.Virgin Is.
    •     Brunei
    •     Bulgaria
    •     Burkina Faso
    •     Burundi
    •     Cambodia
    •     Cameroon
    •     Canada
    •     Cape Verde
    •     Cayman Islands
    •     Centr.Afr.Rep.
    •     Chad
    •     Chile
    •     China
    •     Christmas Islnd
    •     Cocos Islands
    •     Colombia
    •     Comoro Is.
    •     Congo
    •     Cook Islands
    •     Costa Rica
    •     Croatia
    •     Cuba
    •     Curacao
    •     Cyprus
    •     Czech Republic
    •     Dem. Rep. Congo
    •     Denmark
    •     Djibouti
    •     Dominica
    •     Dominican Rep.
    •     Ecuador
    •     Egypt
    •     El Salvador
    •     Equatorial Gui.
    •     Eritrea
    •     Estonia
    •     Ethiopia
    •     Falkland Islnds
    •     Faroe Islands
    •     Fiji
    •     Finland
    •     France
    •     Fren.Polynesia
    •     French Guinea
    •     Gabon
    •     Gambia
    •     Georgia
    •     Germany
    •     Ghana
    •     Gibraltar
    •     Greece
    •     Greenland
    •     Grenada
    •     Guadeloupe
    •     Guam
    •     Guatemala
    •     Guernsey
    •     Guinea Republic
    •     Guinea-Bissau
    •     Guyana
    •     Haiti
    •     Heard/McDon.Isl
    •     Honduras
    •     Hong Kong
    •     Hungary
    •     Iceland
    •     India
    •     Indonesia
    •     Iran
    •     Iraq
    •     Ireland
    •     Isle of Man
    •     Israel
    •     Italy
    •     Ivory Coast
    •     Jamaica
    •     Japan
    •     Jersey
    •     Jordan
    •     Kazakhstan
    •     Kenya
    •     Kiribati
    •     Kuwait
    •     Kyrgyzstan
    •     Laos
    •     Latvia
    •     Lebanon
    •     Lesotho
    •     Liberia
    •     Libya
    •     Liechtenstein
    •     Lithuania
    •     Luxembourg
    •     Macau
    •     Macedonia
    •     Madagascar
    •     Malawi
    •     Malaysia
    •     Maldives
    •     Mali
    •     Malta
    •     Marshall island
    •     Martinique
    •     Mauritania
    •     Mauritius
    •     Mayotte
    •     Mexico
    •     Micronesia
    •     Minor Outl.Ins.
    •     Moldavia
    •     Monaco
    •     Mongolia
    •     Montenegro
    •     Montserrat
    •     Morocco
    •     Mozambique
    •     Myanmar
    •     Namibia
    •     Nauru
    •     Nepal
    •     Netherlands
    •     New Caledonia
    •     New Zealand
    •     Nicaragua
    •     Niger
    •     Nigeria
    •     Niue
    •     Norfolk Island
    •     North Korea
    •     North Mariana
    •     Norway
    •     Oman
    •     Pakistan
    •     Palau
    •     Palestinian Ter
    •     Panama
    •     PapuaNewGuinea
    •     Paraguay
    •     Peru
    •     Philippines
    •     Pitcairn Islnds
    •     Poland
    •     Portugal
    •     Puerto Rico
    •     Qatar
    •     Reunion Island
    •     Romania
    •     Russian Fed.
    •     Rwanda
    •     S. Sandwich Ins
    •     Saint Martin
    •     Samoa,American
    •     San Marino
    •     SaoTome Princip
    •     Saudi Arabia
    •     Senegal
    •     Serbia
    •     Seychelles
    •     Sierra Leone
    •     Singapore
    •     Sint Maarten
    •     Slovakia
    •     Slovenia
    •     Solomon Islands
    •     Somalia
    •     South Africa
    •     South Korea
    •     South Sudan
    •     Spain
    •     Sri Lanka
    •     St Barthelemy
    •     St. Helena
    •     St. Lucia
    •     St. Vincent
    •     St.Chr.,Nevis
    •     St.Pier,Miquel.
    •     Sth Terr. Franc
    •     Sudan
    •     Suriname
    •     Svalbard
    •     Swaziland
    •     Sweden
    •     Switzerland
    •     Syria
    •     Tadschikistan
    •     Taiwan
    •     Tanzania
    •     Thailand
    •     Timor-Leste
    •     Togo
    •     Tokelau Islands
    •     Tonga
    •     Trinidad,Tobago
    •     Tunisia
    •     Turkey
    •     Turkmenistan
    •     Turks&Caicos Is
    •     Tuvalu
    •     US Virgin Is.
    •     USA
    •     Uganda
    •     Ukraine
    •     Unit.Arab Emir.
    •     United Kingdom
    •     Uruguay
    •     Uzbekistan
    •     Vanuatu
    •     Vatican City
    •     Venezuela
    •     Vietnam
    •     Wallis,Futuna
    •     West Saharan
    •     Western Samoa
    •     Yemen
    •     Zambia
    •     Zimbabwe

    Table of Contents

    Introduction

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

    Appendix A. Additional Resources