Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Part 1: Quick Summary
Database Design Process
Database design is the process of structuring data and relationships in a
database system.
Main phases:
1. Conceptual Design → Using ER Model
2. Logical Design → Convert ER to relational schema
3. Physical Design → Storage and implementation
Entity
An Entity is a real-world object that can be identified and stored in the
database.
Examples:
• Student
• Employee
• Department
• Course
Each entity has attributes describing it.
Attributes
Attributes are properties that describe an entity.
Example:
Employee entity may have:
• Employee_ID
• Name
• Salary
• Address
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Types of attributes:
• Simple Attribute → cannot be divided (Age)
• Composite Attribute → can be divided (Name → First + Last)
• Derived Attribute → calculated from another attribute (Age from
Birthdate)
Key Attribute
A Key Attribute uniquely identifies each entity instance.
Example:
Employee_ID uniquely identifies an employee.
Entity Type
Entity Type is a collection of similar entities.
Example:
EMPLOYEE entity type contains many employees.
Relationship
A Relationship represents an association between entities.
Example:
Employee works in Department.
Entities involved in relationships are called participants.
Relationship Degree
The degree of relationship depends on the number of participating entities.
Examples:
• Binary Relationship → 2 entities
• Ternary Relationship → 3 entities
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Weak Entity
A Weak Entity cannot exist without another entity.
It depends on a strong entity.
Example:
DEPENDENT depends on EMPLOYEE.
Weak entity has partial key.
ER Diagram
An ER Diagram is a graphical representation of entities, attributes, and
relationships.
Basic symbols:
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Example: COMPANY Database
Question 1:
A big company has decided to store information about its projects and
employees in a database. The company has wisely chosen to hire you
as a database designer. Prepare an E-R diagram for this Company
according to The following Description:
• The company has a number of employees each employee has SSN,
Birth Date, Gender and Name which represented as Fname and Lname.
• The company has a set of departments each department has a set of
attributes .DName, DNUM (unique) and locations.
• Employees work in several projects each project has Pname, PNumber
as an identifier, Location and City.
• Each employee may have a set of dependent; each dependent has
Dependent Name (unique), Gender, and Birth Date.
Note: if the employee left the company no needs to store his
dependents info
• For each Department, there is always one employee assigned to
manage that Department and each manager has a hiring Date
• Department may have employees but employee must work on Only One
department
• Each department may have a set of projects and each project must
assigned to one department
• Employees work in several projects and each project has several
employees and each employee has a number of working hours in each
project
• Each employee has a supervisor
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Question 2:
ITI has decided to store information about its Students and curriculums in a
database. ITI has wisely chosen to hire you as a database designer. Prepare an E-
R diagram for ITI that describes its activities according to The following
Description:
• ITI has a number of students in different departments(tracks), each student has
St_id(unique),studentName(Fname,Lname),St_age,st_address
• Each department has dept_id(unique), dep_name
• Students takes many Courses, each course has crs_id, crs_name, crs_duration
and crs_Description
• Student has a grade in each course
• Each department contains a set of instructor and each instructor in located in
one department, each instructor has ins_id, ins_name, ins_salary, ins_hourRate,
ins_bouns,ins_address
• For each Department, there is always one instructor assigned to manage that
Department and each manager has a hiring Date
• Instructor may teach many courses and each course may be conducted by many
instructors, each instructor has evaluation in each course
• Course is classified under one topic, each topic may have many courses, and
each topic has top_name and top_id
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Part 2: Questions
MCQ
1. An entity represents:
a) relationship
b) real-world object
c) attribute
d) key
2. Attributes describe:
a) entities
b) relationships
c) tables
d) queries
3. A key attribute is used to:
a) store data
b) uniquely identify an entity
c) create relationship
d) delete data
4. A relationship connects:
a) attributes
b) entities
c) tables
d) keys
5. A weak entity depends on:
a) strong entity
b) attribute
c) relationship
d) key
6. ER diagram is used in:
a) conceptual design
b) physical design
c) implementation
d) programming
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
7. Which symbol represents a relationship in an ER diagram?
a) Rectangle
b) Oval
c) Diamond
d) Circle
8. Attributes are used to:
a) Describe the properties of an entity
b) Connect two tables
c) Store SQL queries
d) Create relationships only
9. Which attribute type can be divided into smaller parts?
a) Simple attribute
b) Derived attribute
c) Composite attribute
d) Key attribute
10. Which of the following entities cannot exist without a related strong entity?
a) Strong entity
b) Weak entity
c) Composite entity
d) Derived entity
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
True / False
1. An entity represents a real-world object.
2. Attributes describe properties of entities.
3. A key attribute can have duplicate values.
4. A weak entity can exist independently .
5. ER diagrams represent database structure visually .
6. A relationship connects two or more entities.
Complete the Following
1. An ______ represents a real-world object in a
database.
2. Attributes describe the ______ of an entity.
3. A ______ attribute uniquely identifies an entity.
4. A ______ entity depends on another entity.
5. ER diagrams are used in ______ database design.
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Part 3: Practical SQL Lab
Task 1: Create Table
Create a table called STUDENT.
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Task 2: Insert Data
INSERT INTO STUDENT VALUES:
Task 3: Display Data
SELECT * FROM STUDENT;
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Task 4: Arithmetic Expressions
Arithmetic expressions are used to perform calculations on column values.
Task 5: Null Values in Arithmetic Expressions
If a column contains NULL, the result of the arithmetic expression becomes
NULL. Example: SELECT id, id + NULL AS Result FROM Students; The
result will be
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Task 6: Defining a Column Alias
A column alias gives a temporary name to a column.
Task 7: Concatenation Operator-: Concatenation combines two
columns into one column.
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Task 8-Using Literal Character Strings
A literal string is a fixed text value written between quotes.
Task 9 :- Alternative Quote Operator
Used to include quotes inside a string.
Spring 2026
Sheet_4
Program : Computer Engineering Program Date : 15 March 2026
Dr. Tarek salem
Examiners :
Eng : Eman, Habiba,Basant
Duration 2 hours
Database Management Systems /
Course/Code :
CSE112
Task 10 :- Duplicate Rows
To remove duplicate rows we use DISTINCT.