SQL represents the foundation upon which commercial relational database software is based. The number of terms required to navigate use this language is relatively small, but understanding the full meaning and implications of each term requires considerable study. This report examines a selection of terms and how they are used to describe the interdependent relationships between entities and attributes.
Relational Databases
For each table, identify the primary key and the foreign key(s). If a table does not have a foreign key, write None in the space provided.
PRIMARY KEY
FOREIGN KEY
Truck
TRUCK_NUM
BASE_CODE, TYPE_CODE
Base
BASE_CODE
TYPE_CODE
Do the tables exhibit entity integrity? Answer yes or no, and then explain your answer.
ENTITY INTEGRITY
EXPLANATION
Truck
All rows under the primary key TRUCK_NUM are uniquely identified and there are no null entries
Base
All rows under the primary key BASE_CODE are uniquely identified and there are no null entries
All rows under the primary key TYPE_CODE are uniquely identified and there are no null entries
19. Do the tables exhibit referential integrity? Answer yes or no, and then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key.
TABLE
REFERENTIAL INTEGRITY
EXPLANATION
Truck
Yes
All values under the foreign keys BASE_CODE and TYPE_CODE refer to a valid tuple in the BASE and TYPE tables, respectively. Null values are allowed
Base
NA
NA
Type
NA
NA
20. Identify the TRUCK table's candidate key(s).
Aside from the foreign keys BASE_CODE and TYPE_CODE, all other keys are candidate keys because they could be used as unique identifiers for each truck. This statement assumes that the nine trucks listed in the table is exhaustive. The candidate keys are therefore: TRUCK_NUM, TRUCK_MILES, TRUCK_BUY_DATE, and TRUCK_SERIAL_NUM.
21. For each table, identify a superkey and a secondary key.
TABLE
SUPERKEY
SECONDARY KEY
Truck
You’re 76% through this paper. Sign up to read the full paper.
Sign Up Now — Instant Access Already a member? Log inAlways verify citation format against your institution’s current style guide requirements.