Handle many-to-many properly
SQL
Medium
2 views
Problem Description
You have Movie(movie_id, title, actor_names) as a comma list. Convert to normalized design.
Output Format
DDL statement(s)
Sample Test Case
Output:
Normalized tables
Constraints
Bridge table needed
Official Solution
CREATE TABLE Movies (movie_id INT PRIMARY KEY, title VARCHAR(200)); CREATE TABLE Actors (actor_id INT PRIMARY KEY, actor_name VARCHAR(200)); CREATE TABLE MovieActors (movie_id INT, actor_id INT, PRIMARY KEY(movie_id, actor_id));
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!