Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*Using my_guitar_shop Write a SELECT statement that returns four columns from the Products table: product_code, product_name, list_price, and discount_percent. Then, run this statement to make

*Using my_guitar_shop

  1. Write a SELECT statement that returns four columns from the Products table: product_code, product_name, list_price, and discount_percent. Then, run this statement to make sure it works correctly.

Add an ORDER BY clause to this statement that sorts the result set by list price 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.

  1. Write a SELECT statement that returns one column from the Customers table named full_name that joins the last_name and first_name 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 the last_name column in ascending sequence.

Return only the customers whose last name begins with letters from B to J.

NOTE: When comparing strings of characters, B comes before any string of characters that begins with B. For example, B comes before Book.

  1. Write a SELECT statement that returns these columns from the Products table:

product_name The product_name column

list_price The list_price column

date_added The date_added column

Return only the rows with a list price thats greater than 500 and less than 2000.

Sort the result set by the date_added column in descending sequence.

  1. Write a SELECT statement that returns these column names and data from the Products table:

product_name The product_name column

list_price The list_price column

discount_percent The discount_percent column

discount_amount A column thats calculated from the previous two columns

discount_price A column thats calculated from the previous three columns

Round the discount_amount and discount_price columns to 2 decimal places.

Sort the result set by the discount_price column in descending sequence.

Use the LIMIT clause so the result set contains only the first 5 rows.

  1. Write a SELECT statement that returns these column names and data from the Order_Items table:

item_id The item_id column

item_price The item_price column

discount_amount The discount_amount column

quantity The quantity column

price_total A column thats calculated by multiplying the item price by the quantity

discount_total A column thats calculated by multiplying the discount amount by the quantity

item_total A column thats calculated by subtracting the discount amount from the item price and then multiplying by the quantity

Only return rows where the item_total is greater than 500.

Sort the result set by the item_total column in descending sequence.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions