Skip to content
Introduction to SQL
  • AI Chat
  • Code
  • Report
  • Intermediate SQL Queries

    Here you can access every table used in the course. To access each table, you will need to specify the cinema schema in your queries (e.g., cinema.reviews for the reviews table.


    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

    Unknown integration
    DataFrameavailable as
    movie_info
    variable
    -- Add your own queries here
    SELECT *
    FROM cinema.reviews
    LIMIT 5

    Explore Datasets

    Use the tables to explore the data and practice your skills!

    • Select the film_id, imdb_score, and num_votes in the reviews table.
      • Filter your results for records where:
        • The imdb_score is greater than 8.
        • The number of votes (num_votes) is more than 1 million (1000000).
    • Return the average cost to make a movie (budget) by the country of origin in the films table.
      • Exclude NULL values in the budget column.
      • Order your results by the average budget in descending order.
    • Return the language, total budget (aliased as total_budget), and total gross (aliased as total_gross) from the films table.
      • Filter the records for films with a duration greater than 90.
      • Only include languages where the total gross is over 1 million (1000000).
      • Order your results by the total gross in descending order.
    Unknown integration
    DataFrameavailable as
    df
    variable
    SELECT film_id, imdb_score, num_votes
    FROM cinema.reviews
    WHERE imdb_score > 8 AND
          num_votes > 1000000;
    Unknown integration
    DataFrameavailable as
    df1
    variable
    SELECT  country, AVG(budget) AS avg_budget 
    FROM cinema.films
    WHERE budget IS NOT NULL
    GROUP BY country
    ORDER BY AVG(budget) DESC;

    -Return the language, total budget (aliased as total_budget), and total gross (aliased as total_gross) from the films table. -Filter the records for films with a duration greater than 90. -Only include languages where the total gross is over 1 million (1000000). -Order your results by the total gross in descending order.

    Unknown integration
    DataFrameavailable as
    df2
    variable
    SELECT language, SUM(budget) AS total_budget, SUM(gross) AS total_gross
    FROM cinema.films
    WHERE duration > 90
    GROUP BY language
    HAVING SUM(gross) > 1000000
    ORDER BY SUM(gross) DESC;