SQL (Structured Query Language) is a language of accessing data from a database. You can write SQL queries within’ a RDBMS – Relational Database Management System. Here are some popular RDBMS: MySQL, Oracle SQL, PostgreSQL, SQLite, Microsoft Access, IBM DB2.

Relational databases are used to store structured data sets as records in tables. This article will explain SQL basics.

This is how data is stored inside a database. Example of a table “Users”:

id name email age
1 Bob [email protected] 21
2 Susan [email protected] 35
3 Mark [email protected] 26

Each time we request information the database will return it as a result table. To access data we should use a Select-query in format: SELECT column1, column2, … , column n FROM table_name;


This line will fetch all records from a table. It consists of 2 keywords: Select and From.

SELECT represents the command type. Now database knows that you want to retrieve data (not to insert / delete);

“ * ” symbol tells the database that we want to see all User’s columns (id, name, email, age) in a result table. If you want to retrieve just user’s name and email use “SELECT name, email FROM Users;”.

FROM keyword is used to specify the table that we need to manipulate.

And don’t forget to put a semicolon in the end of a query.

Now we can get more specific data. Let’s get only users that are older than 25.

SELECT * FROM Users WHERE age > 25;

It will return this result table:

id name email age
2 Susan [email protected] 35
3 Mark [email protected] 26


To insert a new data record to a table we use an INSERT command:

INSERT INTO table_name (column1, column2, column3) VALUES (value1, value2, value3);

Updating data:

UPDATE TABLE table_name SET column1 = new_value1, column2 = new_value2 WHERE condition;

To delete records:

DELETE FROM table_name WHERE condition;

Don’t forget to specify a WHERE statement because otherwise it will delete all records from a table.

So know yo learned SQL basics. Don’t forget to practice your skills!

Leave A Comment