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.

README.md 2.6KB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ### Exercise 1
  2. Write an INSERT statement that adds this row to the Terms table:
  3. **terms- id:** 6
  4. **terms_description:** Net due 120 days
  5. **terms_due_days:** 120
  6. Use MySQL Workbench to review the column definitions for the Terms table, and include a column list with the required colu1nns in the INSERT statement.
  7. ### Exercise 2
  8. Write an UPDATE statement that modifies the row you just added to the Terms table. This statement should change the terms_description column to ''Net due 125 days'', and it should change the terms_due_days column to 125.
  9. ### Exercise 3
  10. Write a DELETE statement that deletes the row you added to the Terms table in exercise 1.
  11. ### Exercise 4
  12. Write an INSERT statement that adds this row to the Invoices table:
  13. **invoice id:** The next automatically generated ID
  14. **vendor id:** 32
  15. **invoice_number:** AX-014-027
  16. **invoice_date:** 8/1/2018
  17. **invoice_total:** $434.58
  18. **payment_total:** $0.00
  19. **credit total:** $0.00
  20. **terms id:** 2
  21. **invoice_due_date:** 8/31/2018
  22. **payment_date:** null
  23. Write this statement without using a column list.
  24. ### Exercise 5
  25. Write an INSERT statement that adds these rows to the Invoice_Line_Items table:
  26. invoice_squence: 1
  27. account_number: 160
  28. line_item_amount: $180.23
  29. line_item_description: Hard drive
  30. invoice_squence: 2
  31. account_number: 527
  32. line_item_amount: $254.35
  33. line_item_description: Exchange Server update
  34. Set the invoice_id column of these two rows to the invoice ID that was gener- ated by MySQL for the invoice you added in exercise 4.
  35. ### Exercise 6
  36. Write an UPDATE statement that modifies the invoice you added in exercise 4.
  37. This statement should change the credit_total column so it's 10% of the invoice_total column, and it should change the payment_total column so the sum of the payment_total and credit_total columns are equal to the invoice_total column.
  38. ### Exercise 7
  39. Write an UPDATE statement that modifies the Vendors table. Change the
  40. default account number column to 403 for the vendor with an ID of 44.
  41. ### Exercise 8
  42. Write an UPDATE statement that modifies the Invoices table. Change the terms_id column to 2 for each invoice that's for a vendor with a default_terms_id of 2.
  43. ### Exercise 9
  44. Write a DELETE statement that deletes the row that you added to the Invoices table in exercise 4. When you execute this statement, it will produce an error since the invoice has related rows in the Invoice_Line_Items table.
  45. To fix that, precede the DELETE statement with another DELETE statement that deletes the line items for this invoice. (Remember that to code two or more statements
  46. in a script, you must end each statement with a semicolon.)