Browse Source

published solutions

master
Bart De Lepeleer 2 years ago
parent
commit
0af693fa89
9 changed files with 34 additions and 0 deletions
  1. 4
    0
      exercise-1.sql
  2. 4
    0
      exercise-2.sql
  3. 2
    0
      exercise-3.sql
  4. 3
    0
      exercise-4.sql
  5. 3
    0
      exercise-5.sql
  6. 4
    0
      exercise-6.sql
  7. 3
    0
      exercise-7.sql
  8. 6
    0
      exercise-8.sql
  9. 5
    0
      exercise-9.sql

+ 4
- 0
exercise-1.sql View File

@@ -0,0 +1,4 @@
INSERT INTO terms
(terms_id, terms_description, terms_due_days)
VALUES
(6, 'Net due 120 days', 120)

+ 4
- 0
exercise-2.sql View File

@@ -0,0 +1,4 @@
UPDATE terms
SET terms_description = 'Net due 125 days',
terms_due_days = 125
WHERE terms_id = 6

+ 2
- 0
exercise-3.sql View File

@@ -0,0 +1,2 @@
DELETE FROM terms
WHERE terms_id = 6

+ 3
- 0
exercise-4.sql View File

@@ -0,0 +1,3 @@
INSERT INTO invoices
VALUES (DEFAULT, 32, 'AX-014-027', '2018-08-01', 434.58, 0, 0,
2, '2018-08-31', NULL)

+ 3
- 0
exercise-5.sql View File

@@ -0,0 +1,3 @@
INSERT INTO invoice_line_items VALUES
(115, 1, 160, 180.23, 'Hard drive'),
(115, 2, 527, 254.35, 'Exchange Server update')

+ 4
- 0
exercise-6.sql View File

@@ -0,0 +1,4 @@
UPDATE invoices
SET credit_total = invoice_total * .1,
payment_total = invoice_total - credit_total
WHERE invoice_id = 115

+ 3
- 0
exercise-7.sql View File

@@ -0,0 +1,3 @@
UPDATE vendors
SET default_account_number = 403
WHERE vendor_id = 44

+ 6
- 0
exercise-8.sql View File

@@ -0,0 +1,6 @@
UPDATE invoices
SET terms_id = 2
WHERE vendor_id IN
(SELECT vendor_id
FROM vendors
WHERE default_terms_id = 2)

+ 5
- 0
exercise-9.sql View File

@@ -0,0 +1,5 @@
DELETE FROM invoice_line_items
WHERE invoice_id = 115;

DELETE FROM invoices
WHERE invoice_id = 115;

Loading…
Cancel
Save