Design a schema for a part of a package delivery company, which contains information about packages (PkgId, AddresseeId), addressees (Id, Name, StreetNumber, StreetName, City), and streets (StreetName, City, MinHouseNumber, MaxHouseNumber). Show the primary and foreign keys. Indicate the NOT NULL constraint wherever applicable.

What will be an ideal response?


CREATE TABLE Package (
PkgId INTEGER,
AddresseeId CHAR(20) NOT NULL,
PRIMARY KEY (PkgId)
FOREIGN KEY (AddresseeId) REFERENCES Addressee (Id)
)
CREATE TABLE Addressee (
Id CHAR(20),
Name CHAR(20) NOT NULL,
StreetNumber INTEGER NOT NULL,
StreetName CHAR(40) NOT NULL,
City CHAR(20) NOT NULL,
PRIMARY KEY (Id)
FOREIGN KEY (StreetName,City) REFERENCES Streets
)
CREATE TABLE Streets (
StreetName CHAR(40),
City CHAR(20),
MinHouseNumber INTEGER NOT NULL,
MaxHouseNumber INTEGER NOT NULL,
PRIMARY KEY (StreetName, City)
)

Computer Science & Information Technology

You might also like to view...

Which of the following is a CSS named color?

a. maroon b. crimson c. lavender d. All of these

Computer Science & Information Technology

When present, _________ the block associated with a try block always executes.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology