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 is an INVALID variable name?

A. user_choice B. u5er_choice C. user choice D. __user_choice

Computer Science & Information Technology

What is the value in x after line 6 is run?

A. g B. o C. space ‘ ‘ D. s

Computer Science & Information Technology

In constructing a project timeline, it is important to identify tasks that must be completed before others begin. These are ____________________.

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

Computer Science & Information Technology

A Gantt chart can simplify a complex project by combining several activities into a task _____ that contains subsidiary tasks.

A. group B. hierarchy C. network D. bar

Computer Science & Information Technology