Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4-Part Question 1. Write a script that implements the following design in a database named MyWebDB: Users Downloads ? UserlD DownloadID UseriD DownloadDate FileName ProductID
4-Part Question 1. Write a script that implements the following design in a database named MyWebDB: Users Downloads ? UserlD DownloadID UseriD DownloadDate FileName ProductID Products ProductiD FirstName LastName In the Downloads table, the UserID and ProductD columns are the foreign keys Include a statement to drop the database if it already exists Include statements to create and select the database Include any indexes that you think are necessary 2. Write a script that adds rows to the database that you created in exercise 1 Add two rows to the Users and Products tables Add three rows to the Downloads table: one row for user 1 and product 2; one for user 2 and product 2 and prod 1; and one for user 2 and product 2. Use the GETDATE function to insert the current date and time into the DownloadDate comUse the GETDATE fnctiapo2: Write a SELECT statement that joins the three tables and retrieves the data from these tables like this email _address johnsmith @gmail.com John janedoe@yahoo.com Jane janedoe@yahoo.com Jane first_name last_name download_date name product_name Smith Doe Doe 2012-04-24 16:15:38 pedals are falling.mp3 Local Music Vol 1 2012-04-24 16:15:38 tum_signal.mp3 2012-04-24 16:15:38 one horse_town mp3 Local Music Vol 2 Local Music Vol 1 Sort the results by the email address in descending order and the product name in ascending order
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