You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

How-to-insert-update-and-delete-data.sql 983B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. -- Exercise 1
  2. INSERT INTO categories
  3. VALUES (default, 'Brass');
  4. -- Exercise 2
  5. UPDATE categories
  6. SET category_name = 'Woodwinds'
  7. WHERE category_id = 5;
  8. -- Exercise 3
  9. DELETE FROM categories
  10. WHERE category_id = 5;
  11. -- Exercise 4
  12. INSERT INTO products (product_id, category_id, product_code, product_name, description, list_price, discount_percent, date_added)
  13. VALUES (default, 4, 'dgx_640', 'Yamaha DGX 640 88-Key Digital Piano', 'Long description to come.', 799.99, 0, now());
  14. -- Exercise 5
  15. UPDATE products
  16. SET discount_percent = 35
  17. WHERE product_id = 11;
  18. -- Exercise 6
  19. DELETE FROM categories
  20. WHERE category_id = 4;
  21. DELETE FROM products
  22. WHERE product_id = 11;
  23. -- Exercise 7
  24. INSERT INTO customers (email_address, password, first_name, last_name)
  25. VALUES ('rick@raven.com', '', 'Rick', 'Raven');
  26. -- Exercise 8
  27. UPDATE customers
  28. SET password = 'secret'
  29. WHERE email_address = 'rick@raven.com';
  30. -- Exercise 9
  31. UPDATE customers
  32. SET password = 'reset'
  33. LIMIT 100
  34. -- Exercise 10