Queries SQL

-Write one or more statements in the given space beneath each problem

--description to answer the query.

--Each SELECT statement is worth 15 points with max possible total of--60 points.

--Partial credits is possible.

--Each clause of SELECT, FROM, WHERE, and ORDER BY is expected to be coded--on its own line and use proper indentation on each line to make your--code more readable for grading.

--Do not include statements other than what are required to avoid extra points--deducted.

--Do not change the file name and its extension.

use [ClearWater]

/* Query 1Write a SELECT-INTO statement to create Products_ch07 table as a duplicate ofProducts table of ClearWater database.

Then, write a DELETE statement to delete products from Products_ch07 if theirunit price is above the average of those in category 1 ~ 5 in Products table.Your output must also display all columns of products that are deleted.*/

/* Query 2After Query 1 is completed, write an INSERT statement to insert productsinto Products_ch07 if they exist in the ClearWater.dbo.Products but notProducts_ch07. Your output should display all columns of products thatare inserted.*/

/* Query 3After Query 1 is completed, write an UPDATE statement with a subqueryto increase product unit price by 10% in Products_ch07 if their supplieris in Japan or Germany. Be sure your output display the following fourcolumns of products that are updated: ProductID, UnitPriceBeforeUpdate,UnitPriceAfterUpdate, UpdatedAmount.*/

/* Query 4After Query 3 is done, write a statement to drop Products_ch07 fromyour database and write a SELECT-INTO statement to re-create it as

Powered by