relational database fundamentals

Relational database fundamentals

As a beginner working in relational databases, there are some key concepts and fundamentals to understand. These are the things I found most useful when getting started querying databases. Before you get going with writing SQL queries make sure you have a good grasp of theses basics.

The Relational Model

Data is organised in rows and columns stored in tables.

Databases hold a collection of data stored in tables.

Relationship Categories in Databases

one-to-one: one husband and one wife

many-to-one: many students and one school

one-to-many: one customer and many bank accounts

many-to-many: many students and many teachers

Primary Key v Foreign Key

To make the most of the database we need to abide by rules to keep data clean, and organised. If we don’t we may as well be storing expensive spreadsheets,

To help do this we can use a Primary Key. This is a column that best identifies one unique row, and identifies each record as unique, like an ID.

  • It ensures that there are no duplicates.
  • There can only be one primary key per table.
  • It cannot be unknown (NULL).
  • A foreign key is a column that matches a primary key in another table.

SQL Statements

SQL is a standardised language for querying, manipulating and modifying relational databases. The basic SQL statements used to transform the data into more segmented tables fall into four main groups.

Retrieve data with SELECT

Add new data with INSERT

Remove data with DELETE

Modify data with UPDATE

There are plenty of new concepts to get your head around with writing SQL and understanding the structure of a database. These are the relational database fundamentals I feel are important for complete beginners.

Photo by Jeffrey Czum from Pexels

Comments are closed, but trackbacks and pingbacks are open.