Advertisement
stefony

Movies Database

Jan 16th, 2024
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | Software | 0 0
  1. Movies Database
  2.  
  3. -- Create the 'directors' table
  4. CREATE TABLE directors (
  5. id INT AUTO_INCREMENT PRIMARY KEY,
  6. director_name VARCHAR(255) NOT NULL,
  7. notes TEXT
  8. );
  9.  
  10. -- Create the 'genres' table
  11. CREATE TABLE genres (
  12. id INT AUTO_INCREMENT PRIMARY KEY,
  13. genre_name VARCHAR(255) NOT NULL,
  14. notes TEXT
  15. );
  16.  
  17. -- Create the 'categories' table
  18. CREATE TABLE categories (
  19. id INT AUTO_INCREMENT PRIMARY KEY,
  20. category_name VARCHAR(255) NOT NULL,
  21. notes TEXT
  22. );
  23.  
  24. -- Create the 'movies' table
  25. CREATE TABLE movies (
  26. id INT AUTO_INCREMENT PRIMARY KEY,
  27. title VARCHAR(255) NOT NULL,
  28. director_id INT,
  29. copyright_year DATETIME,
  30. length INT,
  31. genre_id INT,
  32. category_id INT,
  33. rating DECIMAL(3,1),
  34. notes TEXT,
  35. FOREIGN KEY (director_id) REFERENCES directors(id),
  36. FOREIGN KEY (genre_id) REFERENCES genres(id),
  37. FOREIGN KEY (category_id) REFERENCES categories(id)
  38. );
  39.  
  40. -- Populate the 'directors' table with 5 records
  41. INSERT INTO directors (director_name, notes) VALUES
  42. ('Steven Spielberg', 'One of the most influential directors in Hollywood.'),
  43. ('Christopher Nolan', 'Known for his mind-bending films.'),
  44. ('Quentin Tarantino', 'Famous for his unique storytelling and style.'),
  45. ('Greta Gerwig', 'Acclaimed director and writer.'),
  46. ('Martin Scorsese', 'Renowned for his work in crime films.');
  47.  
  48. -- Populate the 'genres' table with 5 records
  49. INSERT INTO genres (genre_name, notes) VALUES
  50. ('Action', 'Exciting and fast-paced films.'),
  51. ('Drama', 'Character-driven narratives.'),
  52. ('Comedy', 'Intended to make the audience laugh.'),
  53. ('Sci-Fi', 'Deals with futuristic or speculative concepts.'),
  54. ('Thriller', 'Keeps the audience on the edge of their seats.');
  55.  
  56. -- Populate the 'categories' table with 5 records
  57. INSERT INTO categories (category_name, notes) VALUES
  58. ('Adventure', 'Movies that take the audience on a journey.'),
  59. ('Mystery', 'Involves solving a mysterious event or crime.'),
  60. ('Romance', 'Focuses on romantic relationships.'),
  61. ('Horror', 'Intended to scare or horrify the audience.'),
  62. ('Biography', 'Based on the life of real individuals.');
  63.  
  64. -- Populate the 'movies' table with 5 records
  65. INSERT INTO movies (title, director_id, copyright_year, length, genre_id, category_id, rating, notes) VALUES
  66. ('Jurassic Park', 1, 1993, 127, 1, 1, 8.1, 'Classic Spielberg film with dinosaurs.'),
  67. ('Inception', 2, 2010, 148, 4, 2, 8.8, 'Mind-bending thriller directed by Christopher Nolan.'),
  68. ('Pulp Fiction', 3, 1994, 154, 1, 4, 8.9, 'Quentin Tarantino\'s iconic crime film.'),
  69. ('Lady Bird', 4, 2017, 94, 2, 3, 7.4, 'Greta Gerwig\'s coming-of-age comedy-drama.'),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement