Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The scenario is that you are working for a company and they are creating a website that allows users to download manuals and software updates
The scenario is that you are working for a company and they are creating a website that allows users to download manuals and software updates for products they have purchased. They want to track all of the downloads from the site and you need to create a database for that purpose.
info iconHow to do it
Write a script that implements the following design in a database named downloads
Assignment Database Schema
Include statements to create the database if it does not exists.
Include statements to open the database.
Include statements to create all of the tables and fields in this schema.
In the downloads table, the userid and productid columns are the foreign keys.
Write a script that adds the following data to the database that you created above.
Users:
Last Name First Name Email Address
Witty Max mwitty@yahoo.com
Sherwin Lauren lsherwinm@stumbleupon.com
Dyers Wendy wdyers@sphinn.com
Sansbury Lois lsansburyn@cafepress.com
Products:
Product Name Model
Virtual Path Computer VPX
AppliedMicro Server XC Server
Redragon Keyboard K
Cyborg Gaming Keypad XZ
Write an ALTER TABLE statement that adds two new columns to the Products table created above.
Add one column for product price that provides for six digits to the left of the decimal point and two to the right. This column should have a default value of
Add one column for the date and time that the product was added to the database. This column should have a default value of the current date and time.
Write an ALTER TABLE statement that modifies the Users table so the firstname column cannot store NULL values and can store a maximum of characters.
Create SQL statements that tests the the alterations to the table:
Create an UPDATE statement that attempts to insert a NULL value into the firstname column. It should fail due to the NOT NULL constraint. What is the Error Code number?
Create another UPDATE statement that attempts to insert a first name thats longer than characters. It should fail due to the length of the column. What is the Error Code number?
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