Full-stack Web Technologies

CHAPTER 1
Relational Databases

Relational Databases

The most rich and powerful of the database types, with the most complex (and mathematically validated) data model. Relational databases use tables, and relationships between them (usually equating columns in different tables). They need a schema in advance to work with data. But the schema and the underlying technology have been perfected for many years. SQL is standardized, and the most sophisticated query language available.

image

Here is a table describing qualitatively the different aspects of relational databases:

AspectRangeReasons
Performancelow-highDepending on the query, they can be very fast or very slow
ScalabilitylowIt is very difficult to scale relational databases
FlexibilitylowSince they have a schema, many changes require modifying the schema first
ComplexityhighThey are the most powerful of all databases
RecursivitylowDeep recursion can kneel relational databases

Schemas

A schema is a definition for the types stored in a database. It comprises:

  • Tables: the collections of entities stored
  • Columns: the attributes of the entities stored on each table, along with their types.
  • Integrity Constraints: the conditions that the data must always fulfill.

The presence of a schema allows a database to optimize its performance in advance.

image

Joins

A join is an operation in which we ask for data coming from different tables (or collections) and the database engine has to relate entities in one table to entities in another. All of this is done through keys ("foreign keys" in relational databases and "object keys" in document databases).

image