workspace Theory for SQL
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner
    # Start coding here... 
    Unknown integration
    DataFrameavailable as
    df
    variable
    SELECT*
    FROM cinema.reviews
    Limit 5
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

    All set theory for SQL like UNION UNION ALL INTERSECT EXCEPT

    The tables must have be same columns and same datatype we use to combine tables

    Unknown integration
    DataFrameavailable as
    df
    variable
    --Take two tabels as input and return all from both tabels
    SELECT id
    FROM cinema.reviews
    UNION
    SELECT id
    from cinema.roles;
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
    Unknown integration
    DataFrameavailable as
    df
    variable
    -- Select id, film_id and filter by film_id then union with roles table after that filter by id
    SELECT id,  film_id
    FROM cinema.reviews
    WHERE film_id > 74
    UNION
    SELECT id, film_id
    FROM cinema.roles
    WHERE id <> 10;
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
    Unknown integration
    DataFrameavailable as
    df
    variable
    -- UNION ALL include duplcates
    SELECT film_id, actor_id, last_update
    FROM dvdrentals.film_actor
    UNION ALL
    SELECT film_id, category_id, last_update
    FROM dvdrentals.film_category
    ORDER BY film_id
    LIMIT 5;
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
    Unknown integration
    DataFrameavailable as
    df
    variable
    -- Choose all records from two table UNION ALL
    SELECT *
    FROM dvdrentals.category
    UNION ALL
    SELECT *
    FROM dvdrentals.country
    ORDER BY last_update
    LIMIT 5;
    
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
    Unknown integration
    DataFrameavailable as
    df
    variable
    -- INTERSECT not fount in this two table
    SELECT id, title
    FROM cinema.films
    INTERSECT
    SELECT id, name
    FROM cinema.people
    ORDER by id
    
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
    Unknown integration
    DataFrameavailable as
    df
    variable
    --We see where this table INTERSECT
    select id, film_id
    from cinema.reviews 
    intersect
    select id, person_id
    from cinema.roles
    
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
    Unknown integration
    DataFrameavailable as
    df
    variable
    SELECT code, gross_savings
    FROM world.economies2010
    EXCEPT
    SELECT code, gross_savings
    FROM world.economies2015
    ORDER By code
    LIMIT 5;
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.