Week2 Answers
Week2 Answers
The Crow foot notation ERD to represent the given business operations can be depicted as given below:
Note: The TRUCK_SERIAL_NUM could also be designated as the primary key. Because the
TRUCK_NUM was designated to be the primary key, TRUCK_SERIAL_NUM is an example of a
candidate key.
18.
Yes. The tables exhibit entity integrity. The explanation is given below:
TABLE PRIMARY KEY ENTITY INTEGRITY EXPLANATION
TRUCK TRUCK_NUM YES The TRUCK_NUM values in the
TRUCK table are all unique and
there are no nulls.
BASE BASE_CODE YES The BASE_CODE values in the BASE
table are all unique and there are no
nulls.
TYPE TYPE_CODE YES The TYPE_CODE values in the TYPE
table are all unique and there are no
nulls.
19.
No. The tables do not exhibit referential integrity.
The table TRUCK exhibits referential integrity. The referential integrity ensures that the foreign key must
always reference an existing primary key or contain a null value. The foreign key of the TRUCK table
points to the existing primary key of the TYPE table. The table BASE and TYPE doesn’t have the foreign
key.
BASE NONE NA
TYPE NONE NA
Here, the tables BASE and TYPE do not have foreign key values. Therefore, the tables do not exhibit
referential integrity.
20.
The candidate key of the TRUCK table is TRUCK_SERIAL_NUM.
Explanation:
The candidate key refers to a column, or a set of columns uniquely identifies a record without referring to
other data. A table can have more than one candidate key. The candidate key is unique and refers to the
primary key. As the TRUCK_NUM is the primary key of the TRUCK table, the TRUCK_SERIAL_NUM
can be a primary key. So, it can be candidate key. Therefore, the candidate key of the TRUCK table is
TRUCK_SERIAL_NUM.
21.
TABLE SUPER KEY SECONDARY KEY
TRUCK TRUCK_NUM + TRUCK_MILES BASE_CODE + TYPE_CODE
(This secondary key is likely to produce
TRUCK_NUM + TRUCK_MILES +
multiple matches, but it is not likely that
TRUCK_BUY_DATE
end-users will know attribute values
such as TRUCK_MILES or
TRUCK_NUM + TRUCK_MILES +
TRUCK_BUY_DATE. Therefore, the
TRUCK_BUY_DATE + TYPE_CODE
selected attributes create a reasonable
secondary key.)
BASE BASE_CODE + BASE_CITY BASE_CITY + BASE_STATE
(This is a very effective secondary key
BASE_CODE + BASE_CITY + BASE_CITY
since it is not likely that a state contains
two cities with the same name.)
TYPE TYPE_CODE + TYPE_DESCRIPTION TYPE_DESCRIPTION
22.
ERD for this database is shown in below:
23.