What are flat file and relational databases?
A database is a collection of data, which is organized into files called tables. These tables provide a systematic way of accessing, managing, and updating data. A relational database is one that contains multiple tables of data that relate to each other through special key fields. Relational databases are far more flexible (though harder to design and maintain) than what are known as flat file databases, which contain a single table of data.
To understand the advantages of a relational database, imagine the
needs of two small companies that take customer orders for their
products. Company A uses a flat file database with a single table
orders to record orders they receive, while Company
B uses a relational database with two tables:
When a customer places an order with Company A, a new record (or row)
in the table
orders is created. Because Company A has
only one table of data, all the information pertaining to that order
must be put into a single record. This means that the customer's
general information, such as name and address, is stored in the same
record as the order information, such as product description,
quantity, and price. If customers place more than one order, their
general information will need to be re-entered and thus duplicated for
each order they place.
Whenever there is duplicate data, as in the case above, many
inconsistencies may arise when users try to query the database.
Additionally, a customer's change of address would require the
database manager to find all records in
orders that the
customer placed, and change the address data for each one.
Company B is much better off with its relational database. Each of its
customers has one and only one record of general information stored in
customers. Each customer's record is identified
by a unique customer code which will serve as the relational key. When
a customer orders from Company B, the record in
need contain only a reference to the customer's code, because all of
the customer's general information is already stored in
This approach to entering data solves the problems of duplicate data
and making changes to customer information. The database manager need
change only one record in
customers if someone changes
Last modified on April 24, 2006.