Introduction To Databases
Introduction To Databases
MATHEMATICS DEPARTMENT
COMPUTER STUDIES AND ICT SECTION
INTRODUCTION
TO
Database systems
WHAT IS A DATABASE?
A DATABASE is usually
abbreviated as DB.
A DATABASE is a collection of
logically related
data/information, which is self
organising.
FILE BASED SYSTEM
A FILE-BASED SYSTEM is a collection of data
stored in an orderly manner in a file.
It is an imitation of the traditional filing cabinet
system.
It is a file packed with data, with no metadata and
thus no organising structure.
METADATA is simply Data about data. It refers
to data/information that provides information about
other data. Metadata describes how and when and
by whom a particular set of data was collected, and
how the data is formatted/organised
HOW FILE-BASED SYSTEMS WORK
COMPUTER
MATHEMATICS EDUCATION
STUDIES DEPARTMENT DEPARTMENT
DEPARTMENT
COMPUTER
MATHEMATICS EDUCATION
STUDIES DATA DATA
DATA
ACCOUNTS
SALES PRODUCTION
DEPARTMENT
DEPARTMENT DEPARTMENT
DATA POOL
Advantages of database systems
Reduced data redundancy
Reduced updating errors
Increased Data Consistency
Data Sharing and Integration
Greater data integrity
Enhanced Constraint integrity
Enhanced Data Security
advantages of database systems …
Program-Data Independence
Reduced data entry, storage and retrieval
costs
Improved data access to users through use
of host and query languages
Reduced data entry, storage, and retrieval
costs
Facilitated development of new
applications program
disadvantages of database systems
DBSes are complex, difficult, and time-
consuming to design and create.
Extensive conversion costs in moving
form an FBS to a DBS
Cost of Staff Training and users
DBS Failures are counter-productive
Substantial hardware and software start-
up costs
applications of database systems
EDUCATION SECTOR
DBSes are used in schools, colleges and
Universities to store and retrieve the data
regarding student details, staff details, course
details, exam details, payroll data, attendance
details, fees details, …
TELECOMMUNICATIONS
To keep track of the information regarding
calls made, air-time/Internet-data balances,
network usage, customer details, ...
applications of database systems …
MANUFACTURING INDUSTRY
A DB to keep track of INs and OUTs for raw
materials, products produced and disbursed,
machinery, …
SALES SYSTEMS
To store customer information, production information
and invoice details, ...
BANKING SYSTEMS
For storing customer information, tracking day to day
credit and debit transactions, generating bank
statements, …
applications of database systems …
TRANSPORT SYSTEMS
To keep a record of reservations, travel times,
passenger/goods details, …
ONLINE SHOPPING SYSTEMS
To store products information, Customer addresses
and preferences, credit details and provision of the
relevant list of products based on queries, ...
HEALTH SECTOR
To store and retrieve the data regarding patients,
staff, drugs, treatment details, payroll data, medical
fees details, …
applications of database systems …
DYNAMICS INTERNET WEBSITES
To stores the content of the website.
SOCIAL MEDIA SITES
To store details on registered users, postings
uploaded by users, …
HOSPITALITY INDUSTRY
To store and retrieve the data regarding
customer reservations/bookings, records of
available facilities, rates for facilities, …
applications of database systems …
DYNAMICS INTERNET WEBSITES
To stores the content of the website.
SOCIAL MEDIA SITES
To store details on registered users, postings
uploaded by users, …
HOSPITALITY INDUSTRY
To store and retrieve the data regarding
customer reservations/bookings, records of
available facilities, rates for facilities, …
Database tables
Data in a database systems is logically
organized in tables.
Databases have ENTITIES and each entity
is represented by a table, in a database.
Each table is made of ROWS and
COLUMNS
Columns accommodate FIELDS or
ATTRIBUTES
Rows accommodate RECORDS
Database table example
Consider STUDENT as an entity in a database
Some of the attributes are:
Student Number
Surname
First Name
NRC Number
Date of Birth
Gender
Cell phone Number
Address
Student
STUDENT NAME NRC NUMBER DOB SEX CELL PHONE
NUMBER NUMBER
1630 KABWE 607964/67/1 14/09/90 M 099990011
1631 BWALE 727272/99/1 12/03/91 F 0911776655
1632 KABWE 909088/87/1 09/12/92 F 0922223411
1604 BANDA 322365/87/I 14/09/90 M 0900528417
1622 CHAAMWE 757588/54/1 23/12/93 F 0933885544
1615 JOBANGO 212353/78/1 25/12/94 M 0944784564
1611 KABOVA 969636/87/1 23/01/92 M 0910889744
1610 JERABO 123321/33/1 01/01/95 F 0920884433
1602 KAKEYA 331199/57/1 25/04/92 M 093150077
FIELD
A field is one piece of data or information
about a person or thing.
STUDENT NAME NRC DOB SEX CELL PHONE
NUMBER NUMBER NUMBER
1630 KABWE 607964/67/1 14/09/90 M 099990011
1631 BWALE 727272/99/1 12/03/91 F 0911776655
1632 KABWE 909088/87/1 09/12/92 F 0922223411
1604 BANDA 322365/87/I 14/09/90 M 0900528417
1622 CHAAMWE 757588/54/1 23/12/93 F 0933885544
1615 JOBANGO 212353/78/1 25/12/94 M 0944784564
1611 KABOVA 969636/87/1 23/01/92 M 0910889744
1610 JERABO 123321/33/1 01/01/95 F 0920884433
1602 KAKEYA 331199/57/1 25/04/92 M 093150077
RECORD OR TUPLE
A record is all of the data or information
about one person or one thing, in a table.
STUDENT NAME NRC DOB SEX CELL PHONE
NUMBER NUMBER NUMBER
1630 KABWE 607964/67/1 14/09/90 M 099990011
1631 BWALE 727272/99/1 12/03/91 F 0911776655
1632 KABWE 909088/87/1 09/12/92 F 0922223411
1604 BANDA 322365/87/I 14/09/90 M 0900528417
1622 CHAAMWE 757588/54/1 23/12/93 F 0933885544
1615 JOBANGO 212353/78/1 25/12/94 M 0944784564
1611 KABOVA 969636/87/1 23/01/92 M 0910889744
1610 JERABO 123321/33/1 01/01/95 F 0920884433
1602 KAKEYA 331199/57/1 25/04/92 M 093150077
Special keys
PRIMARY KEY
This is a field/attribute in a database table
designated to uniquely identify records.
CANDIDATE KEY(S)
This is a field/attribute that qualifies to be a
Primary key
FOREIGN KEY
This is a Primary key of another table appearing
in a table for purposes of relating the two tables
Special keys
You are now advised to research on the
following:
ALTERNATE KEY
SECONDARY KEY(S)
COMPOSITE KEY(S)
SUPER KEY
COMPUOND KEY
SURROGATE KEY
Primary and FOREIGN KEY
STUDENT# NAME NRC DOB SEX CELL# LECTURER #
1630 KABWE 607964/67/1 14/09/90 M 099990011 8899
1631 BWALE 727272/99/1 12/03/91 F 0955776655 9632
1632 KABWE 909088/87/1 09/12/92 F 0966223411 3356
1604 BANDA 322365/87/I 14/09/90 M 0977528417 9632
1622 CHAAMWE 757588/54/1 23/12/93 F 0967885544 8899
1615 JOBANGO 212353/78/1 25/12/94 M 0959784564 3356
1611 KABOVA 969636/87/1 23/01/92 M 0965889744 8899
1610 JERABO 123321/33/1 01/01/95 F 0975884433 9632
1602 KAKEYA 331199/57/1 25/04/92 M 099950077 3356
Database MANAGEMENT SYSTEM - DBMS
A DBMS is a software package that can be
used to create and manage/manipulate a
database system.
The elemental functions of a DBMS are to:
Create
Read or Retrieve
Update
Delete
Easily remembered as “CRUD”
Database SYSTEM - DBS
A DBS is a high-level definition of the structure and
relationship among stored data, the database, the users and
the hardware/software system used.