From 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Thu, 2 Jul 2026 11:55:17 -0700 Subject: Init --- Homework/cs5800/Homeworks/hw-4.html | 311 ++++++++++++++++++++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 Homework/cs5800/Homeworks/hw-4.html (limited to 'Homework/cs5800/Homeworks/hw-4.html') diff --git a/Homework/cs5800/Homeworks/hw-4.html b/Homework/cs5800/Homeworks/hw-4.html new file mode 100644 index 0000000..b89d2b8 --- /dev/null +++ b/Homework/cs5800/Homeworks/hw-4.html @@ -0,0 +1,311 @@ + + + + + + + +Homework 4 + + + + + +
+

Homework 4

+ + +
+

1. Question One

+
+

+The number of super keys here is the cardinality of the set of all sets of attributes that contain at least the clientId. In this case, that's: +

+ +
    +
  1. (clientId)
  2. +
  3. (clientId, name)
  4. +
  5. (clientId, phone)
  6. +
  7. (clientId, address)
  8. +
  9. (clientId, name, phone)
  10. +
  11. (clientId, name, address)
  12. +
  13. (clientId, phone, address)
  14. +
  15. (clientId, name, phone, address)
  16. +
+ +

+Therefore there are eight super keys. +

+
+
+ +
+

2. Question Two

+
+

+There is only one primary key which is the collection of (clientId, empId, packageId). +

+
+
+ +
+

3. Question Three

+
+

+Salesman has two candidate keys empId and name, if we assume that each salesperson has a unique name. If not, then empId is the only candidate key (and also in this design, the primary key!). +

+
+
+ +
+

4. Question Four

+
+
+
select clientId, name, phone, address from Client where name="Peter Smith";
+
+
+
+
+ +
+

5. Question Five

+
+
+
select videoCode from Video where videoLength < 2;
+
+
+
+
+ +
+

6. Question Six

+
+

+Making the assumption that all addresses are formatted as "<street no> <street address>". For example "12345 John Blvd": +

+ +
+
select siteCode, type, address, phone from Site where right(address, locate(' ', address)-1) = "University Dr";
+
+
+
+
+ +
+

7. Question Seven

+
+

+Assuming a siteCode of one: +

+ +
+
select administrator.empId, administrator.name, administrator.gender from administers join administrator on administrator.empId=administers.empId where siteCode=1;
+
+
+
+
+
+
+

Author: Logan Hunt

+

Created: 2022-10-08 Sat 18:41

+

Validate

+
+ + -- cgit v1.3