Homework Help US logo
  • My account
  • Order now
Order Now
Homework Help

Sql exercise | Computer Science homework help

2 min read
Posted on 
March 19th, 2023
Home Homework Help Sql exercise | Computer Science homework help

SQL Exercise (Due 2/22/2016 at the end of class)

 

Using Microsoft Access and the Northwind sample database, produce an SQL statement for each of the 4 exercises below. For each exercise you should submit both the SQL statement you have written along with a screen shot of the results. 

*Important – Do Not Use the Query Wizard as these are exercises in learning to write SQL.  It will be apparent in the syntax if you completed the assignment with the Query Wizard.  Please practice honesty and integrity as you complete the assignment.

 

 

#1)  Number of Orders with Credit Card Payment

Write a SQL statement that will count the number of orders in the [Order Details] table that were paid by credit card. 

Example:

SELECT [field], count(1)

FROM [table]

WHERE [field] = “value”

GROUP BY [field]

 

<Paste SQL Statement Here>

<Insert Result Image Here>

 

#2)  Top Selling Product based on Order Amount (One Join)

Write a SQL statement that will join the [Order Details ] table and [Products] table to determine the top selling product based on [Quantity]*[Unit Price].

Example:

SELECT B.[field], sum(A.[field]*A.[field]) as Orders

FROM ( [table] A

INNER JOIN [table] B

on A.[field] = B.[field] )

GROUP BY B.[field]

ORDER BY sum(A.[field] *A.[field] ) desc

 

<Paste SQL Statement Here>

<Insert Result Image Here>

 

 

#3)  Products with Less Than $2500 in Orders

Write a SQL statement that will join the [Order Details] table and [Products] table to determine only those products with less than $2500 in Orders based on [Quantity]*[Unit Price]. 

Example:

SELECT B.[field], sum(A.[field] * A.[field]) as Orders

FROM ([table] A

INNER JOIN [table] B

on A.[field] = B.[field])

GROUP BY B.[field]

HAVING sum(A.[field]*A.[field]) < value

ORDER BY sum(A.[field] *A.[field]) desc

 

<Paste SQL Statement Here>

<Insert Result Image Here>

 

#4) Top Producing Employee base on Order Amount (Two Joins)

Write a SQL statement that will join the [Orders] table, [Order Details] table and [Employees] table to determine the highest producing employee based on the employees first name and [Quantity]*[Unit Price].

 

Example:

SELECT C.[field], sum(A.[field] *A.[field] ) as Orders

FROM (([table] A

INNER JOIN [table] B

on A.[field] = B.[field])

INNER JOIN [table] C

on B.[field] = C.[field])

GROUP BY C.[field]

ORDER BY sum(A.[field] *A.[field] ) desc

 

<Paste SQL Statement Here>

<Insert Result Image Here>

 

 

 

 

Order an Essay Now & Get These Features For Free:

Turnitin Report

Formatting

Title Page

Citation

Outline

Place an Order
Share
Tweet
Share
Tweet
Calculate the price
Pages (275 words)
$0.00
Homework Help US
Company
    Legal
      How Our Service is Used:
      Homework Help US essays are NOT intended to be forwarded as finalized work as it is only strictly meant to be used for research and study purposes. Homework Help US does not endorse or condone any type of plagiarism.
      Subscribe
      No Spam
          © 2023 Homework Help US. All rights reserved.
          Homework Help US will be listed as ‘Homework Help US’ on your bank statement.