Question

Each owner owns one or more cats, and every cat has exactly one owner.
• The name and surname of each owner must be stored in the database.
• The name of each cat must be stored in the database.
• Each cat belongs to one specific breed, and many cats can belong to the same breed.
• The description of each breed must be stored in the database.
• A cat can enter many competitions, and many cats can enter the same competition.
• The description of each competition must be stored in the database.
Write the SQL code that will create the table structure for the table that stores
the cat details

Answers

Bot
CREATE TABLE CatDetails (
CatID INT NOT NULL PRIMARY KEY,
CatName VARCHAR(50) NOT NULL,
BreedID INT NOT NULL,
OwnerID INT NOT NULL,
FOREIGN KEY (BreedID) REFERENCES BreedDetails(BreedID),
FOREIGN KEY (OwnerID) REFERENCES OwnerDetails(OwnerID)
);

Related Questions