Abv - Indian Institute of Information Technology and Management, Gwalior
Abv - Indian Institute of Information Technology and Management, Gwalior
TECHNOLOGY
AND MANAGEMENT, GWALIOR
The purpose of our assignment is to design a sample database of a Hostel Management which
will help students as well as supervisors to get the required information regarding the rooms, the
furniture and electrical appliances embedded in it, complaints filed by a particular resident and
reviews about the room.
Entity is an object which is distinguishable from others. It is a real-world thing which can be
distinctly identified like a person, place or a concept.
ATTRIBUTES
An attribute refers to a database component such as a table. It also may refer to a database
field. Attributes describe the instances in the column of a database.
1. Student : This entity set provides data regarding the student’s roll number,
name, phone number and email address. Note that roll number here is the
primary key attribute.
2. Room : This entity set contains information regarding the room number allotted
to a particular student. The attributes here are RoomNo and RoomName .
3. Furniture : This entity set provides information regarding the type of furniture in a
room. The attributes here are FurID, FurType .
5. Complaints : This entity set shows the information regarding the complaints filed
by the resident due to various problems faced by him/her. Its attributes are
CompID, Description .
6. Reviews : This entity set consists of the reviews given by students about the
condition of the rooms and furniture in the hostel. The attributes here are
ReviewID, Description .
RELATIONSHIP SETS
The association among entities is called a relationship. A set of relationships of similar type is
called a relationship set.
1. Have_EA : This is the relationship between the entity sets “Room” and
“ElectricalAppliances” and have “many to many relationship” between them as a single
room can contain many appliances while the same appliance can also be contained by
many rooms . The attributes here are “RoomNo” and “AppID” .
2. Have_Fur : This is the relationship between the entity sets “Room” and “Furniture” and
have “many to many relationship” between them as a single room can be associated
with many furnitures while the same furniture can also be contained by many rooms .
The attributes here are “RoomNo” and “FurID” .
3. Files : This is the relationship between the entity sets “Student” and “Complaints” and
have “one to many relationship” between them as a single student can file many
complaints while a complaint is unique for a particular student . The attributes here are
“RollNo” and “CompID” .
4. Gives : This is the relationship between the entity sets “Student” and “Reviews” and
have “one to many relationship” between them as a single student can give many
reviews while a review is unique for a particular student . The attributes here are
“RollNo” and “ReviewID” .
5. Occupy : This is the relationship between the entity sets “Student” and “Room” and have
“one to one relationship” between them as a single student can occupy a particular
room. Also, a particular room must be associated with a single student . The attributes
here are “RollNo” and “RoomNo” .
SCHEMA
ER DIAGRAM
RELATIONSHIP SCHEMA
NORMALISATION
1. All the relations are in 1NF as all the attributes in the relations have atomic domains.
2. All relations are in 2NF as they are already in 1NF and every non-prime attribute is fully
functionally dependent on the prime key attribute i.e there is no partial dependency.
3. All relations are in 3NF as they’re in 2NF and there is no transitive dependency i.e. no
non-prime attribute is transitively dependent on prime key attribute.
4. All the relations are in BCNF which is the stricter form of 3NF according to which LHS of
all functional dependencies must contain only superkey.
QUERIES IN RELATIONAL ALGEBRA
QUERIES IN SQL