SQL · 31 May 2023

The role of foreign keys in SQL database

5 rules, why we use Foreign Keys in our databases:

 

  1. Relationships establishment - we can create relations between tables, and even inner join relation within one table between two records
  2. Data Integrity - for example, you can create an order with client_id for client which does not exist in the database
  3. Data consistency and accuracy - when foreign key is defined, it restricts the values that can be inserted or updated in the referencing column
  4. Data querying - thanks to the foreign keys we can retrieve data from multiple tables faster and easier
  5. Data maintenance - it helps cascading updates and deletions, preventing locks mechanisms
SQL · 03 Jul 2022

How SQL Indexes work

In this article you will get the knowledge about very important function inside SQL databases.

We will talk about indexes.

Read more