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.
Bart De Lepeleer 75f3503dc2 Demo queries from slides 2 years ago
README.md 'README.md' updaten 2 years ago
demo-queries-from slides-1.sql Demo queries from slides 2 years ago
demo-queries-from slides-2.sql Demo queries from slides 2 years ago
demo-queries-from slides-3.sql Demo queries from slides 2 years ago
demo-queries-from slides-4.sql Demo queries from slides 2 years ago
demo-queries-from slides-5.sql Demo queries from slides 2 years ago
demo-queries-from slides-6.sql Demo queries from slides 2 years ago
demo-queries-from slides-7.sql Demo queries from slides 2 years ago
exercise-1.sql published solutions 2 years ago
exercise-2.sql published solutions 2 years ago
exercise-3.sql published solutions 2 years ago
exercise-4.sql published solutions 2 years ago
exercise-5.sql published solutions 2 years ago
exercise-6.sql published solutions 2 years ago
exercise-7.sql published solutions 2 years ago
exercise-8.sql published solutions 2 years ago
exercise-9.sql published solutions 2 years ago

README.md

Exercise 1

Write an INSERT statement that adds this row to the Terms table:

terms- id: 6
terms_description: Net due 120 days
terms_due_days: 120

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.

Exercise 2

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.

Exercise 3

Write a DELETE statement that deletes the row you added to the Terms table in exercise 1.

Exercise 4

Write an INSERT statement that adds this row to the Invoices table:

invoice id: The next automatically generated ID
vendor id: 32
invoice_number: AX-014-027
invoice_date: 8/1/2018
invoice_total: $434.58
payment_total: $0.00
credit total: $0.00
terms id: 2
invoice_due_date: 8/31/2018
payment_date: null

Write this statement without using a column list.

Exercise 5

Write an INSERT statement that adds these rows to the Invoice_Line_Items table:

invoice_squence: 1
account_number: 160
line_item_amount: $180.23
line_item_description: Hard drive

invoice_squence: 2
account_number: 527
line_item_amount: $254.35
line_item_description: Exchange Server update

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.

Exercise 6

Write an UPDATE statement that modifies the invoice you added in exercise 4.

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.

Exercise 7

Write an UPDATE statement that modifies the Vendors table. Change the default account number column to 403 for the vendor with an ID of 44.

Exercise 8

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.

Exercise 9

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.

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 in a script, you must end each statement with a semicolon.)