Lesson 1: Relational Databases

#What is a Relational Database and Relational Database Management System (RDBMS)?

A database is a collection of any data (this could be a collection of text files, CSVs, a list of names, json blob with customer data)

And there are two common types of databases:

  1. Non-Relational

  2. Relational (where SQL is used)

What makes a database relational?

Relational databases are based on The Relational Model, which in short, is an intuitive, straightforward way of representing data in tables.

Relational databases consist of the following objects:

  1. Each row, also called a record or tuple, contains a unique instance of data, or key, for the categories defined by the columns.

  2. An attribute of a tuple is a column and is defined by both a name and type.

  3. A relation or table is a collection of rows and their attributes. It is comparable to a worksheet in Excel. Importantly, tuples are not ordered in a relation or, to state it alternatively, row order is arbitrary.

  4. Each table has a unique primary key, which identifies the information in a table. The relationship between tables can then be set via the use of foreign keys -- a field in a table that links to the primary key of another table.

  5. A collection of relations or tables is a schema; and can be compared to an Excel workbook with multiple worksheets.

  6. A collection of schemas is a database. A database can be thought of a directory full of Excel files, each with their own set of worksheets.

A relational database is a type of database. It uses a structure that allows us to identify and access data in relation to another piece of data in the database. Often, data in a relational database is organized into tables.

WHAT IS A RELATIONAL DATABASE MANAGEMENT SYSTEM (RDBMS)?

A relational database management system (RDBMS) is a program that allows you to create, update, and administer a relational database. Most relational database management systems use the SQL language to access the database. SQL syntax may differ slightly depending on which RDBMS you are using. Some examples of RDBMSs include MySQL, PostgreSQL, Oracle DB, SQL server, SQLite and Amazon redshift. This course will be based on the PostgreSQL syntax.

Non-Relational Database

In a non-relational database, records are stored in key-value pairs. For example,

Here, Customers is a container inside a non-relational database. The database may contain many containers like Customers.

Inside the Customers container, we have stored information of two customers.

For Customer1

Key
Value

id

1

name

John

age

25

For Customer2

Key
Value

id

2

name

Mary

age

19

Last updated