Limited Offer Get 25% off — use code BESTW25
No AI No Plagiarism On-Time Delivery Free Revisions
Claim Now
Prices start at $5 per page · plagiarism-free papers · free revisions for 14 days 24/7 support: support@bestwriters.com
Uncategorized

create and maintain databases, tables, and sequences

  • Posted
  • Authoradmin
  • Length333 words
  • Reading time2 min
Write My Assignment FREE

Chapter 11
How to create and maintain databases, tables,
and sequences
with SQL statements
Exercises
1. Write a script that adds an index to the MyGuitarShop database for the zip code field in the
Customers 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.
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 2; 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.
4. 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.
5. 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.

The post create and maintain databases, tables, and sequences appeared first on My Assignment Online.

Plagiarism Free Assignment Help

Expert Help With This Assignment — On Your Terms

✓ Native UK, USA & Australia writers ✓ Deadline from 3 hours ✓ 100% Plagiarism-Free — Turnitin included ✓ Unlimited free revisions ✓ Free to submit — compare quotes

admin

Academic writer and editor at BestWriters.

Get your paper off your plate tonight

Post your instructions for free. Prices start at $5 per page.

Place an order