Skip to content

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.).

Spinner
DataFrameas
df8
variable
-- Find the title, certification, and language all films certified NC-17 or R that are in English, Italian, or Greek
SELECT title, language, certification
from films
where  (certification in ('NC-17','R'))
 and language in ('English','Italian','Greek'); 

Add your notes here

Spinner
DataFrameas
df1
variable
Run error
CREATE OR REPLACE VIEW library_authors AS
SELECT DISTINCT author AS unique_author
FROM books;

SELECT *
FROM library_authors;
Spinner
DataFrameas
df2
variable
-- Count the distinct countries from the films table
SELECT COUNT(DISTINCT country) AS count_distinct_countries
FROM films;

Take Notes

Add notes about the concepts you've learned and SQL cells with queries you want to keep.

Spinner
DataFrameas
df10
variable
SELECT title AS no_budget_info
FROM films
WHERE budget IS NULL;
Spinner
DataFrameas
df11
variable
SELECT COUNT(*) AS count_language_known
FROM films
WHERE language IS NOT NULL;
Spinner
DataFrameas
df3
variable
-- Select film_ids and imdb_score with an imdb_score over 7.0
SELECT film_id, imdb_score
FROM reviews
WHERE imdb_score > 7.0 ;
Hidden output

CREATE

Spinner
DataFrameas
df12
variable
-- Calculate the average gross of films that start with A
select avg(gross) as avg_gross_A
from films
where title like 'A%';

1 hidden cell
Spinner
DataFrameas
df5
variable
- Select the title and release_year for all German-language films released before 2000
SELECT title, release_year
FROM films
WHERE release_year < 2000
	AND language = 'German';
Spinner
DataFrameas
df7
variable
-- Select the names that start with B
SELECT name
FROM people
WHERE name LIKE 'B%';