SQL Tutorial for Beginners – Introduction to SQL with Examples (2026)
SQL (Structured Query Language) is the standard language used to communicate with relational databases. Whether you want to retrieve data, add new records, modify existing data, or delete unwanted rows — SQL is the tool that makes it possible. In this beginner-friendly introduction you will learn what SQL is, why it matters, how databases work, the four core SQL commands (SELECT, INSERT, UPDATE, DELETE), all SQL command categories, popular databases that use SQL, your first SQL query examples, and a complete FAQ — everything you need to start your SQL journey in 2026.
✅ What is SQL?
SQL stands for Structured Query Language. It is a standard programming language specifically designed for storing, retrieving, managing, and manipulating data in a relational database management system (RDBMS).
✅ SQL became an ISO standard in 1987 and is supported by all major databases — MySQL, PostgreSQL, Oracle, Microsoft SQL Server, and SQLite.
✅ SQL uses simple, English-like commands making it one of the easiest languages to learn.
✅ SQL is a declarative language — you tell it what data you want, and the database engine figures out how to get it.
✅ Why Learn SQL in 2026?
SQL is one of the most in-demand skills in the technology industry. Here is why every developer, analyst, and data professional should learn SQL:
| Reason | Detail |
|---|---|
| 🌍 Used everywhere | Banking, hospitals, e-commerce, social media, government — almost every software application stores data in a SQL database. |
| 💼 High job demand | SQL is consistently one of the top skills listed in data analyst, developer, and DBA job descriptions. |
| 📈 Data analytics | Data analysts and data scientists use SQL daily to query, clean, and analyze millions of rows of data. |
| ⚡ Easy to learn | SQL reads like plain English. Most beginners can write useful queries within hours of starting. |
| 🔧 Works with all databases | Standard SQL works across MySQL, PostgreSQL, Oracle, SQL Server, and SQLite with minor differences. |
| 🤝 Works with SAP | SAP systems store all business data in relational databases. SQL knowledge helps SAP professionals query and troubleshoot data directly. |
✅ How Relational Databases Work
A relational database stores data in tables — similar to a spreadsheet — made up of rows and columns. Each table holds data about one type of entity (e.g. Employees, Products, Orders).
✅ Example: Employees Table:-
| EmployeeID | Name | Department | Salary | City |
|---|---|---|---|---|
| 1 | ANNI | IT | 10000 | Mumbai |
| 2 | POOJA | IT | 9000 | Pune |
| 3 | RAJ | SALES | 5000 | Delhi |
| 4 | SUJAN | HR | 8000 | Pune |
| 5 | MEENA | SALES | 12000 | Mumbai |
Key database concepts every beginner should know:
| Term | Meaning |
|---|---|
| Table | A collection of related data organised in rows and columns (like a spreadsheet tab) |
| Row / Record | A single entry in a table (e.g. one employee) |
| Column / Field | A single attribute of a record (e.g. Name, Salary) |
| Primary Key | A unique identifier for each row (e.g. EmployeeID) |
| Foreign Key | A column that links to the primary key of another table |
| Schema | The structure/design of the database — all tables, columns and relationships |
| Query | A SQL statement that retrieves or manipulates data |
| DBMS | Database Management System — the software that manages the database (e.g. MySQL, Oracle) |
✅ SQL Command Categories
SQL commands are grouped into five categories based on what they do:
| Category | Full Name | Commands | Purpose |
|---|---|---|---|
| DQL | Data Query Language | SELECT | Read/retrieve data from tables |
| DML | Data Manipulation Language | INSERT, UPDATE, DELETE | Add, change, or remove data |
| DDL | Data Definition Language | CREATE, ALTER, DROP, TRUNCATE | Define or modify database structure |
| DCL | Data Control Language | GRANT, REVOKE | Control user access and permissions |
| TCL | Transaction Control Language | COMMIT, ROLLBACK, SAVEPOINT | Manage database transactions |
✅ SQL SELECT – Read / Retrieve Data
The SELECT statement is the most used SQL command. It retrieves data from one or more tables. See our complete SQL SELECT guide for full details.
✅ Syntax:-
SELECT column1, column2 FROM table_name
WHERE condition;
✅ Example – Get all employees:-
SELECT * FROM Employees;
✅ Example – Get IT department employees only:-
SELECT Name, Salary FROM Employees
WHERE Department = 'IT';
✅ Result:-
| Name | Salary |
|---|---|
| ANNI | 10000 |
| POOJA | 9000 |
WHERE to filter rows, ORDER BY to sort, GROUP BY to group, LIMIT to restrict number of rows returned, and DISTINCT to get unique values.
✅ SQL INSERT INTO – Add New Data
The INSERT INTO statement adds a new row of data into a table.
✅ Syntax:-
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);
✅ Example – Add a new employee:-
INSERT INTO Employees (EmployeeID, Name, Department, Salary, City)
VALUES (6, 'VIKRAM', 'IT', 11000, 'Bangalore');
✅ Result – A new row is added to the Employees table:-
| EmployeeID | Name | Department | Salary | City |
|---|---|---|---|---|
| 6 | VIKRAM | IT | 11000 | Bangalore |
✅ SQL UPDATE – Modify Existing Data
The UPDATE statement changes the values of existing rows in a table.
✅ Syntax:-
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
✅ Example – Give ANNI a salary raise:-
UPDATE Employees
SET Salary = 15000
WHERE Name = 'ANNI';
✅ Result – ANNI's salary is now updated to 15000:-
| EmployeeID | Name | Department | Salary |
|---|---|---|---|
| 1 | ANNI | IT | 15000 |
UPDATE Employees SET Salary = 15000; — with NO WHERE clause, this updates every single employee's salary to 15000. This is one of the most common and costly beginner mistakes. Always include a WHERE condition.
✅ SQL DELETE – Remove Data
The DELETE statement removes one or more rows from a table based on a condition.
✅ Syntax:-
DELETE FROM table_name
WHERE condition;
✅ Example – Remove the employee named RAJ:-
DELETE FROM Employees
WHERE Name = 'RAJ';
✅ Result – RAJ's record is permanently removed from the table.
DELETE FROM Employees; — with NO WHERE clause, this deletes every row in the Employees table. The data is gone permanently unless you have a backup. Always specify a WHERE condition before running DELETE.
✅ Popular Databases that Use SQL
SQL is the standard language supported by all major relational database systems. Here are the most popular ones:
| Database | Type | Best For | Cost |
|---|---|---|---|
| MySQL | Open source RDBMS | Web apps, WordPress, e-commerce | Free |
| PostgreSQL | Open source RDBMS | Complex queries, data analytics | Free |
| Microsoft SQL Server | Commercial RDBMS | Enterprise applications, .NET apps | Paid (free Express edition) |
| Oracle Database | Commercial RDBMS | Large enterprise, banking, SAP | Paid |
| SQLite | Embedded RDBMS | Mobile apps, local databases | Free |
| MariaDB | Open source RDBMS | MySQL alternative, web apps | Free |
✅ SQL vs MySQL – What is the Difference?
This is one of the most common questions from beginners. Here is the clear answer:
| Feature | SQL | MySQL |
|---|---|---|
| What it is | A language — the set of commands and syntax | A database management system (DBMS) |
| Who created it | IBM / ISO Standard | MySQL AB (now owned by Oracle) |
| Function | Used to write queries and manage data | Stores, manages, and serves the data |
| Analogy | Like the English language | Like a book written in English |
| Used by | MySQL, PostgreSQL, Oracle, SQL Server, SQLite | Used by WordPress, Facebook, YouTube, and millions of web apps |
✅ What Can You Do with SQL?
SQL gives you full control over your data. Here is what you can accomplish:
✅ Query data — Retrieve specific rows and columns from large tables using SELECT and WHERE.
✅ Insert data — Add new records to a table using INSERT INTO.
✅ Update data — Modify existing records using UPDATE ... SET.
✅ Delete data — Remove unwanted records using DELETE FROM.
✅ Create databases and tables — Design your data structure using CREATE DATABASE and CREATE TABLE.
✅ Sort and group data — Use ORDER BY to sort and GROUP BY with aggregate functions like COUNT(), SUM(), AVG().
✅ Join tables — Combine data from multiple related tables using JOIN.
✅ Control access — Grant or revoke permissions with GRANT and REVOKE.
✅ Create views — Save frequently used complex queries as reusable VIEWs.
✅ Common SQL Beginner Mistakes to Avoid
This is the most dangerous mistake. Without WHERE, every row in the table is affected. Always double-check your WHERE condition before executing UPDATE or DELETE.
Wrong:
WHERE Department = ITCorrect:
WHERE Department = 'IT'Text values must always be wrapped in single quotes. Numbers do not need quotes.
Wrong:
WHERE Email = NULL — always returns 0 rows.Correct:
WHERE Email IS NULLNULL is not a value and cannot be compared with = or !=.
SQL requires a strict clause order:
SELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY → LIMIT. Writing them out of order causes a syntax error.
SELECT * retrieves every column, which is slow on large tables and wastes bandwidth. Always specify only the columns you actually need: SELECT Name, Salary FROM Employees.