0% found this document useful (0 votes)
18 views21 pages

Database Systems

The document discusses different types of attributes in a database including simple, composite, single-valued, multi-valued, stored, derived attributes as well as keys like primary keys and foreign keys. It also covers different types of entity types such as strong and weak entities and how attributes can be assigned to relationships.

Uploaded by

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

Database Systems

The document discusses different types of attributes in a database including simple, composite, single-valued, multi-valued, stored, derived attributes as well as keys like primary keys and foreign keys. It also covers different types of entity types such as strong and weak entities and how attributes can be assigned to relationships.

Uploaded by

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

Database Systems

Lec# 8
Topics
Attributes
• Simple & Composite Attribute
• Single Valued & Multi Valued Attribute
• Stored & Derived Attribute
• Keys
• Strong & Weak Entity Type
• Attribute on Relationship
Attribute

• A property of an entity or a relationship type.


• Entity instances of same entity type have the same attributes. (e.g. Student Roll
Number, Student Name)
• Domain of an Attribute
• Every attribute has a domain
• Set of possible values for an attribute
• The attributes in an entity set get the values from the same domain.
• For example GPA is from 0 to 4
Symbols for Attributes

• Each represented as an oval, linked with an ET symbol

ENTITY TYPE ATTRIBUTE


Types of Attributes

• Simple & Composite Attribute

• Single Valued & Multi Valued Attribute

• Stored & Derived Attribute


Simple Attribute
• An attribute that cannot be further subdivided into components is a simple attribute.
• Also called atomic attribute.
• For example Salary, roll number, order number etc

Symbol
Simple Attribute Gender

EMPLOYEE
Composite Attribute
• An attribute that can be subdivided into smaller components.
• For example address, phone number etc City
Street Country

Address
Symbol
Composite Attribute
Gender Salary

EMPLOYEE
Single Valued Attribute
• An attribute that holds a single value for each instance of an entity type.
• For example gender, result_status, date_of_birth etc City
Street Country

Address

Symbol
Single Valued Attribute Salary
Gender

EMPLOYEE
Multivalued Attribute
• An attribute that holds multiple values for each instance of an entity type.
• For example contact_Number, Skills, email_id etc City
Street Country

Address

Symbol
Multivalued Valued Attribute Salary
Gender Skills

EMPLOYEE
Stored Attribute
• An attribute that is stored in database.
• Most of the attributes are stored attributes City
Street Country
• For example DOB, salary, city etc
Address

Symbol
Stored Attribute Salary
Gender Skills

EMPLOYEE
Derived Attribute
• An attribute that can be derived from other attribute(s).
• For example age, CGPA, Annual Salary, year_experience etc

City
Street Country

Symbol Address
Derived Attribute

Gender Salary Skills

EMPLOYEE
Identifier Attribute
• An attribute that uniquely identifies an instance among other instances in entity type.
• For example Roll Number, Employee Code etc
• Identifier attribute must be underlined. City
Street Country

Symbol Address
Identifier Attribute
AttName
EmpCode Salary Skills

EMPLOYEE
Symbols for Attributes

Simple
Composite
Multi-valued
Derived
Keys
• A key refers to an attribute/a set of attributes that help to identify a row
(or tuple) uniquely in a table (or relation).
• It is also used to establish relationship between different relations or
tables.
• Types of keys
• Super Key
• Candidate key
• Primary Key
• Composite Key
• Foreign Key
Types of Keys

• Primary Key
• The candidate key that is selected to uniquely identify each instance of an entity type.
• Its value must not be duplicated and null.
• A relation can have only one primary key.
• For example student’s roll number
• Alternate Key
• The candidate keys that are not selected as primary key.
• For example student’s registration number .
Types of Keys

• Composite Key
• A combination of two or more columns that uniquely identify rows in a table.
• The combination of columns guarantees uniqueness.
• For example Roll Number and Course code both uniquely identify the obtained marks of
a particular roll number in a particular course.
Types of Keys

• Foreign Key
• An attribute of a table B whose values match a primary key in another table A.
• It is used to establish relationship between tables on the bases of data in both attributes of
table A and table B.
• There may be more than one FK in a table.
• For example
• Consider table EMP and DEPT
• EMP (empId, empName, qual, depId)
• DEPT (depId, depName, numEmp)
Types of Entity Types
• Entity types can be classified into regular/strong/independent ETs or
weak/dependent ETs
• Strong Entity Types
• A strong/regular entity type is the one whose instances can exist independently,
i.e., without being linked to other instances
• Strong ETs have their own identity
• Weak Entity Types
• An entity type whose instances cannot exist without being linked with instances
of some other entity type, i.e., they cannot exist independently.
Types of Entity Types
Entity’s Symbols

Strong Entity Type NAME

Weak Entity Type NAME


COURSE STUDENT

BOOK BOOKCOPY
Attributes on Relationships

• attributes can also be assigned to relationships

Start_Date

Department
Symbol Employee Manages
Attribute on Relationship

Order_Date

Customer Order Product

You might also like