CREATE TABLE movies (
    Movies_id INT PRIMARY KEY,
    title VARCHAR(100),
    genre VARCHAR(50),
    release_year INT,
    rating DECIMAL(3, 1),
    box_office DECIMAL(15, 2),
    director_id INT,
    FOREIGN KEY (director_id) REFERENCES directors(director_id)
);

CREATE TABLE directors (
    director_id INT PRIMARY KEY,
    name VARCHAR(100),
    birth_year INT,
    nationality VARCHAR(50),
    oscars_won INT
);

INSERT INTO directors (id, name, birth_year, nationality, oscars_won)
VALUES
    (1, 'Christopher Nolan', 1970, 'British-American', 0),
    (2, 'James Cameron', 1954, 'Canadian', 3),
    (3, 'Christopher Nolan', 1970, 'British-American', 0),
    (4, 'Christopher Nolan', 1970, 'British-American', 0),
    (5, 'Anthony & Joe Russo', 1970, 'American', 0),
    (6, 'Francis Ford Coppola', 1939, 'American', 5),
    (7, 'Todd Phillips', 1970, 'American', 1);

INSERT INTO movies (id, title, genre, release_year, rating, box_office, director_id)
VALUES
    (1, 'Inception', 'Sci-Fi', 2010, 8.8, 829895144.00, 1),
    (2, 'Titanic', 'Romance', 1997, 7.9, 2187463944.00, 2),
    (3, 'The Dark Knight', 'Action', 2008, 9.0, 1004558444.00, 1),
    (4, 'Interstellar', 'Sci-Fi', 2014, 8.6, 677471339.00, 1),
    (5, 'Avengers: Endgame', 'Action', 2019, 8.4, 2797800564.00, 5),
    (6, 'The Godfather', 'Crime', 1972, 9.2, 246120974.00, 6),
    (7, 'Joker', 'Crime', 2019, 8.5, 1074251311.00, 7);


-- Select movies.title, directors.name From movies 
-- Left JOIN directors on movies.director_id = directors.id





Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: