Database JSS3 Computer Studies Lesson Note

Download Lesson Note
Lesson Notes

Topic: Database

What is a database?

  1.         A database is a collection of information organized to provide efficient retrieval. 
  2.         A database is a set of data that has a regular structure and is organized in such a way that a computer can easily find the desired information.

What is a database management system?

A database management system (DBMS) is a software package that allows for the creation, storage, maintenance, manipulation, and retrieval of large datasets distributed over one or more files. is a software package that allows for the creation, storage, maintenance, manipulation, and retrieval of large datasets that are distributed over one or more files

TYPES OF DATABASE

Five main types of database organization: 

  1.         Flat database
  2.         Hierarchical  database
  3.         Relational  database
  4.         Object-oriented database
  5.         Network database

FLAT-FILE DATABASE

A flat-file database is one that only contains a single table of data.   

A flat–file database is a database model whereby all data are stored in a single table. Is a database whereby all data are stored in a single, large table.

Below is an example of how our database might look built around a flat-file model. The table is separated into rows and columns. A single column represents an attribute, and a single row represents a record in this database. The table below is an example of a flat-file database.

Player ID First Name Last Name Address Club League
101 Ryan Giggs 15 Meade Lane Manchester United Premier
102 Frank Lampard 16 Rope Street Chelsea Premier
103 Steven Gerrard 17 Camel Lane Liverpool Premier
104 Adel Taarbt 18 Leather Lane QPR Championship
105 Martin John 19 Apple Grove GardffCity  Championship

Another example is the table that shows the properties of seven fishes such as habitat, color, and speed, and the caretaker schedule table. Since some animals can live on land or in water, two columns are needed for the Habitat properties. Similarly, three columns are needed for the Color properties. This leads to the flat file database shown in the following figure.

Name Habitat1 Habibat2 Color1 Color2 Color3 Speed Caretaker schedule
Dolphin Water   Grey     Fast Mary:(6-8am,3-6pm)
Duck Land Water Brown Green Grey Slow Joe: (10 am-4 pm)
Fish Water   White     Fast Joe: (10 am-4 pm)
Grog Land Water Green     Slow Joe: (10 am-4 pm)
Horse Land   Black Brown White Fast Alex:( 6-7 am,3-4 pm)
Ladybug Land   Black Red   Slow Mary:(6-8am,3-6pm)
Lion Land   Yellow     Fast Alex 🙁 6-7 am,3-4 pm)

 RELATIONAL DATABASE

A relational database is a type of database that contains two or more tables of data, connected by links called relationships.

A relational database is a software package that records information in such a way that data can be accessed without reorganization of the tables.is a collection of tables that are connected in such a way that data can be accessed without reorganization of the tables. The tables are created such that each column represents a particular attribute.

Practice your understanding of databases by answering the following questions:

  1.         Which animals can live on land and are red? 
  2.         Which animals are slow and either black or grey? 
  3.         Which animals are fast can live on land and are not yellow? 

 A HIERARCHICAL DATABASE

Meaning 

  1.         A   hierarchical databaseA simple database model that organizes data into a “one-to-many” association across levels. Is also a database model that organizes data into a “one-to-many” association across levels.  Consider a company’s organizational structure. At the top, we have a General Manager (GM). Under him, we have several Deputy General Managers (DGMs). Each DGM looks after a couple of departments and each department will have a manager and many employees. When represented in the hierarchical model, there will be separate rows for representing the GM, each DGM, each department, each manager, and each employee. The row position implies a relationship to other rows. A given employee belongs to the department that is closest above it in the list and the department belongs to the manager that is immediately above it in the list and so on as shown.

ADVANTAGES OF HIERARCHICAL DATABASE

  1.         Simplicity: Data naturally have a hierarchical relationship in most of the practical situations. Therefore, it is easier to view data arranged in a manner. 
  2.         Security: This database system can enforce varying degrees of security features, unlike a flat-file system. 
  3.     Database Integrity: Because of its inherent parent-child structure, database integrity is highly promoted in these systems. 
  4.         Efficiency: The hierarchical database model is very efficient when the database contains a large number of I: N relationships (one-to-many relationships) and when the users require a large number of transactions, using data whose relationships are fixed. 

 DISADVANTAGES OF HIERARCHICAL DATABASE

  1.         Complexity of Implementation: The actual implementation of a hierarchical database depends on the physical storage of data. This makes the implementation complicated. 
  2.         Difficulty in Management: The movement of a data segment from one location to another causes all the accessing programs to be modified making database management a complex affair. 
  3.         Complexity of Programming: Programming a hierarchical database is relatively complex because the programmers must know the physical path of the data items. 
  4.         Poor Portability: The database is not easily portable mainly because there is little or no standard existing for these types of databases. 
  5.         Database Management Problems: If you make any changes in the database structure of a hierarchical database, then you need to make the necessary changes in all the application programs that access the database. Thus, maintaining the database and the applications can become very difficult. 
  6.         Lack of structural independence: Structural independence exists when the changes to the database structure do not affect the DBMS’s ability to access data. 
  7.         Programs Complexity: Due to the structural dependence and the navigational structure, the application programs and the end users must know precisely how the data is distributed physically in the database to access data. 
  8.         Operational Anomalies: A hierarchical model suffers from Insert anomalies, Update anomalies, and Deletion anomalies, also the retrieval operation is complex and asymmetric, and thus the hierarchical model is not suitable for all the cases. 
  9.         Implementation Limitation: Many of the common relationships do not conform to the l: N format required by the hierarchical model. The many-to-many (N: N) relationships, which are more common in real life are very difficult to implement in a hierarchical model. 

Network database

The network model is the type of database that allows many-to-many relationships in a tree-like structure that allows multiple parents.

TERMINOLOGIES USED IN DATABASE

  1.         A field
  2.         A record
  3.         A file
  4.         A key 

A FIELD

A field is an item of stored data. A field could be a name, an address, a city, a State, or a country.

Name Address City State Country
Josephine 7, Accord St Lagos Lagos Nigeria

From the table above:

 Josephine is a field.

  1.         Accord Street is a field

Lagos is a field

Lagos (City) is a field

Nigeria is a field

 A RECORD

A record is a collection of fields that relate to a single entity

For example, we could have a student record that includes fields for the student’s name, address, homeroom, and date of birth.

Example: A complete name and address.

Last name Address Date of birth State  Country 
Godwin 7, Pipeline St Lagos Kaduna Nigeria

A FILE

A file is a collection of related records. For example, a student file might include all of the records of students enrolled at a school.

Admission NO First Name Last name Address Date of birth State  Country 
001 Olaniyi  Titilayo  7, Pipeline St 23/10/2001 Kaduna Nigeria
002 James Matthew 25 Accord St 15/6/1998 Lagos Ghana
003 Goodwill Jonathan 13 Powerline St 06/12/1976 Kano Congo 

 A key field is a field in a data file containing information capable of uniquely identifying a record about all other records in the same data file.

 

Lesson Notes for Other Classes