Databases
What is an entity?
An entity is an object of a system which has some data of the system associated with it. In a relational
database each entity can be developed as a table.
Examples:
Product and invoice are entities of a retail store system
Order and Product are entities of a purchasing system
Passenger and Flight are entities of an airline seat reservation system
Student and Class are entities of a student registration system of a school
What is a relational database?
A relational database is a set of tables which are linked through “relationships”.
What is a table?
A table is a set of records about a single entity.
What is a record?
A record is a single instance of an entity and is a row of the table representing that entity. Each record
contains of a set of related fields.
What is a field?
A field is an attribute of an entity and is a column of that table. In a record a field contains a single piece
of data item.
Example:
The table given below represents the entity “Student”. Name, telephone number and date of birth are
attributes of the “Student” entity. Therefore “Name”,“Telephone Number” and “Date of Birth” are fields
of the “Student Details” table.
Student Details Table
Name Telephone Number Date of Birth
John 0112896111 14/03/91
Peter 0112842735 22/06/92
Record
What is a flat file?
If the data of a particular system resides in a single file, such a file is called a flat file. A flat file contains
a set of records, where each record consists of a set of fields. A flat file can be considered as two
dimensional.
What are the problems associated with a flat file?
Suppose that an organization stores its data in the following flat files:
(a) File 1: Contains data about customers such as the customer’s name, gender and address
(maintained by the customer service department)
(b) File 2: Contains data about products and their suppliers (maintained by the purchasing
department)
(c) File 3: Contains data about sales such as the products and quantities sold and names of the
customers who purchased them (maintained by the sales department)
1. Separation and isolation of data – which leads to the inability of running queries to generate
important and useful information
Suppose that the organization needs to find the male customers who have purchased a product
supplied by a particular supplier. This would not be possible because the sales department file
(File 3) does not contain the customer’s gender. If this information is to be found, the names of
the customers’ who purchased that particular product have to be first extracted from the sales
department file (File 3). Then using that set of names, the names of those customers whose
gender is male have to be extracted from the customer service department’s file (File 1). This
is because it is impossible to run a query by joining the two flat files as there is no relationship
exists between the two files which link them.
2. Redundancy of data
Duplication of data wastes time and money involved in data entry. For example, customer’s
name must be entered in the customer services department flat file (File 1) as well as in the
sales department flat file (File 3).
3. Data inconsistency
This means that the same data which appears in two different places has two different values.
This happens as a consequence of data redundancy and it leads to the loss of data integrity. For
LW03751, John, 11 Science A
LW03752, Peter, 11 Science A
LW03753, Edward, 11 Commerce A
LW03754, Mark, 11 Science B
Field
Record
example, the customer service department might correct wrong spelling of a customer’s name
in their flat file (File 1) but sales department may not do that correction in their file (file 3).
Advantages ofusing a relational database
1. Can minimize data redundancy through normalization
2. Data is consistent because the tables are normalized and one field appears only at one place in
the database. Therefore the data has to be updated only at one place in the database.
3. Data is shared throughout the organization because the database can be implemented as a
centraldatabase by installing it in a database server.
4. Improved data security through the implementation of a centralized database
5. Can execute complex queries involving multiple tables
6. Can enforce standards at departmental, organizational, national and international level
7. Can economize on size through centralization and using one very large computer with dumb
terminals or a network of computers.
8. Improved data accessibility because the data is shared
9. Increased productivity through the data handling processes of the database management
system

Databases

  • 1.
    Databases What is anentity? An entity is an object of a system which has some data of the system associated with it. In a relational database each entity can be developed as a table. Examples: Product and invoice are entities of a retail store system Order and Product are entities of a purchasing system Passenger and Flight are entities of an airline seat reservation system Student and Class are entities of a student registration system of a school What is a relational database? A relational database is a set of tables which are linked through “relationships”. What is a table? A table is a set of records about a single entity. What is a record? A record is a single instance of an entity and is a row of the table representing that entity. Each record contains of a set of related fields. What is a field? A field is an attribute of an entity and is a column of that table. In a record a field contains a single piece of data item. Example: The table given below represents the entity “Student”. Name, telephone number and date of birth are attributes of the “Student” entity. Therefore “Name”,“Telephone Number” and “Date of Birth” are fields of the “Student Details” table. Student Details Table Name Telephone Number Date of Birth John 0112896111 14/03/91 Peter 0112842735 22/06/92 Record
  • 2.
    What is aflat file? If the data of a particular system resides in a single file, such a file is called a flat file. A flat file contains a set of records, where each record consists of a set of fields. A flat file can be considered as two dimensional. What are the problems associated with a flat file? Suppose that an organization stores its data in the following flat files: (a) File 1: Contains data about customers such as the customer’s name, gender and address (maintained by the customer service department) (b) File 2: Contains data about products and their suppliers (maintained by the purchasing department) (c) File 3: Contains data about sales such as the products and quantities sold and names of the customers who purchased them (maintained by the sales department) 1. Separation and isolation of data – which leads to the inability of running queries to generate important and useful information Suppose that the organization needs to find the male customers who have purchased a product supplied by a particular supplier. This would not be possible because the sales department file (File 3) does not contain the customer’s gender. If this information is to be found, the names of the customers’ who purchased that particular product have to be first extracted from the sales department file (File 3). Then using that set of names, the names of those customers whose gender is male have to be extracted from the customer service department’s file (File 1). This is because it is impossible to run a query by joining the two flat files as there is no relationship exists between the two files which link them. 2. Redundancy of data Duplication of data wastes time and money involved in data entry. For example, customer’s name must be entered in the customer services department flat file (File 1) as well as in the sales department flat file (File 3). 3. Data inconsistency This means that the same data which appears in two different places has two different values. This happens as a consequence of data redundancy and it leads to the loss of data integrity. For LW03751, John, 11 Science A LW03752, Peter, 11 Science A LW03753, Edward, 11 Commerce A LW03754, Mark, 11 Science B Field Record
  • 3.
    example, the customerservice department might correct wrong spelling of a customer’s name in their flat file (File 1) but sales department may not do that correction in their file (file 3). Advantages ofusing a relational database 1. Can minimize data redundancy through normalization 2. Data is consistent because the tables are normalized and one field appears only at one place in the database. Therefore the data has to be updated only at one place in the database. 3. Data is shared throughout the organization because the database can be implemented as a centraldatabase by installing it in a database server. 4. Improved data security through the implementation of a centralized database 5. Can execute complex queries involving multiple tables 6. Can enforce standards at departmental, organizational, national and international level 7. Can economize on size through centralization and using one very large computer with dumb terminals or a network of computers. 8. Improved data accessibility because the data is shared 9. Increased productivity through the data handling processes of the database management system