Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a query that selects for every customer, the number of orders he has places and the number of items he has bought, including zeros

  1. Write a query that selects for every customer, the number of orders he has places and the number of items he has bought, including zeros for customers with no orders.
  2. Using the query above populate the table Customers_Statistics (Use Insert Statement)

Extra: What is going to happen if you rollback?

Now add a new column to the table called Customer_Status that is a string of maximum length 20; Extra: What is going to happen if you rollback?

  1. Now lets update the table so that Customer_Status has the following values:

ok when the number of orders is 0 or 1

good when the number of orders is 2 or more

great when the number of orders is > 5 and the number of items is >5

  1. Alter the table so that Number_of_Items cannot be NULL
  2. Delete from the table Customers_Statistics all the customers that have not placed any orders
  3. Truncate table Customers_Statistics
  4. Drop table Customers_Statistics

========================================================================================

  1. image text in transcribedimage text in transcribed
l = CUSTOMER-T CUSTOMER!D CUSTOMERNAME CUSTOMERADDRESS CUSTOMERCITY CUSTOMERSTATE CUSTOMERPOSTALCODE .. CUSTOMERS CUSTOMER-ID CUSTOMER-FIRST-NAME E CUSTOMER-LAST-NAME CUSTOMERADDRESS CUSTOMER CITY - CUSTOMER_STATE CUSTOMERZIP CUSTOMERPHONE CUSTOMER FAX - - B-CUSTOMERS STATISTICS CUSTOMERSHIPADDRESST B- DOESBUSINESSINT EMPLOYEE-T EMPLOYEESKILLST E- LE GENERAL-LEDGER-ACCOUNTS INVOICE LINE ITEMS ITEMS ITEM_D TITLE ARTIST : UNIT-PRICE | E ORDER DETAILS ORDER ID 1 ITEM-ID 0 ORDERI INET ORDERLINEID E ORDERID PRODUCTID ORDEREDQUANTITY ORDERS CUSTOMERID - ORDER_DATE SHIPPED-DATE B- PAYMENT T PAYMENTTYPET PRODUCEDINT B- PRODUCTT B-PRODUCTLINET B- RAWMATERIALT - E- SHIPPED T .. TERMS E TERRITORY-T .. USES_T SUPPLIES-T VENDOR-CONTACTS VENDORT - .. E VENDORS B- WORKCENTERT WORKSIN T

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

Step: 3

blur-text-image

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 And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

303139688X, 978-3031396885

More Books

Students also viewed these Databases questions

Question

What does it take to turn a creative idea into a creative product?

Answered: 1 week ago

Question

What is the principle of thermodynamics? Explain with examples

Answered: 1 week ago

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago