Skip to content
Introduction to SQL
Introduction to SQL
Here you can access the books table used in the course.
Note: When using sample integrations such as those that contain course data, you have read-only access. You can run queries, but cannot make any changes such as adding, deleting, or modifying the data (e.g., creating tables, views, etc.).
Take Notes
Add notes about the concepts you've learned and SQL cells with queries you want to keep.
Add your notes here
DataFrameas
books
variable
-- Add your own queries here
SELECT *
FROM booksExplore Datasets
Use the books table to explore the data and practice your skills!
- Select only the
titlecolumn. - Alias the
titlecolumn asbook_title. - Select the distinct author names from the
authorcolumn. - Select all records from the table and limit your results to 10.
DataFrameas
df
variable
-- Select only the `title` column.
SELECT title
FROM books;DataFrameas
df1
variable
-- Alias the `title` column as `book_title`.
SELECT title AS book_title
FROM books;DataFrameas
df2
variable
-- Select the distinct author names from the `author` column.
SELECT DISTINCT author
FROM books;DataFrameas
df3
variable
-- Select all records from the table and limit your results to 10.
SELECT *
FROM books
LIMIT 10;DataFrameas
df4
variable
SELECT COUNT(id) AS count_record
FROM books;DataFrameas
df5
variable
SELECT COUNT(*) AS cont_record
FROM books;DataFrameas
df6
variable
SELECT *
FROM books
WHERE id IS NULL;DataFrameas
df7
variable
SELECT
author,
COUNT(title) AS count_title
FROM books
GROUP BY author
HAVING COUNT(title) >= 2
ORDER BY count_titleDataFrameas
df8
variable
SELECT year, author, COUNT(title) AS no_of_release
FROM books
GROUP BY author, year
HAVING COUNT(title) > 2
ORDER BY no_of_release