Phase 2 Report
Phase 2 Report
This report describes the steps that are specified in the instructions for the phase 2 of our
magnificient journey to creating a database application!
Step 2) I have selected 2 tables: “predators” and predator_prey_relationship”. Here are the SQL
statements for constructing this table:
create table predators (Habitat VARCHAR(50), _Name VARCHAR(50) PRIMARY KEY, Nutrition
VARCHAR(50));
The “predators” table also strictly adheres to the Boyce-Codd Normal Form due to the absence of
non-trivial functional dependencies beyond the trivial relation dependency (relation → relation).
None of the attributes ('Habitat', '_Name', and 'Nutrition') uniquely determine any other attribute
within the table. Additionally, no single attribute or combination thereof serves as a primary
attribute or superkey. As a result, the table inherently satisfies the criteria for BCNF.
Note: Due to participation constraints, I also had to add rows to the “prey” table, since both
attributes are foreign keys.
“Join these two tables such that each row in the joined table has the name of a prey that the predator
preys on.”
Step 8) I will query the database such that the result will be the relation instance that has 2
attributes: predator names and the amount of preys they prey on.
As you can see when I try to insert a description longer than 20 characters, SQL does not allow me
to do so: