Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying SQL for Data Analytics
  • Table Of Contents Toc
SQL for Data Analytics

SQL for Data Analytics - Fourth Edition

By : Jun Shan, Benjamin Johnston, Haibin Li, Matt Goldwasser, Upom Malik
close
close
SQL for Data Analytics

SQL for Data Analytics

By: Jun Shan, Benjamin Johnston, Haibin Li, Matt Goldwasser, Upom Malik

Overview of this book

SQL remains one of the most essential tools for modern data analysis and mastering it can set you apart in a competitive data landscape. This book helps you go beyond basic query writing to develop a deep, practical understanding of how SQL powers real-world decision-making. SQL for Data Analytics, Fourth Edition, is for anyone who wants to go beyond basic SQL syntax and confidently analyze real-world data. Whether you're trying to make sense of production data for the first time or upgrading your analytics toolkit, this book gives you the skills to turn data into actionable outcomes. You'll start by creating and managing structured databases before advancing to data retrieval, transformation, and summarization. From there, you’ll take on more complex tasks such as window functions, statistical operations, and analyzing geospatial, time-series, and text data. With hands-on exercises, case studies, and detailed guidance throughout, this book prepares you to apply SQL in everyday business contexts, whether you're cleaning data, building dashboards, or presenting findings to stakeholders. By the end, you'll have a powerful SQL toolkit that translates directly to the work analysts do every day. *Email sign-up and proof of purchase required
Table of Contents (21 chapters)
close
close
Lock Free Chapter
1
Part 1: Data Management Systems
6
Part 2: Data Presentation and Manipulation
12
Part 3: Advanced Topics on Analytics
19
Other Books You May Enjoy
20
Index

Creating a table from an existing dataset

As discussed in Chapter 1, a relational table organizes data into rows, which are an ordered collection of columns, also known as attributes. The table also contains other properties, such as primary key/foreign key. To create a table, you can either start by filling rows in or by defining its column definitions (also called the table schema) and filling in data later.In the first approach, based on an existing dataset, you can create a table using the CREATE…AS statement. This involves running a SELECT statement to get existing data and adding a CREATE wrapper around the data.

CREATE TABLE {table_name} AS (
    {select_query}
);

Here, {select_query} is any SELECT query that can be run in your database. For example, you have already executed the following SELECT statement in Chapter 1:

SELECT * FROM products LIMIT 5;

This SELECT statement will return the following result:

 product_id |     ...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
SQL for Data Analytics
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon