Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In our Canvas Shell, go to CSD - 1 3 8 Resources Book Resources ( including scripts to setup our databases etc. ) to

In our Canvas Shell, go to CSD-138 Resources\Book Resources (including
scripts to setup our databases etc.) to download and the file
create_my_guitar_shop.sql
Then to run the file
o Copy and paste the content of the file into MySQL Workbench and run it
o Or, open the file in MySQL Workbench and run it
o This will create the schema (i.e. database) titled my_guitar_shop
Then use the schema, my_guitar_shop to answer each problem in this
Assignment
Create a text file
o with a .sql file extension
o At the top of the script have
use my_guitar_shop;
o In your sql file, for each problem
In a commented section, write
The problem number
The problem statement
followed next by your sql statement submission for the problem
Note-> I only want to see your last version of your sql
statement for the problem
o No listing of previous intermediate sql work
1. Select all data from the customers table
2. Select First Name and Email Address
3. Order result by First Name in Ascending order
4. Show only first 5 rows of the result
5. Write query that will produce the following result for the people who have name Allan
Allan email address is allan.sherwood@yahoo.com
6. Select all data from Order_Items table such that item_price - discount_amount >
1000
7. Find products that have product name starting with "Gibson" and product code is
"sg"
8. Find products with the following product codes : strat, sg, washburn
9. Find all product that don't have following product code: strat, sg,washburn
10. Find all orders that have no ship date set
11. Write a SQL statement that selects from Products table the following information
product_name The product_name column
list_price The list_price column
The two columns should be joined into 1 column and result should looks like
Find all the products that contain word Gibson.
12. Write a SQL statement that selects these columns from the Orders table:
order_id The order_id column
ship_amount The ship_amount column
tax_amount The tax_amount column
Round the ship_amount and tax_amount columns rounded to 0 decimal places.
Return only the rows with a ship_amount that is greater than 5 and tax_amount is
less than 80.
13. Write a SQL statement that selects these columns 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
Only return products with list_price greater than 200 and less than 800
Sort it by product_name in descending sequence.
14. Write a SQL statement that selects these columns 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 455.
Sort the result set by item total in descending sequence.
15. Write a SQL statement that selects these columns from the Orders table:
order_id The order_id column
order_date The order_date column
ship_amount The ship_amount column
ship_date The ship_date column
Round the ship_amount to 1 decimal place.
Only return data where ship_date doesnt contain null.
Limit results to 5 rows.
16. Write a SQL statement without a FROM clause that uses the NOW function to create
a row with these columns:
today_unformatted The NOW function unformatted
today_formatted The NOW function in this format:
'MM/DD/YYYY
This displays a 2 digit number for the month, 2 digit number of the day, and a four-
digit year.
17. Write a SQL SELECT statement without a FROM clause that creates a row with
these columns:
Item_price 10(10 dollars)
Discount_percent .25(25 percent)
Discount_amount Item_price multiplied by Discount_percent
Final_price Item_price minus (Item_price multiplied by
Discount_percent)
To calculate the third column, add the expressions you used for the first and third

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2019 Wurzburg Germany September 16 20 2019 Proceedings Part 2 Lnai 11907

Authors: Ulf Brefeld ,Elisa Fromont ,Andreas Hotho ,Arno Knobbe ,Marloes Maathuis ,Celine Robardet

1st Edition

3030461467, 978-3030461461

Students also viewed these Databases questions

Question

2. Place a value on the outcomes.

Answered: 1 week ago