1234567891011121314151617181920212223242526272829303132333435363738394041 |
- -- Exercise 1
-
- SELECT product_code,product_name,list_price,discount_percent
- FROM products
- ORDER BY list_price DESC;
-
- -- Exercise 2
- SELECT CONCAT(last_name+', '+first_name) AS full_name
- FROM customers;
-
- -- Exercise 3
- SELECT product_name,list_price,date_added
- FROM products
- WHERE list_price > 500 AND list_price < 1200
- ORDER BY date_added DESC;
-
- -- Exercise 4
- SELECT product_name,list_price,discount_percent,(list_price*discount_percent/100)AS discount_amount,(list_price -(list_price*discount_percent/100))AS discount_price
- FROM products
- ORDER BY list_price DESC LIMIT 5;
-
- -- Exercise 5
- SELECT item_id,item_price,discount_amount,quantity,(item_price*quantity)AS price_total,(discount_amount*quantity)AS discount_total,(item_price*quantity)-(discount_amount*quantity)AS item_total
- FROM order_items
- ORDER BY item_price DESC LIMIT 5;
-
- -- Exercise 6
- SELECT order_id,order_date,ship_date
- FROM orders
- WHERE ship_date IS null;
-
- -- Exercise 7
- SELECT NOW()=today_unformatted,
- (DD-Mon-YYYY)=today_formatted;
-
- -- Exercise 8
- SELECT list_price as price,
- discount_percent as tax_rate,
- (list_price*discount_percent/100) AS tax_amount,
- list_price*(list_price*discount_percent/100) AS total
- FROM products;
|