12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- -- Exercise 1
- SELECT category_name, product_name, list_price
- FROM categories c JOIN products p
- ON c.category_id = p.category_id
- ORDER BY category_name,product_name ASC;
-
- -- Exercise 2
- SELECT first_name, last_name, line1, city, state, zip_code
- FROM customers c JOIN addresses a
- ON c.customer_id = a.customer_id
- WHERE state='NJ'
- ORDER BY customers ASC;
-
- -- Exercise 3
- SELECT first_name, last_name, line1, city, state, zip_code
- FROM customers c JOIN addresses a
- ON c.customer_id = a.customer_id
- ORDER BY first_name ASC;
-
- -- Exercise 4
- SELECT last_name, first_name, order_date, product_name, item_price, discount_amount, quantity
- FROM customers c JOIN products p AND orders o JOIN order_items i
- ON c.customer_id = p.category_id AND o.order_id = i.order_id
- ORDER BY last_name, order_date, product_name ASC;
-
- -- Exercise 5
- SELECT product_name, list_price
- FROM products(
- SELECT product_name, list_price
- FROM products)
- ORDER BY product_name ASC;
-
- -- Exercise 6
- SELECT product_name, list_price
- FROM products(
- SELECT product_name, list_price
- FROM products)
- WHERE product_name IS null
- ORDER BY product_name ASC;
-
- -- Exercise 7
- SELECT ship_date, order_id, order_date
- FROM orders;
|