Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add three rows to the Downloads table. Add data for all the fields. One row for user 1 and product 1 One row for user

Add three rows to the Downloads table. Add data for all the fields.

One row for user 1 and product 1

One row for user 2 and product 1

One row for user 2 and product 2

Use the NOW function to insert the current date and time into the download_date 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 sequence and the product name in ascending sequence.

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.

2. Write an ALTER TABLE statement that modifies the Users table created in exercise 2 so the first_name 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 thats longer than 20 characters. It should fail due to the length.

I am getting an error when I try to do the following:

mysql> insert into Downloads values('user 1','product 2',GETDATE()); ERROR 1136 (21S01): Column count doesn't match value count at row 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago