Uploaded by Christina Quach

6-Assignment

advertisement
Professor Jianqing “Fisher” Wu
I S 300 Assignments
Assignment 6
Create SQL commands for each of the following question. Use the same online database
(https://www.w3schools.com/sql/trysql.asp?filename=trysql_desc) as the one we use in class. Write
your codes in the online platform, run your codes and check your data output, paste your SQL
codes below each question, and submit this word file on Beachboard.
Q1. List the employee id, first name, and last name for each employee.
Q2. List the product name, unit, and price for the products that have prices no more than 10.
Q3. List the order id and order date for all the orders that are delivered by shipper id 2. Sort your
result by order date.
Q4. Find employee(s) whose first name has initial ‘A’ and last name has initial ‘D’. Show employee
id, first name, and last name for such employee(s).
Q5. Show average price of the products that have product id greater than 40.
Q6. Show the category id of each category together with the minimum price of the products within
the category.
Q7. Show the product name, category name, and price for each product that has a price between 30
and 40.
Q8. Find all products that have the word ‘cans’ in unit. List the product name, unit, price, and
category name for such products.
Q9. Find all the suppliers for products that belong to ‘Seafood’ category. List the product name,
supplier name, supplier city, and supplier country. Sort the result by ascending order of supplier
country first, and then by descending order of product name.
Q10. Find all products that are purchased by customers located in USA. Show customer name,
address, city, and product name.
Q11. (Bonus 1 point) Show that, for each customer, what is the latest order date of all the orders
placed by the customer. List customer name and the latest order date. (Hint: use max function to
find the latest order date.)
Download