1234567891011121314151617181920212223242526272829303132333435 |
- -- Exercise 1
- SELECT category_name, product_name, list_price
- FROM categories JOIN products
- ORDER BY category_name, list_price ASC;
-
- -- Exercise 2
- SELECT first_name, last_name, line1, city, state, zip_code
- FROM customers c1 JOIN addresses c2 ON c1.customer_id = c2.customer_id
- WHERE email_address = 'allan.sherwood@yahoo.com';
-
- -- Exercise 3
- SELECT first_name, last_name, line1, city, state, zip_code
- FROM customers c1 JOIN addresses c2 ON c1.customer_id = c2.customer_id
- ?????
-
- -- Exercise 4
- SELECT last_name, first_name, order_date, product_name, item_price, discount_amount, quantity
- FROM customers c
- JOIN orders o ON c.customer_id = o.customer_id
- JOIN order_items oi ON o.order_id = oi.order_id
- JOIN products p ON oi.product_id = p.product_id
- ORDER BY last_name, order_date, product_name;
-
- -- Exercise 5
- SELECT DISTINCT p1.product_name, p2.list_price
- FROM products p1 JOIN products p2
- ON p1.product_id != p2.product_id
- AND p1.list_price = p2.list_price
- ORDER BY product_name;
-
- -- Exercise 6
- ???
-
- -- Exercise 7
- ???
|