Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a script, one step at a time, to generate the DB schema of the movie rental database. Test the partial results by inspecting the

Write a script, one step at a time, to generate the DB schema of the movie rental database. Test the partial
results by inspecting the tables in SQLDeveloper. Do not proceed to the next step until you have the previous one
working correctly.
Part I Define the MOVIE rental database.
a. Use the following database schema to create a script that generates and populates the movie rental
database. You must write the script to create the tables for this schema.
b. Requirements
- The movie IDs should be a 16-char string with the format USA-2003-HR-0001
Where:
Characters 1-3: represent the country of the producer: e.g., USA, BRA, CAN, IND, ENG, JAP
Characters 5-8: represent the year of the movie: e.g.,2003
Characters 10-11: represent an identifier of the movie genre: e.g., HR for Horror, CM for Comedy
Characters 13-16,4-digit sequence
when characters from 1-12 are the same as a previous entry, the sequence increments by one.
For example, if the mId USA-2003-HR-0001 already exists, the next movie to be input with the
country: USA, year: 2003, and genre: HR should have the mId USA-2003-HR-0002.
You DONT have to generate these mIds automatically, but the data you input manually must
comply with this requirement.
- Customer and director IDs are represented by a 9-digit code (as well as producerID).
- Please choose a proper max length for first names, last names, and movie titles. Check this movie title as
a reference to pick your max length.
- dob represents the date of birth of the customer or director, rented indicates the date a movie was
rented and returndate indicates when the movie is returned. If the movie has not been returned, the
value of returndate is unknown (hint: the value should be null).
- duration is a fixed 5-character string with the format HH: MM, e.g.02:32,04:43.
- Any date field in the schema should be stored as a date object, not just as character strings.
- The genreid and year (4-digit integer) of the movie must be consistent with the corresponding mId

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions