80.2K
Verified Solution
Link Copied!
Based on the three tables and the attributes below, write SQL commands for each question to retrieve the data from the database.
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 transaction.

\begin{tabular}{|l|l|} \hline InvoicelD \\ \hline InvoiceDate \\ \hline OrderDate \\ \hline CustomerlD \\ \hline EmployeelD \\ \hline CustomerPO \\ \hline \end{tabular} \begin{tabular}{|l|l|l|l|l|l|l|} \hline SELECT & & & SUM & ([Quantity] & & ]) AS Amount \\ \hline FROM & & & & & \\ \hline WHERE & Sales & & & & \\ \hline GROUP BY & & & & \\ \hline \end{tabular} \begin{tabular}{|l|l|} \hline InvoicelD \\ \hline InvoiceDate \\ \hline OrderDate \\ \hline CustomerlD \\ \hline EmployeelD \\ \hline CustomerPO \\ \hline \end{tabular} \begin{tabular}{|l|l|l|l|l|l|l|} \hline SELECT & & & SUM & ([Quantity] & & ]) AS Amount \\ \hline FROM & & & & & \\ \hline WHERE & Sales & & & & \\ \hline GROUP BY & & & & \\ \hline \end{tabular}
Answer & Explanation
Solved by verified expert