Relational Databases

Tables, Records & Fields


A table is a collection of records. Each record is made of fields.

Each field has a data type such as String/Text, Integer, Float/Real, Boolean, Date & Time, etc.

A table is a collection of records. Each record is made of fields.

A table is a collection of records. Each record is made of fields.

Primary Keys, Foreign Keys & Relationships

Database-Primary-KeyThe primary key is a unique identifier for each record.
e.g. the candidate number field is a primary key in the student table.

When a primary key is used to link records between two tables, it becomes a foreign key in the linked table.

Relational-Database-RelationshipsThere are 3 types of relationships to link tables:

  • One-to-One Relationships,
  • One-to-Many Relationships,
  • Many-to-Many Relationships.

Entity Relationship Diagram (ERD)


En Entity Relationship Diagram is used to represent all the entities/tables with their attributes/fields and the relationships between these entities.

Database-Entity-Relationship-Diagram

SQL Language

SQL stands for Structured Query Language. SQL is a standard language used to query a relational database. SQL can be used to:

  • SELECT records from one or more tables
  • INSERT new records into a table
  • UPDATE records from a table
  • DELETE records from a table

The basic syntax of the SQL language is as follows:
Database-SQL-Syntax

SQL can also be used to change the structure of a database e.g. creating, editing or dropping tables and indexes.

SQL
Learn how to define your own SQL queries

To recap…

fields
integer
table
records
primary
Boolean
data type
foreign
linked table
identifier
A is a collection of .
Each record is made of


Each field has a such as string/text, , real/float, , date & time, etc.


The key is a unique for each record.

e.g. the candidate number field is a primary key in the student table.


When a primary key is used to link records between two tables, it becomes a key in the .

Share Button
Tagged with: