Based on the three tables and the attributes below, answer the question for Requ
ID: 351983 • Letter: B
Question
Based on the three tables and the attributes below, answer the question for Requirement A and write SQL commands for Requirements B to E to retrieve the data from the database Inventory Salesltems Sales InvoicellD InventorylD Name BeverageType Caffeinated Flavored PurchasePrice InvoiceID InvoiceDate OrderDate CustomerID EmployeeID CustomerPO OInventorylD Quantity UnitPrice Required a. What are the foreign keys in the Sales table? b. How many sales transactions were made in March, 2017? c. Which sales transactions were made by the employee whose ID is 'S2038' in the system? d. List the inventory items with purchase price larger than $6,500 e. Write a query to find out the dollar amount of each sales transactionExplanation / Answer
a. The foreign key in the sales table is InvoiceID
b. Select count (Sales.InvoiceID) from Sales where Sales.OrderDate >= '01/03/2017' and Sales.OrderDate <= '31/03/2017'
c. Select Sales.InvoiceID from Sales where Sales.Employee ID ='S2038'
d. Select Inventory.InventoryID from Inventory where Inventory.PurchasePrice>6500
e. Select Sales.InvoiceId, SalesItems.UnitPrice from SalesItems, Sales where Sales.InvoiceId = SalesItems.InvoiceID
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.