2.
2 Basic concept
of Database
2022 @ Sir Lizam
Learning Outcome
At the end of this topic, students should be able to:
Explain the basic concepts of database.
• Data Hierarchy
• Entity Relationship
• Data Type
• Data Dictionary
• Primary Key
• Foreign Key
2022 @ Sir Lizam
Data Hierarchy
Data Hierarchy refers to the systematic
organization of data.
2022 @ Sir Lizam
Database
Table Table … Table
Record … Record
Field … Field
Character …. Character
Byte … Byte
Bit
….
Bit
2022 @ Sir Lizam
Database
Database
Collection of table (Student Database)
Table 1 Table 2 Table 3
Tbl_student_info Tbl_course Tbl_hostel
2022 @ Sir Lizam
Table / File
Contains a set of records. Organize in row
Students_id Name Class_id Adress
Record 1 MS1550 Jamal Ahmad BC3T21 Sabah
Record 2 MS1551 Faridah Karim BC3T20 Sabah
Record 3 MS1552 Cristine Jery CP3T14 Sarawak
Record 4 MS1553 Suriyati Ali CP3T21 Sabah
2022 @ Sir Lizam
Fields
A single items of data common to all records
Fields 1
Students_id
MS1550
MS1551
MS1552
MS1553
2022 @ Sir Lizam
Characters
Consists of letter numbers and special character.
Field Name and
data on table is
Students_id
a combination
MS1550 of characters
MS1551
MS1552
MS1553
2022 @ Sir Lizam
Bytes
Combination of 8 bits to represent a character
Students_id
Character S come from combination
of 8 bits ( 1 bytes)
2022 @ Sir Lizam
Bits
Binary digit is a basic unit that use to represent an electric state on (1)
/ off (0).
Character S come from combination
of 01101100
2022 @ Sir Lizam
End of Data Hierarchy
2022 @ Sir Lizam
Entity
Relationship
Diagram (ERD)
Tool that graphically shows the
connections among entities in a
system
2022 @ Sir Lizam
Entities
• An object in the system that has data.
• Examples: School have students, teachers, classroom and
students grades
2022 @ Sir Lizam
Aka ER diagrams or Entity Relationship
Models.
Entity visualizes the relationships between
entities like people, things, or concepts in a
Relationship database.
Diagram visualize the attributes of these entities.
(ERD)
illustrate the logical structure of
databases.
2022 @ Sir Lizam
2022 @ Sir Lizam
How to construct ERD
• Identify the entities
• Look at two entities, are they related? If so draw a solid
line connecting the two entities and add a diamond
between them with a brief description of how they are
related
• Add attributes
• Any key attributes of entities should be added using oval-
shaped symbols.
• Complete the diagram
• Continue to connect the entities with lines, and adding
diamonds to describe each relationship until all
relationships have been described.
2022 @ Sir Lizam
ERD Symbols
Entity Relationship
Entity
Combination
of Entity and
Attribute Attribute
Attribute
2022 @ Sir Lizam
One to One, 1:1
Cardinality One to Many, 1:M
of
Relationship Many to One, M:1
Many to Many, M:M
2022 @ Sir Lizam
EDR notation Crow's Foot
Chen Style
styles Notation
2022 @ Sir Lizam
Crow's Foot
Notation
2022 @ Sir Lizam
Chen Style
2022 @ Sir Lizam
Example
• An employee manages a store,
and each store is managed by an
employee.
• Customer has an account, and
each account belongs to a
customer.
• Lecturer teaches a course, and
each course is taught by a
Lecturer.
2022 @ Sir Lizam
An employee manages a store, and each store is managed by an employee.
2022 @ Sir Lizam
Customer has an account, and each account belongs to a customer.
2022 @ Sir Lizam
Lecturer teaches a course, and each course is taught by a Lecturer.
2022 @ Sir Lizam
End of ERD
2022 @ Sir Lizam
Data Types
Specifies the kind of data a field can
contain and how the field is use
2022 @ Sir Lizam
Text Memo Number Date / Time
Enter letter,
Number or Enter lenghtly Enter number Enter date or
special text entries only time
character
Currency Auto Number Yes / No OLE Object
Enter dollar and Unique number
Enter photo,
cent amounts or automatically Only enter
audio, video or
numbers assigned by the value Yes or No
other documents
containing DBMS to each (True or False) in other program
decimal values added record
Hyperlink Attachment
Enter email Documents or
address or web image that is
address that link attach to the
to a web pages field
2022 @ Sir Lizam
Data Dictionary /
Repository
• Contains data about each file/table
in the database and each fields in
those file
• Information about table
2022 @ Sir Lizam
Data Dictionary example
Student table
2022 @ Sir Lizam
• Data dictionary for Student Table
Field name Data type Field size Description Default value
2022 @ Sir Lizam
eot
2022 @ Sir Lizam