week13
week13
• Data
• Information
• Data processing
• Electronic Data processing
• Metadata
• Data base
• Hierarchy of data
• Keys
• Relationships
Data
• A collection of raw facts and figures is called
data.
• Data is given to the computer for processing.
• Data is collected from different resources and
it may consists of numbers, characters,
symbols or pictures.
Data
• Data can be of following different types
– Numeric data
– Alphabetic data
– Alphanumeric data
– Image data
– Audio data
– Video data
Information
• The processed data is called information.
• Information is more meaningful than data and
is used for making decisions.
Difference between
Data and Information
Data Processing
• Data processing is the process of converting
data into meaningful information.
• Data is the input and information is the output
of a data processing system.
Name
Ejaz
Usman
Database: Components
• Four major components of database system
are
– Data
– Hardware
– Software
– Personnel
Database: Components
• Data is the most important component of
database system.
• Data is a collection of facts stored in the
database.
• Basic purpose of a database system is to store,
maintain and process data for user.
Database: Components
• Hardware is used to perform different tasks
such as input, output, storage and processing.
• Some important hardware components are as
follows
– Secondary storage
– I/O devices
– Processors
– Main Memory
Database: Components
• Three types of software are required to enable
the database system work properly. These are
– Operating system: It manages all hardware
components and enables all other software to run on
computer.
– DBMS Software: It manages the database in the
database system.
– Application programs and utilities: These are used to
access and process the data stored in the database.
Database: Components
• Personnel are the people related to the
database system.
• Different type of persons in a database system
are
– Database Administrators
– Application Programmers
– End Users
Hierarchy of Data
• Data in computer is classified in a hierarchy
and different terms are used to describe data
of different levels in the hierarchy.
• A database contain files.
– A file contains records
• A record contains fields
– A field consists of characters.
Hierarchy of Data: Field
• A combination of one or more characters is called a
field.
• It is the smallest unit of data that can be accessed by
the user.
• The name of each field in a record is unique and
each field contains one specific piece of information.
• Field size defines the maximum number of
characters that can be stored in a field.’
• Field type indicates the type of data that can be
stored in the field
Hierarchy of Data: Field
Hierarchy of Data: Record
• A collection of related fields treated as a single
unit is called a record.
• For example, an employee’s record includes a
set of fields that contains employee number,
employee name, grade and designation etc.
Hierarchy of Data: File
• File is a collection of related records treated as
a single unit.
• A database is a group of related data files.
• For example a student database may have
data files like students file, fee file, attendance
file and exam file.
Keys
• A key is an attribute or set of attributes that
uniquely identifies a tuple (row) in file.
• Keys are defined in the table to
– Access stored data quickly
– Arrange stored data quickly and smoothly
• Keys are also used to create relationship
between different tables.
Keys
• Different types of important keys in databases
are
– Primary key
– Candidate key
– Alternate key
– Composite key
– Foreign key
Keys: Primary Key
• Primary key is an attribute that uniquely identifies a
row or record in a relation.
• Some important points about a primary key are
– A relation can have only one primary key.
– Primary key attribute must have unique values
– Primary key can not contain null values.
Keys: Candidate and Alternate Keys
• A relation may contain many attributes that can be
used as primary key.
• Such an attribute is called candidate key and a
relation can have many candidate keys.
• The candidate keys that are not selected as primary
key are known as alternate keys.
Keys: Composite Key
• A primary key that consists of two or more
attributes is known as composite key.
Keys: Foreign Key
• A foreign key is an attribute in a relation
whose values match a primary key in another
relation.
• The relation in which foreign key is created is
known as dependent or child table.
• The relation to which the foreign key refers is
known as parent table.
Keys: Foreign Key
• Some important points of a foreign key are as follows
– It has same name as the primary key from which it was
referred.
– The field specifications of the primary key from which it
was copied have to be the same for the foreign key too.
Relationships
• A relationship is a logical connection between
different tables and is established on the basis
of interaction among these tables.
• The relationship is established by connecting
one or more fields of two tables.
• The fields used to connect two tables normally
have same name, data type and size.
Relationships
• Different types of relationship are
– One-to-One Relationship
– One-to-Many Relationship
– Many-to-Many relationship
One-to-One Relationship
• One-to-One relationship exists between two
tables when:
– For each record in the first table, there is only one
record in the second table.
– For each record in the second table, there is only
one record in the first table.
One-to-One Relationship
One-to-Many Relationship
• One-to-Many relationship exists between two
tables when:
– For each record in the first table, there are one or
more records in the second table.
– For each record in the second table, there is only
one record in the first table.
One-to-Many Relationship
Many-to-Many relationship
• Many-to-Many relationship exists between
two tables when:
– For each record in the first table, there are one or
more records in the second table.
– For each record in the second table, there are one
or more records in the first table.
Many-to-Many relationship
Many-to-Many relationship