0% found this document useful (0 votes)
39 views6 pages

LAB 12 M Ahmad L1S17BSCS0010

The document describes the data requirements for two database systems - one for an educational institute and one for a courier service. For the educational institute, it outlines the entities like departments, professors, students, courses, sections, and projects, along with their attributes. For the courier service, it describes entities like retail centers, transportation events, and shipped items, along with their relationships. Relational schemas with tables and attributes are provided for both database systems.

Uploaded by

Ahmad Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views6 pages

LAB 12 M Ahmad L1S17BSCS0010

The document describes the data requirements for two database systems - one for an educational institute and one for a courier service. For the educational institute, it outlines the entities like departments, professors, students, courses, sections, and projects, along with their attributes. For the courier service, it describes entities like retail centers, transportation events, and shipped items, along with their relationships. Relational schemas with tables and attributes are provided for both database systems.

Uploaded by

Ahmad Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

LAB 12

M AHMAD
L1S17BSCS0010
Entities, Attributes and Relations

Q1. Consider a database system for an educational institute. The data


requirements are summarized as follows:
In an educational institute, there are several departments and students belong to one of them.
Each department has a unique department number, a name, a location, phone number and is
headed by a professor. Professors have a unique employee Id, name including first and last name
and phone number. We like to keep track of the following details regarding students: name,
unique roll number, gender, phone number, date of birth, age and one or more email addresses.
Students have a local address consisting of the hostel name and the room number. They also have
home address consisting of house number, street, city and PIN. It is assumed that all students
reside in the hostels. A course taught in a semester of the year is called a section. There can be
several sections of the same course in a semester; these are identified by the section number.
Each section is taught by a different professor and has its own timings and a room to meet.
Students enroll for several sections in a semester. Each course has a name, number of credits and
the department that offers it. A course may have other courses as pre- requisites i.e, courses to be
completed before it can be enrolled in. Professors also undertake research projects. These are
sponsored by funding agencies and have a specific start date, end date and amount of money
given. More than one professor can be involved in a project. Also a professor may be
simultaneously working on several projects. A project has a unique projectId.

RELATIONAL SCHEMA:
CREATE TABLE Department
(
DeptId INT NOT NULL,
Location INT NOT NULL,
Phone INT NOT NULL,
HOD INT NOT NULL,
Name INT NOT NULL,
PRIMARY KEY (DeptId)
);

CREATE TABLE Course


(
CourseId INT NOT NULL,
Credits INT NOT NULL,
Name INT NOT NULL,
PRIMARY KEY (CourseId)
);
CREATE TABLE Professor
(
ProfId INT NOT NULL,
Name INT NOT NULL,
PhoneNumber INT NOT NULL,
PRIMARY KEY (ProfId)
);

CREATE TABLE Section


(
Classroom INT NOT NULL,
SectionId INT NOT NULL,
PRIMARY KEY (SectionId)
);

CREATE TABLE Project


(
StartDate INT NOT NULL,
EndDate INT NOT NULL,
Sponser INT NOT NULL,
amount INT NOT NULL,
ProjectId INT NOT NULL,
PRIMARY KEY (ProjectId)
);
CREATE TABLE Student
(
Name INT NOT NULL,
RollNumber INT NOT NULL,
DOB INT NOT NULL,
HouseNo INT NOT NULL,
Street INT NOT NULL,
City INT NOT NULL,
Pin INT NOT NULL,
HostelName INT NOT NULL,
RoomNo INT NOT NULL,
PRIMARY KEY (RollNumber)
);

CREATE TABLE Section_Timings


(
Timings INT NOT NULL,
SectionId INT NOT NULL,
PRIMARY KEY (Timings, SectionId),
FOREIGN KEY (SectionId) REFERENCES Section(SectionId)
);

CREATE TABLE Student_Email_Id


(
Email_Id INT NOT NULL,
RollNumber INT NOT NULL,
PRIMARY KEY (Email_Id, RollNumber),
FOREIGN KEY (RollNumber) REFERENCES Student(RollNumber)
);
Q2. Consider a database system for a Courier service. The data
requirements are summarized as follows:
UPS prides itself on having up-to-date information on the processing and current location of each
shipped item. To do this, UPS relies on a company-wide information system. Shipped items are the
heart of the UPS product tracking information system. Shipped items can be characterized by item
number (unique), weight, dimensions, insurance amount, destination, and final delivery date.
Shipped items are received into the UPS system at a single retail center. Retail centers are
characterized by their type, uniqueID, and address. Shipped items make their way to their
destination via one or more standard UPS transportation events (i.e., flights, truck deliveries). These
transportation events are characterized by a unique scheduleNumber, a type (e.g, flight, truck), and
a deliveryRoute. Please create an Entity Relationship diagram that captures this information about
the UPS system. Be certain to indicate identifiers and cardinality constraints.

RELATIONAL SCHEMA:

CREATE TABLE Retail_Center


(
Type INT NOT NULL,
Unique_Id INT NOT NULL,
PRIMARY KEY (Unique_Id)
);

CREATE TABLE Transportation_event


(
Type INT NOT NULL,
Schedule_No INT NOT NULL,
DeliveryRoute INT NOT NULL,
PRIMARY KEY (Schedule_No)
);

CREATE TABLE Retail_Center_Address


(
Address INT NOT NULL,
Unique_Id INT NOT NULL,
PRIMARY KEY (Address, Unique_Id),
FOREIGN KEY (Unique_Id) REFERENCES Retail_Center(Unique_Id)
);
CREATE TABLE Shipped_Items
(
Item_no INT NOT NULL,
Weight INT NOT NULL,
Dimension INT NOT NULL,
Insurance INT NOT NULL,
Destination INT NOT NULL,
FinalDeliveryDate INT NOT NULL,
Unique_Id INT NOT NULL,
PRIMARY KEY (Item_no),
FOREIGN KEY (Unique_Id) REFERENCES Retail_Center(Unique_Id)
);

CREATE TABLE ShippedVia


(
Item_no INT NOT NULL,
Schedule_No INT NOT NULL,
PRIMARY KEY (Item_no, Schedule_No),
FOREIGN KEY (Item_no) REFERENCES Shipped_Items(Item_no),
FOREIGN KEY (Schedule_No) REFERENCES Transportation_event(Schedule_No)
);

You might also like