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...

Nancy uses macros in her daily work as an account executive at a travel company. She often needs to create workbooks with macros for her co-workers and is always trying to make them as efficient as possible. If Nancy needs to run three macros sequentially to complete a task, she should create a ____ procedure.

What will be an ideal response?

Computer Science & Information Technology

The PATRIOT Act gives law enforcement the right to monitor people's activities, including web and email habits.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology