3.2.1

Databases

Test yourself

Records

Structured data refers to any data that resides in a fixed field within a record or file so that it can be easily entered, stored, queried, and analysed.

Illustrative background for RecordsIllustrative background for Records ?? "content

Records

  • Records are made up of fields.
  • For example, a person could be represented as a record where the fields include their name, age, and address.
Illustrative background for Comma separated values (CSV)Illustrative background for Comma separated values (CSV) ?? "content

Comma separated values (CSV)

  • One method of storing a record is using comma separated values.
  • Each record is put on its own line.
  • Each field is separated by a special character such as a comma.
Illustrative background for Pros and consIllustrative background for Pros and cons ?? "content

Pros and cons

  • Pros:
    • Very simple, text-based format.
    • Can be read by many applications.
    • Easy to use in programs.
  • Cons:
    • Inefficient for large datasets.
    • Can only store text data.
    • No built-in means of sorting or searching.

Flat-File Databases

Flat-file databases are used to store records of information in order to be searched or queried at a later date.

Illustrative background for Structure of flat-file databasesIllustrative background for Structure of flat-file databases ?? "content

Structure of flat-file databases

  • A flat-file database is one that has a single table to store data about an 'entity'.
  • The table stores data in fields (columns) such as date of birth.
  • A record (row) of information is a complete set of fields put together.
    • This could be a person's details such as name, address, date of birth, telephone number.
Illustrative background for RedundancyIllustrative background for Redundancy ?? "content

Redundancy

  • Redundant data is data that is repeated in a database.
  • A single table file is inefficient as it is full of redundant data
Illustrative background for Primary keyIllustrative background for Primary key ?? "content

Primary key

  • A primary key is a field used to uniquely identify a specific row of data in a table.
  • For example, each student in a college database will have a student ID number that is unique to each student that can be used as a primary key

Relational Database

A relational database is a set of tables whose records are linked by certain fields.

Illustrative background for Relational databaseIllustrative background for Relational database ?? "content

Relational database

  • A relational database is a set of tables whose records are linked by certain fields.
  • Each table contains data on one entity e.g. students or parents.
  • When you link one table to another, this is known as a relationship.
  • Each table then has a relationship to other tables using primary and foreign keys.
Illustrative background for Foreign keyIllustrative background for Foreign key ?? "content

Foreign key

  • If the primary key of one table is placed into another table, this is then known as a foreign key.
  • For example, when a student ID field is added to a parent table to link you to your parents accounts, that student ID is a primary key in the student table but becomes a foreign key in the family table.
  • The parents table will have its own primary key.
Illustrative background for Secondary keyIllustrative background for Secondary key ?? "content

Secondary key

  • A secondary key may also be kept by the database.
  • A parent may not know their child’s student ID, but they will be able to locate their last name in the database.
  • Secondary keys do not need to be unique.

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Procedurally

6.3Thinking Logically

7Problem Solving & Programming

8Algorithms

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson