Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions