Introduction to Databases and SQL

Introduction to Databases

A database is an organized collection of data.


Types of Databases

In general, there are two common types of databases:

  • Non-Relational
  • Relational

Non-Relational Database

In a non-relational database, data is stored in key-value pairs. For example:

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

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

Commonly used non-relational database management systems (Non-RDBMS) are MongoDB, Amazon DynamoDB, Redis, etc.


Relational Database

In a relational database, 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 a relational database, two or more tables may be related to each other. Hence the term Relational. For example,

How tables are related in Relational Databases?
Example: Relational Database

Here, orders and customers are related through customer_id.

Commonly used relational database management systems (RDBMS) are 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 perform CRUD operations:

  • Create: create databases or tables in a database
  • Read: read data from a table
  • Update: insert or update data in a table
  • Delete: delete tables, databases or table from a table

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 using the SQL SELECT statement.

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.


Also Read:

Did you find this article helpful?