Write a script that adds an index to the MyGuitarShop database for the zip code field in the Addresses table. Write a script that implements the following design in a database named MyWebDB:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
  1. Write a script that adds an index to the MyGuitarShop database for the zip code field in the Addresses table.
  2. Write a script that implements the following design in a database named MyWebDB:


 
In the Downloads table, the UserID and ProductID columns are the foreign keys.

In the Users table, the EmailAddress and LastName columns are required, but the FirstName column is not.

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.

3. Write a script that adds rows to the database that you created in exercise 2.
Add two rows to the Users and Products tables.
Add three rows to the Downloads table: one row for user 1 and product 1; one for user 2 and product
1; and one for user 2 and product 2. Use the GETDATE function to insert the current date and time
into the DownloadDate column.


Write a SELECT statement that joins the three tables and retrieves the data from these tables like this:

Sort the results by the email address in descending order and the product name in ascending order.

  1. Write an ALTER TABLE statement that adds two new columns to the Products table created in
    exercise 2.
    Add one column for product price that provides for three digits to the left of the decimal point and
    two to the right. This column should have a default value of 9.99.

Add one column for the date and time that the product was added to the database.

  1. Write an ALTER TABLE statement that modifies the Users table created in exercise 2 so the
    FirstName column cannot store null values and can store a maximum of 20 characters.


Code an UPDATE statement that attempts to insert a null value into this column. It should fail due to
the not null constraint.


Code another UPDATE statement that attempts to insert a first name that’s longer than 20 characters. It should fail due to the length of the column.
 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education