Question
A. Write an SQL statement to create a view called SaleSummaryView that contains SALE.SaleID, SALE.SaleDate, SALE_ITEM.SaleItemID, SALE_ITEM.ItemID, ITEM.ItemDescription, and ITEM.ItemPrice. Run the statement to create
A. Write an SQL statement to create a view called SaleSummaryView that contains SALE.SaleID, SALE.SaleDate, SALE_ITEM.SaleItemID, SALE_ITEM.ItemID, ITEM.ItemDescription, and ITEM.ItemPrice. Run the statement to create the view, and then test the view with an appropriate SQL SELECT statement.
B. Create and test a user-defined function named LastNameFirst that combines two parameters named FirstName and LastName into a concatenated name field formatted LastName, FirstName (including the comma and space).
C. Write an SQL statement to create a view called CustomerSaleSummaryView that contains SALE.SaleID, SALE.SaleDate, CUSTOMER.LastName, CUSTOMER.FirstName, SALE_ITEM.SaleItemID, SALE_ITEM.ItemID, ITEM.ItemDescription, and ITEM .ItemPrice. Run the statement to create the view, and then test the view with an appropriate SQL SELECT statement.
D. Write an SQL statement to create a view called CustomerLastNameFirstSaleSummaryView that contains SALE.SaleID, SALE .SaleDate, the concatenated customer name using the LastNameFirst function, SALE_ITEM.SaleItemID, SALE_ITEM.ItemID, ITEM.ItemDescription, and ITEM .ItemPrice. Run the statement to create the view, and then test the view with an appropriate SQL SELECT statement.
E. Write an SQL statement to create a view called CustomerSaleHistoryView that:
1.Includes all columns of CustomerSaleSummaryView except SALE_ITEM .SaleItemID, SALE_ITEM.ItemID and ITEM.ItemDescription.
2.Groups orders by SALE.SaleID, CUSTOMER.LastName, CUSTOMER.FirstName, and SALE.SaleDate in that order;
3.Sums and averages SALE_ITEM.ItemPrice for each order for each customer. Run the statement to create the view, and then test the view with an appropriate SQL SELECT statement.
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