Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

CHAPTER 2 : DATABASE

DATABASE

2.1 Introduction to 2.2 Basic Concept


Database of Database
2.2 Basic Concept of Database
LEARNING OUTCOMES
At the end of this topic, students should be able
to:
• (a) Apply the basic concepts of database:
data hierarchy, entity relationship, data type,
data dictionary, entity relationship model.
• (b) Describe the representations of a relational
database: field, record and table/ file
• (c) Explain the concept of data integrity.
• (d) Explain the functions of database object.
(Table, Query, Form, Report) Report)
2.2.1 Basic Concepts of Database

 The basic concept of database


includes
 • Data Hierarchy
 • Data Type
 • Data Dictionary
 • Entity Relationship
 • Entity Relationship Model
Data Hierarchy
 Data in a database has a definite hierarchy.
Data hierarchy is the systematic organization
of data, often in a hierarchical form,
beginning with the smallest unit to the
largest.
 Data organization involves bit, byte,
characters, fields, records, files and database.
Data Hierarchy
Bit
A bit is the smallest unit of data the computer
can process.
Example: 0 or 1
Byte
A byte is eight (8) bits grouped together in a unit.
Example: 11010011
Character
A character is represented by one (1) byte.
Example: ` ~ 1 ! 2 @ 3 # q Q | \ ? / " “ ‘ '
Field
 At the lowest level, characters are entered into
database fields (columns), which hold single
pieces of data in the database, such as product
names or quantities.
 A field is a combination of one or more related

characters or bytes and is the smallest unit of


data a user accesses. It consists of field name,
field type / data type, and field properties.
Record
 At the next level are records (rows)—groups of
related fields (such as all the fields for a
particular student).
 A primary key is a field that uniquely identifies

each record in a file. The data in a primary key is


unique to a specific record (eg: Matric Number).
File / Table
 At the next level are tables, which are made up of
related records stored on a storage medium,
such as a hard drive, or on cloud storage.

 Example: Student File, Lecturer File, Course File,


Enrollment File, Gender File, Module File, State
File
Database
 At the top of the hierarchy is the database, which
consists of a group of related tables.
 Files are integrated into a database. This is done

using a DBMS.
 Example: KML database, School database,

Company database, Hospital database


Summary
Summary
Summary
Data dictionary
 Data dictionary is the centralized repository
(storehouse) of all data definitions in a database.
 Data definition involves describing the properties

of the data that go into each database table,


specifically the fields that make up the database.
A table is another way of representing entities.
 A data dictionary contains metadata i.e data about the
database.
 The data dictionary is very important as it contains

information such as what is in the database, who is allowed


to access it, where is the database physically stored etc.
 The users of the database normally don't interact with the

data dictionary, it is only handled by the database


administrators.
Data dictionary
 During the data definition process, the following are
supplied for each field:
 Field name (must be unique within the table).
 o A field name uniquely identifies each field. When
searching for data in a database, you often specify the field
name.
 o Example: Matric Number, Name, Gender ID, DOB, Email,
State ID,….
 o Primary key is an attribute or combination of attributes
that uniquely identifies one and only one instance of an
entity.
 o Foreign key is a set of attributes(field) in a table that refers
to the primary key of another table. The foreign key links
these two tables, sometimes also called referencing key.
Primary
key
Data dictionary
 Data type (such as Text, Number, Currency,
Yes/No, Hyperlink, or Date/Time); indicates the
type of data that will be entered into the field.
 o Text.
 Character data, also known as text data or string

data, can contain any character or symbol not


intended for mathematical manipulation. Name
and Email are examples of character attributes.
 o Number.
 You can use numeric data to perform meaningful

arithmetic procedures.
Data dictionary
 o Decimal.
 A decimal value in a column is rounded down to

an integer value.
 o Date/Time.
 Date attributes contain calendar dates stored in a

special format known as the Julian date format.


Field DOB is a date attribute.
 o Boolean.
 Logical data can only have true or false (yes or

no) values.
Data dictionary
 Description (an optional
description of the field).
 Properties (such as the
field size and format of
the field, any allowable
range or required format
for the data that will be
entered into the field,
whether or not the field is
required, and any initial
value to appear in that
field when a new record is
added).
Data dictionary
Data dictionary describing a table that contains employee details .

Field Name Data Type Field Size Description Example


for display
Employee Integer 10 Unique ID of 1645000001
Number each employee

Name Text 20 Name of the David


employee Heston

Date of Birth Date/Time 10 DOB of 08/03/1995


Employee

Phone Integer 10 Phone number 6583648648


Number of employee
Summary

You might also like