Question
SQL Assignment 4 In these exercises, youll enter and run your own SELECT statements. You will use the MyGuitarShop database for these queries. If you
SQL Assignment 4
In these exercises, youll enter and run your own SELECT statements. You will use the MyGuitarShop database for these queries. If you do not already have the MyGuitarShop database, the SQL script and the instructions for creating the database are located in the Submitting Assignments module on Canvas. Create a SQL script that will produce the requested information outlined below. After you have completed and tested the script, submit the script using the HW4 assignment link located in the Week 9 module. Include a comment at the top of the script with your name and assignment. Also include a comment before each section of the script that identifies the exercise number. Here is an example of how the script should begin: -- Sherry Albright (SQL Assignment 4) -- Exercise 1
1. Write a SELECT statement that returns these columns from the Products table: The ListPrice column A column that uses the CAST function to return the ListPrice column with 1 digit to the right of the decimal point A column that uses the CONVERT function to return the ListPrice column as an integer A column that uses the CAST function to return the ListPrice column as an integer
2. Write a SELECT statement that returns these columns from the Products table: The DateAdded column A column that uses the CAST function to return the DateAdded column with its date only (year, month, and day) A column that uses the CAST function to return the DateAdded column with its full time only (hour, minutes, seconds, and milliseconds) A column that uses the CAST function to return the DateAdded column with just the month and day
3. Write a SELECT statement that returns these columns from the Products table: The ListPrice column The DiscountPercent column A column named DiscountAmount that uses the previous two columns to calculate the discount amount and uses the ROUND function to round the result to 2 decimal places SQL Assignment 4 Page 2 of 2
4. Write a SELECT statement that returns these columns from the Orders table: The OrderDate column A column that returns the four-digit year thats stored in the OrderDate column A column that returns only the day of the month thats stored in the OrderDate column. A column that returns the result from adding thirty days to the OrderDate column.
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