Answered step by step
Verified Expert Solution
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
- 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.
- 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?
- 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
- Alter the table so that Number_of_Items cannot be NULL
- Delete from the table Customers_Statistics all the customers that have not placed any orders
- Truncate table Customers_Statistics
- Drop table Customers_Statistics
========================================================================================
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