SQL (Structured Query Language) is the language used to create and manage relational databases. These databases store information in a table model with fields and IDs (identificators).

Example of an SQL Database Schema:

Untitled

The advantage of SQL over NoSQL (non-relational) is the presence of rules (constraints) that will limit the way data is stored in our database.

Constraints

Entities

Objects or life forms in the real world represented in a table. Each entity has its own properties (columns). Example:

Entity: Person
Properties: Name, Height, Weight, Age, etc.

Table Connection

1:1 (One-to-One)

One line in Table_A is a reference to another line in Table_B. Example:

| Table A | Table B |
| id_a    |         |
| id_b    < id_b    |
# id_b is present in both Tables. It is a 1:1 relationship.

1:N (One-to-Many)

One line in Table_A is referenced to another line in Table_B. Table_B can contain N lines from Table_A. Example: