Question
Use the given MyGuitarShop (download link: https://files.fm/u/uwghv4jg ) database to answer these questions. Submit one query per question. In these exercises, youll enter and run
Use the given MyGuitarShop (download link: https://files.fm/u/uwghv4jg ) database to answer these questions. Submit one query per question. In these exercises, youll enter and run your own SELECT statements. (Total: 65 points)
1. (10 pts) Write a SELECT statement that shows four columns from the Products table: ProductCode, ProductName, ListPrice, and DiscountPercent. Then, run this statement to make sure it works correctly.
Add an ORDER BY clause to this statement that sorts the result set by ListPrice in descending sequence. Then, run this statement again to make sure it works correctly. This is a good way to build and test a statement, one clause at a time.
2. (15 pts) Write a SELECT statement that shows one column from the Customers table named FullName that joins the LastName and FirstName columns. Format this column with the last name, a comma, a space, and the first name like this:
Doe, John
Sort the result set by LastName in ascending sequence.
Only display the contacts whose last name starts with letters from M to Z.
3. (15 pts) Write a SELECT statement that shows these column names & data from the Products table:
ProductName The ProductName column
ListPrice The ListPrice column
DiscountPercent The DiscountPercent column
DiscountAmount A column thats calculated from the previous two columns
DiscountPrice A column thats calculated from the previous three columns - - dont forget the order of arithmetic operations (PEMDAS/BODMAS)
Sort the result set by DiscountPrice in descending sequence.
4. (15 pts) Write a SELECT statement that shows these column names & data from the OrderItems table:
ItemID The ItemID column
ItemPrice The ItemPrice column
DiscountAmount The DiscountAmount column
Quantity The Quantity column
ItemTotal A column thats calculated by multiplying the item price with the quantity
DiscountTotal A column thats calculated by multiplying the discount amount with the quantity
DiscountItemTotal A column thats calculated by subtracting the discount amount from the item price and then multiplying the result by the quantity- dont forget the order of arithmetic operations (PEMDAS/BODMAS)
Sort the result set by ItemTotal in descending sequence.
Only display rows where the ItemTotal is greater than 500.
5. (10 pts) Write a SELECT statement that shows these columns from the Orders table:
OrderID The OrderID column
OrderDate The OrderDate column
ShipDate The ShipDate column
Show only the rows where the ShipDate column contains a null value.
Place all the sql queries in a single sql file (.sql)
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