DB_T22
DB_T22
Name
This table design stores the necessary information about the animals in the zoo very
efficiently. Here's a breakdown of the design choices:
AnimalID (INT): A common and efficient method of having a unique identifier for
each animal is to use an integer as the primary key.
Name (VARCHAR(50)): An animal name can be stored in VARCHAR (up to 50
characters in length). The rule that says that the name of an animal cannot be null
means that there is always a name for each animal.
Gender (VARCHAR(10)): VARCHAR is fine, but there's a more efficient and possibly
less error prone way to do this, storing 'M' or 'F' for gender, for example, using
CHAR(1).
YearArrived (INT): For this, we can store the year as an integer. The year is within a
reasonable range is the validation rule.
KeeperID (INT): This links to a separate "Keeper" table (not shown in the image).
This is a good practice because it reduces data redundancy and also allows you to
store more details of keepers in their own table.
EnclosureID (INT): This is similar to KeeperID as it links to an Enclosure table for
efficient management of enclosure information and its relationship to the animals.
Overall
This design is a clear and concise way to store the fundamental data about the
animals. Primary key and foreign keys are used to ensure data integrity and also
help in establishing relationship with other tables of the database. It is also possible
to refine the Gender data type for better efficiency.