Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q1 Write the SQL code to create the table structures for the entities shown in Figure 1. The structures should contain the attributes specified in
Q1 Write the SQL code to create the table structures for the entities shown in Figure 1. The structures should contain the attributes specified in the ERD. Use data types that are appropriate for the data that will need to be stored in each attribute. Enforce primary key and foreign key constraints as indicated by the ERD. 02 The tables in Figure 2 provide a very small portion of the data that will be kept in the database. This data needs to be inserted into the database for testing purposes. Write the appropriate command necessary to place the data in the tables that were created in Q1. Figure 1: MEMBERSHIP RENTAL PK MEM NUM PK RENT NUM MEM_FNAME H--0 MEM_LNAME RENT DATE MEM_STREET FK1 MEM_NUM MEM_CITY MEM STATE MEM ZIP MEM_BALANCE DETAILRENTAL PK,FK1 RENT NUM PK,FK2 VID NUM DETAIL_FEE DETAIL_DUEDATE DETAIL_RETURNDATE DETAIL_DAILYLATEFEE MOVIE VIDEO PRICE PK MOVIE_NUM PK VID_NUM FH-04 PK PRICE CODE MOVIE_TITLE VID INDATE HO----0 MOVIE YEAR FK1 MOVIE_NUM PRICE_DESCRIPTION MOVIE COST PRICE RENTFEE MOVIE GENRE PRICE_DAILYLATEFEE FK1 PRICE_CODE Figure 2: MEM_STREET MEM_ZIP MEMBERSHIP MEM MEM NUM FNAME 102 Tami 103 Curt 104 Jamal 105 Iva Miranda 107 Rosario 108 Mattie MEM LNAME Dawson Knight Melendez Mcclain Parks Elliott Guy 2632 Takli Circle 4025 Cornell Court 788 East 145th Avenue 6045 Musket Ball Circle 4469 Maxwell Place 7578 Danner Avenue 4390 Evergreen Street MEM_CITY Norene Flatgap Quebeck Summit Germantown Columbia Lily MEM STATE TN KY TN KY TN TN KY 37136 41219 38579 42783 38183 38402 40740 MEM BALANCE 11 6 0 15 0 5 0 106 MEM_NUM RENTAL RENT_NUM 1001 1002 1003 1004 1005 RENT DATE 01-MAR-09 01-MAR-09 02-MAR-09 02-MAR-09 02-MAR-09 103 105 102 110 111 DETAIL_FEE 2 2 3.5 3.5 DETAIL DAILYLATEFEE 1 1 3 3 DETAILRENTAL RENT VID NUM NUM 1001 34342 1001 61353 1002 59237 1003 54325 1003 61369 1003 61388 1004 44392 1004 34367 1004 34341 1005 34342 1005 44397 2 DETAIL DUEDATE 04-MAR-09 04-MAR-09 04-MAR-09 04-MAR-09 06-MAR-09 06-MAR-09 05-MAR-09 05-MAR-09 07-MAR-09 07-MAR-09 05-MAR-09 DETAIL RETURNDATE 02-MAR-09 03-MAR-09 04-MAR-09 09-MAR-09 09-MAR-09 09-MAR-09 07-MAR-09 07-MAR-09 07-MAR-09 05-MAR-09 05-MAR-09 1 1 3 3 0 3.5 3.5 2 2 3.5 1 1 3 VIDEO VID NUM 54321 54324 54325 34341 34342 34366 34367 34368 34369 44392 VID INDATE 18-JUN-08 18-JUN-08 18-JUN-08 22-JAN-07 22-JAN-07 02-MAR-09 02-MAR-09 02-MAR-09 02-MAR-09 21-OCT-08 MOVIE NUM 1234 1234 1234 1235 1235 1236 1236 1236 1236 1237 MOVIE MOVIE_NUM MOVIE_YEAR MOVIE COST MOVIE_GENRE PRICE_CODE 1234 2007 39.95 FAMILY 2 1235 2004 59.95 ACTION 1 1236 1237 1238 1239 1245 1246 MOVIE_NAME The Cesar Family Christmas Smokey Mountain Wildlife Richard Goodhope Beatnik Fever Constant Companion Where Hope Dies Time to Burn What He Doesn't know 2008 2007 2008 1998 2005 2006 59.95 29.95 89.95 25.49 45.49 58.29 DRAMA COMEDY DRAMA DRAMA ACTION COMEDY 2 2 2 3 1 1 PRICE PRICE CODE 1 2 3 4 PRICE DESCRIPTION Standard New Release Discount Weekly Special PRICE RENTFEE 2 3.5 1.5 1 PRICE DAILYLATEFEE 1 3 1 .5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started