Introduction to Databases and SQL

In this tutorial, we'll learn about databases, different types of databases and their uses.

A database is an organized collection of data so that it can be easily accessed. To manage these databases, Database Management Systems (DBMS) are used.

Types of DBMS

In general, there are two common types of databases:

  • Non-Relational
  • Relational

Non-Relational Database Management System (Non-RDBMS)

In Non-RDBMS, data is stored in key-value pairs. For example:

How data is stored in Non-RDBMS?
Example: Data stored in Non-RDBMS

Here, customers' data are stored in key-value pairs.

Commonly used Non-RDBMS: MongoDB, Amazon DynamoDB, Redis, etc.

Relational Database Management System (RDBMS)

In RDBMS, data is stored in tabular format. For example,

How is data stored in a database system?
Example: Relational Database

Here, customers is a table inside the database.

The first row is the attributes of the table. Each row after that contains the data of a customer.

In RDBMS, two or more tables may be related to each other. Hence the term "Relational". For example,

How tables are related in Relational Databases?
Example: Relationship in RDBMS

Here, orders and customers are related through customer_id.

Commonly used RDBMS: MySQL, PostgreSQL, MSSQL, Oracle etc.

Note: To access data from these relational databases, SQL (Structured Query Language) is used.

Introduction to SQL

Structured Query Language (SQL) is a standard query language that is used to work with relational databases.

We use SQL to

  • create databases
  • create tables in a database
  • read data from a table
  • insert data in a table
  • update data in a table
  • delete data from a table
  • delete database tables
  • delete databases
  • and many more database operations

SQL Example: Read Data From a Table

Let's take a look at an example,

SELECT first_name, last_name FROM Customers;

Here, this SQL command selects the first name and last name of all customers from the customers table.

How to select columns in SQL?
Example: SQL SELECT Statement

SQL is used in all relational databases such as MySQL, Oracle, MSSQL, PostgreSQL etc.

Note: The major SQL commands are similar in all relational databases. However, in some cases, SQL commands may differ.

In this SQL tutorial series, we will learn about SQL in detail. We will cover any SQL command differences among MySQL, Oracle, SQL Server, Postgres, and other commonly used database systems.

Did you find this article helpful?