Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Structuring Data ๐Ÿ“

Learning Goals

By the end of this section you will:

  • understand the features and limitations of flat file databases

  • understand the features of relational databases

  • understand the impacts of redundancy

  • understand the process of normalisation through 1NF, 2NF and 3NF

Database Typesยถ

Flat File Databasesยถ

A flat file database is a type of database that stores data in a simple, two-dimensional table or spreadsheet-like structure. In a flat file database, information is organized into rows and columns, where each row represents a single record or entry, and each column represents a specific attribute or field of that record.

Unlike more complex relational databases, flat file databases do not have multiple tables with predefined relationships between them. Instead, all data is stored in a single file, making it easy to create and manage but limited in terms of its ability to handle complex data relationships.

Flat file databases are often used for relatively small-scale data storage needs, such as simple lists, address books, or basic inventory records. They are easy to create and understand but may not be suitable for more complex and data-intensive applications.


Relational Databasesยถ

A relational database is a type of database that organizes and stores data in a structured manner, using a collection of tables with predefined relationships between them. It is based on the principles of relational algebra and was introduced by Edgar F. Codd in the 1970s.

In a relational database, data is organized into tables, where each table represents a specific entity or concept, and each row in the table represents a unique record or instance of that entity. Columns in the table represent attributes or characteristics of the entity.

The key features of relational databases include:

Relational databases are widely used in various applications, from business systems to web applications, due to their ability to handle structured data and complex relationships efficiently. Popular relational database management systems (RDBMS) include MySQL, PostgreSQL, Oracle, SQL Server, and SQLite.


Normalisation ๐Ÿ“ยถ

Normalization is a database design technique that reduces data redundancy and eliminates undesirable characteristics like Insertion, Update and Deletion Anomalies. Normalization rules divides larger tables into smaller tables and links them using relationships. The purpose of Normalisation ... is to eliminate richardpeterson_2019_what

Data redundancy is undesirable because it results in:

The process of Normalisation is the the most effective way of removing redundancy.

First Normal Form (1NF)ยถ

A database is in 1st Normal Form when :

1NF Example

The table below is not in 1NF:

1NF before

ย 

The tables below represent the same data in 1NF:

1NF after

Second Normal Form (2NF)ยถ

A database is in 2nd Normal Form when:

2NF Example

The table below is not in 2NF:

2NF before

The tables below represent the same data in 2NF

2NF after

Third Normal Formยถ

A database is in 3rd Normal Form when:

3NF Example

The table below is not in 3NF:

3NF before

The tables below represent the same data in 3NF 3NF after