Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Problem #1
- USE ap;
- SELECT
- product_code,
- product_name,
- list_price,
- discount_percent
- FROM my_guitar_shop.products
- ORDER BY list_price DESC;
- -- Problem #2
- SELECT CONCAT(last_name, ', ', first_name)
- AS Full_Name FROM my_guitar_shop.customers
- WHERE 'M' < last_name
- ORDER BY last_name ASC;
- -- Problem #3
- SELECT
- product_name,
- list_price,
- date_added
- FROM my_guitar_shop.products
- WHERE list_price > 500 and list_price < 2000
- ORDER BY date_added DESC;
- -- Problem #4
- SELECT
- product_name,
- list_price,
- discount_percent,
- CAST((list_price * (discount_percent/100)) AS DECIMAL(6,2)) AS discount_amount,
- CAST(list_price - (list_price * (discount_percent/100)) AS DECIMAL(6,2)) AS discount_price
- FROM my_guitar_shop.products
- ORDER BY discount_price DESC
- LIMIT 5;
- -- Problem #5
- SELECT
- item_id,
- item_price,
- discount_amount,
- quantity,
- (item_price * quantity) AS price_total,
- (discount_amount * quantity) AS discount_total,
- (price_total - discount_total) * quantity AS item_total
- FROM my_guitar_shop.order_items
- WHERE item_total > 500
- ORDER BY item_total DESC;
Advertisement
Add Comment
Please, Sign In to add comment