IT Learning HubIT Learning Hub
WEEK 2 · PRACTICE EXERCISES

Exercises & Answer Key

IT004BTTH2Sales Management

The exercise statement is open to read freely. The answer key and detailed explanations are reserved for students currently enrolled in the IT004 practicum class and require an access code from the instructor.

EXERCISE · PART III - DATA QUERY LANGUAGE

Sales Management - Questions 1 ➜ 25

Use SQL statements in SQL Server Management Studio to carry out the 25 queries below on the Sales Management schema. Attempt each one yourself before checking the answer.

Submission requirement: Save your work in a single script file named <MSSV>_<HoVaTen>_BTTH2.sql (MSSV is your student ID, HoVaTen is your full name).
  1. Print the list of products (MASP, TENSP) manufactured in "Trung Quoc".
  2. Print the list of products (MASP, TENSP) whose unit of measure is "cay" or "quyen".
  3. Print the list of products (MASP, TENSP) whose product code starts with "B" and ends with "01".
  4. Print the list of products (MASP, TENSP) manufactured in "Trung Quoc" priced from 30,000 to 40,000.
  5. Print the list of products (MASP, TENSP) manufactured in "Trung Quoc" or "Thai Lan" priced from 30,000 to 40,000.
  6. Print the invoice numbers and invoice totals sold on 1/1/2007 and 2/1/2007.
  7. Print the invoice numbers and invoice totals in January 2007, sorted by date (ascending) and invoice total (descending).
  8. Print the list of customers (MAKH, HOTEN) who made a purchase on 1/1/2007.
  9. Print the invoice numbers and invoice totals for invoices created by the employee named "Nguyen Van B" on 28/10/2006.
  10. Print the list of products (MASP, TENSP) purchased by the customer named "Nguyen Van A" during October 2006.
  11. Find the invoice numbers that include the product with code "BB01" or "BB02".
  12. Find the invoice numbers that include the product with code "BB01" or "BB02", each purchased in a quantity from 10 to 20.
  13. Find the invoice numbers that include both products with code "BB01" and "BB02" at the same time, each purchased in a quantity from 10 to 20.
  14. Print the list of products (MASP, TENSP) manufactured in "Trung Quoc" or products sold on 1/1/2007.
  15. Print the list of products (MASP, TENSP) that have never been sold.
  16. Print the list of products (MASP, TENSP) that were not sold in 2006.
  17. Print the list of products (MASP, TENSP) manufactured in "Trung Quoc" that were not sold in 2006.
  18. Report the number of invoices created by each employee in 2006, showing (MANV, HOTEN, SoLuongHD).
  19. Print the list of employees together with the total number of distinct customers they sold to in 2006.
  20. List the product(s) (MASP, TENSP) with the highest total quantity sold in 2006.
  21. Find the employee with the highest sales revenue in October 2006.
  22. Print the list of products not sold in 2007 but sold in 2006.
  23. List the products (MASP, TENSP) sold by at least 2 different employees.
  24. Print the list of customers who did not purchase any product manufactured in Thailand.
  25. Find the invoice with the highest total value in 2006, printing (SOHD, NGHD, TRIGIA).
Full exercise - Week 2 practice (BTTH2) PDF file · questions 1 through 25, Part III Sales Management
Download ↓
This exercise uses the shared Sales Management schema (KHACHHANG, NHANVIEN, SANPHAM, HOADON, CTHD) - see the full attributes, sample data, and database script. View schema ›

ANSWER

View answer

Protected content

Enter the access code to view the Week 2 answer.

Access code provided by the instructor.