TOPIC: DATABASE PART 1
Database (DB) is a collection of related records, well organized and stored in a
memory for future use. Database can also be defined as a collection of
information that is organized for easy access, management and update. There
is a software used to create and manage database called “Database
Management Software”. The facilities provided by the DBMS include:
Accessing
Updating
Recording
Recovery
Querying
Multi-access control etc.
DATABASE TERMINOLOGIES
1. CHARACTER: A character (Bit) is the basic or smallest unit of data
representation in DB. It is a single symbol such as digit, letter or other
special symbols {a,1,(,@, =}
2. BYTE: This is the collection of eight (8) bits.
3. FIELD (ATTRIBUTE/COLUMN): It is a single elementary unit of
information which represents an attribute of an entity in a database. A
field is an area reserved for each piece of individual data such as:
Table1
Field1 Field2 Field3 Field4 Add New Field
Student Name Class Age Sex
field
4. RECORD (TUPLE/ROW): It is a group of related fields pertaining to one
person, place or thing. Simply put, a record is a collection of related fields.
This refers to a row of data in a table. A record runs horizontally from left
to right
Table 2
Field1 Field2 Field3 Field4 Field 5
Student Name Class Age Sex Date of Birth
John’s John Jss3 13 Male 01/01/2009
Record
5. FILE: This is the collection of related records
6. ENTITY: An entity has a distinct existence as an individual unit. It is
something that is in existence that has the properties of being real
(ie having a real existence).Examples: a person, object, event, or
transaction.
NOTE: Entity is anything we can get or derive information from.
Student name
Surname
First name etc.
7. FORM: This is a method used in entering, viewing and printing
information
8. REPORT: This is a generated information from a table or query
9. DB OBJECT: An object is an option that can be selected and manipulated
10. DBMS (Database Management System): This is DB software used to
create and manage a DB. A Database Management System (DBMS) is a
set of computer programs that control the creation, maintenance, and the
use of a database. It allows organizations to place control of database
development in the hands of database administrators (DBAs) and other
specialists.
The following are the functions of Database Management System Software:
1. Update and retrieve data
2. Back-up data in a database
3. Recover data in the database in the event of system failure.
4. Creation of database files.
5. It is used to query data stored in a database for retrieval, manipulation,
etc.
6. Publishing and reporting of data in a database.
Therefore, the Database Management System is a software that structures,
manipulates and ensures data security and recovery.
Examples of DBMS are:
Dbase III plus
Dbase IV
Microsoft Access
Oracle
MYSQL (MY Structured Query Language)
MSSQL (Microsoft Structured Query Language)
FoxPro
dBase etc.
11. ENTITY GROUP: A group or class of persons, objects, events or
transactions with very similar characteristics (students, teachers,
employees, men, women, patients, medical doctors, etc).
12. SCHEMA: It is the overall design of the database.
13. DATA INDEPENDENCE: It is the ability to modify a schema
definition in one level of the database without affecting the schema
definition in the next level of the database, for example, a database file
may be modified without affecting its program file.
14. QUERY: This is a command issued to the DB to fetch or extract
information from the Database
15. Key: A key in database is defined as an attribute used to sort and / or
identify data in some manner. It is an identifier for a record or group of
records in a data file. The following are common types of key in a
database:
a) Primary Key
b) Candidate Key
c) Foreign Key
d) Alternative Key/Secondary Key
e) Composite etc.
Primary Key (PK):
This is defined as a key that “uniquely” identifies each record in a database. It
also defined as the set of columns that can be used to identify or access a
particular row or rows. Examples of primary keys are:
1. Car Registration Numbers
2. Student Registration Numbers etc.
They are called primary keys because they cannot be duplicated.
Candidate Key:
A candidate key is an attribute(s) in a table that qualifies to be used as a unique
identifier to a record. When a candidate key has been selected, it can now be
called a primary key.
Foreign Key (FK):
A foreign key is a field/ PK seen in another table. It is used to link up two tables
together. The foreign key can be used to cross-reference tables.
Alternative Key: Alternate Key or Secondary Key is the key that has not been
selected to be the primary key, but are candidate keys. However, it is considered
a candidate key for the primary key.
INDEX:
1. This is a summary table that allows you to quickly find any record in a
table. It is similar to the index of a book. When you are looking for
particular information, you can use the index to speed up your search.
ASSIGNMENT
Customer Table
Emp-ID FName LName Emp-Reg Address Position
No
AA001 Mike Johnny MJ001 Rivers Clerk
AA002 Tom Harry TH002 Aba Teacher
AA003 Ben Mark BM003 Imo Janitor
AA004 Kinky Pat KP004 Rivers Teacher
From the table above, identify the following:
1. Write out all the fields we have in the table (3mks)
2. How many tuple do we have in the relation (1mk)
3. Which attribute(s) is/are candidate key(s) (list them) (2mks)
4. Can “Fname” be used as a PK? (yes or No) (1mk)
5. A candidate key can also be used as a PK (yes or No) (1mk)
6. An alternative key is also a candidate key (yes or No) (1mk)
7. Assuming “Emp-ID” and “Emp-Reg No” can be used for PK. If the
latter is selected as the PK, what is the former called (1mk)