summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-01-01 12:49:56 -0700
committermo khan <mo.khan@gmail.com>2020-01-01 12:49:56 -0700
commitae55501aa2a5b84417ab816cf507f86d79251e0f (patch)
tree1245b8fbbb16dcfceab167e52915ee53462f87d9
parent0486ca8a47b6978210a08656378cb3160cd939b4 (diff)
Update department number
-rw-r--r--labs/2/README.md2
-rw-r--r--labs/2/run.sql2
2 files changed, 3 insertions, 1 deletions
diff --git a/labs/2/README.md b/labs/2/README.md
index 8a1e3f6..e513903 100644
--- a/labs/2/README.md
+++ b/labs/2/README.md
@@ -65,7 +65,7 @@ Indicates the name (Consumer Products, Industrial Products, and Research) and nu
Your solution should be simple and correct.
-* [ ] The company administration has decided to change the research department number from "12" to "14".
+* [x] The company administration has decided to change the research department number from "12" to "14".
Write an SQL query that performs this update.
Your query should make use of your trigger (from c) to ensure database integrity.
diff --git a/labs/2/run.sql b/labs/2/run.sql
index 3f32451..38aa0ef 100644
--- a/labs/2/run.sql
+++ b/labs/2/run.sql
@@ -95,3 +95,5 @@ CREATE TRIGGER update_sin AFTER UPDATE
FOR EACH ROW
WHEN (OLD.sin <> NEW.sin)
EXECUTE PROCEDURE update_referenced_sin_numbers();
+
+UPDATE departments SET dnumber = 14 where dnumber = 12;