In the name of Allah, the most beneficent, the most merciful
Advanced Database Systems
Lecture # 3
Instructor: Furqan Shahid
Quiz-1 (Max. time = 15 minutes)
Section-A
• Define the terms:
• Data, database, DBMS, data model, data dictionary
• Define database application. Also draw a figure to show association
among components of a database application.
• Explain the three types of database designs (schemas).
Section-B
• Differentiate between:
• Data vs. Meta-data (with example), Database server vs. client, DBMS vs. application
program, Structured vs. unstructured data (with example)
• Describe ANSI-SPARC architecture of database
• Define database application. Also draw a figure to show association among
components of a database application.
Instructor: Furqan Shahid
ER modeling revision
• Entity: A person, place, thing etc. about which data is to be stored
• Examples: EMPLOYEE, PRODUCT, SHIPMENT
• Entity type: Same as entity
• Entity instance: Single occurrence of an entity
• Examples: Ammar (instance of EMPLOYEE), Soap (instance of PRODUCT)
• Attribute: Desired characteristics of an entity
• Examples: Employee_name, contact, date_of_birth etc.
Instructor: Furqan Shahid
ER modeling revision (types of attributes)
• Single-valued vs. multi-valued
• E.g. Employee_date_of_birth vs. contact_no
• Simple (atomic) vs. composite
• E.g. Employee_first_name vs. address
• Address can be divided into sector, street_no, house_no etc.
• Required vs. optional attribute
• E.g. Employee_date_of_birth vs. secondary_Email_id
• Derived attribute
• E.g. Age can be derived from date_of_birth
Instructor: Furqan Shahid
ER modeling revision (strong vs. weak entity)
Employee:
Emp_no Name Contact Email Salary Date_of_
birth Strong entity
101 Hammad 0333-xxx hmd@... 50000 05-Feb-92
102 Ubaid 0300-xxx ubd@... 40000 18-Jun-93
Emp_Qualification:
Emp_no Degree Year Grade Board/
University
101 Matric 2002 B+ BISE
Weak entity
101 F.Sc. 2004 A BISE
102 DAE 2005 A PBTE
102 BS 2009 B AIOU
102 MS 2012 A QAU
Instructor: Furqan Shahid
ER modeling revision (identifier/primary key)
• An attribute (or a set of attributes) that gives unique identification to
the rows of a table (or to the instances of an entity)
• Can neither be duplicate
• Nor be null
• For example, cnic_no of employee
• Date_of_birth (is not identifier, why?)
• Secondary Email_id (is not identifier, why?)
• What is a composite identifier?
Instructor: Furqan Shahid
ER modeling revision (relationship)
• Meaningful association among entities
• Examples:
• STUDENT enrolls in a DEGREE
• STUDENT reads COURSE
• EMPLOYEE works in DEPARTMENT
Instructor: Furqan Shahid
ER modeling revision (degree of relationship)
• Number of entities participating in a relationship
• Types:
• Unary relationship
• EMPLOYEE supervises EMPLOYEE
• Binary relationship
• EMPLOYEE works in DEPARTMENT
• Ternary relationship
• VENDOR supplies ITEM on WAREHOUSE
Instructor: Furqan Shahid
ER modeling revision (cardinalities)
enrolled in
STUDENT DEGREE
reads offers
COURSE DEPTT
Fig. 5: An example ERD
• Minimum cardinality : either zero (optional) or one (mandatory)
• Maximum cardinality: either one or many (more than one)
• Types: One-to-one, One-to-many, many-to-many
Instructor: Furqan Shahid
Thank you
Instructor: Furqan Shahid