SQL Tutorial – Lesson 1

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.

ℹ️ Full form: SQL = Structured Query Language. It was originally developed at IBM in the 1970s by Donald D. Chamberlin and Raymond F. Boyce and was first called SEQUEL (Structured English Query Language).

✅ 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:

ReasonDetail
🌍 Used everywhereBanking, hospitals, e-commerce, social media, government — almost every software application stores data in a SQL database.
💼 High job demandSQL is consistently one of the top skills listed in data analyst, developer, and DBA job descriptions.
📈 Data analyticsData analysts and data scientists use SQL daily to query, clean, and analyze millions of rows of data.
⚡ Easy to learnSQL reads like plain English. Most beginners can write useful queries within hours of starting.
🔧 Works with all databasesStandard SQL works across MySQL, PostgreSQL, Oracle, SQL Server, and SQLite with minor differences.
🤝 Works with SAPSAP systems store all business data in relational databases. SQL knowledge helps SAP professionals query and troubleshoot data directly.
💡 Did you know? According to Stack Overflow surveys, SQL has been one of the most commonly used programming languages for over a decade. It is used by developers, analysts, DBAs, and even business users to access data.

✅ 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:-

Employees
EmployeeIDNameDepartmentSalaryCity
1ANNIIT10000Mumbai
2POOJAIT9000Pune
3RAJSALES5000Delhi
4SUJANHR8000Pune
5MEENASALES12000Mumbai

Key database concepts every beginner should know:

TermMeaning
TableA collection of related data organised in rows and columns (like a spreadsheet tab)
Row / RecordA single entry in a table (e.g. one employee)
Column / FieldA single attribute of a record (e.g. Name, Salary)
Primary KeyA unique identifier for each row (e.g. EmployeeID)
Foreign KeyA column that links to the primary key of another table
SchemaThe structure/design of the database — all tables, columns and relationships
QueryA SQL statement that retrieves or manipulates data
DBMSDatabase 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:

CategoryFull NameCommandsPurpose
DQLData Query LanguageSELECTRead/retrieve data from tables
DMLData Manipulation LanguageINSERT, UPDATE, DELETEAdd, change, or remove data
DDLData Definition LanguageCREATE, ALTER, DROP, TRUNCATEDefine or modify database structure
DCLData Control LanguageGRANT, REVOKEControl user access and permissions
TCLTransaction Control LanguageCOMMIT, ROLLBACK, SAVEPOINTManage database transactions
💡 As a beginner, focus first on DQL and DML — SELECT, INSERT, UPDATE, and DELETE cover 90% of everyday database work.

✅ 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:-

Result — IT employees
NameSalary
ANNI10000
POOJA9000
ℹ️ Key SELECT clauses: Use 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:-

EmployeeIDNameDepartmentSalaryCity
6VIKRAMIT11000Bangalore
⚠️ Important: Always list the column names explicitly in INSERT statements. Skipping column names only works if you provide values for every column in the exact table order — which changes whenever the table structure is modified.

✅ 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:-

EmployeeIDNameDepartmentSalary
1ANNIIT15000
❌ CRITICAL: Always use WHERE with UPDATE!
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.

❌ CRITICAL: Always use WHERE with DELETE!
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.
💡 DELETE vs TRUNCATE: DELETE removes specific rows based on a condition and can be rolled back in most databases. TRUNCATE removes ALL rows from a table instantly and cannot be rolled back. Use DELETE for selective removal and TRUNCATE only when you want to empty an entire table.

✅ Popular Databases that Use SQL

SQL is the standard language supported by all major relational database systems. Here are the most popular ones:

DatabaseTypeBest ForCost
MySQLOpen source RDBMSWeb apps, WordPress, e-commerceFree
PostgreSQLOpen source RDBMSComplex queries, data analyticsFree
Microsoft SQL ServerCommercial RDBMSEnterprise applications, .NET appsPaid (free Express edition)
Oracle DatabaseCommercial RDBMSLarge enterprise, banking, SAPPaid
SQLiteEmbedded RDBMSMobile apps, local databasesFree
MariaDBOpen source RDBMSMySQL alternative, web appsFree
ℹ️ Best for beginners: Start with MySQL or SQLite. Both are free, easy to install, and widely documented. All standard SQL you learn will work on any of these databases with only minor syntax differences.

✅ SQL vs MySQL – What is the Difference?

This is one of the most common questions from beginners. Here is the clear answer:

FeatureSQLMySQL
What it isA language — the set of commands and syntaxA database management system (DBMS)
Who created itIBM / ISO StandardMySQL AB (now owned by Oracle)
FunctionUsed to write queries and manage dataStores, manages, and serves the data
AnalogyLike the English languageLike a book written in English
Used byMySQL, PostgreSQL, Oracle, SQL Server, SQLiteUsed by WordPress, Facebook, YouTube, and millions of web apps
💡 Simple answer: SQL is the language. MySQL is one of the databases that uses that language. Learning SQL means you can work with MySQL, PostgreSQL, Oracle, and SQL Server — they all understand SQL.

✅ 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

❌ Mistake 1: Running UPDATE or DELETE without a WHERE clause
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.
❌ Mistake 2: Forgetting single quotes around text values
Wrong: WHERE Department = IT
Correct: WHERE Department = 'IT'
Text values must always be wrapped in single quotes. Numbers do not need quotes.
❌ Mistake 3: Using = NULL instead of IS NULL
Wrong: WHERE Email = NULL — always returns 0 rows.
Correct: WHERE Email IS NULL
NULL is not a value and cannot be compared with = or !=.
❌ Mistake 4: Wrong clause order
SQL requires a strict clause order: SELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY → LIMIT. Writing them out of order causes a syntax error.
❌ Mistake 5: Using SELECT * in production
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.

✅ Frequently Asked Questions (FAQ)

What is SQL?
SQL stands for Structured Query Language. It is the standard language used to communicate with relational databases. SQL allows you to create, read, update, and delete data stored in tables. It is used by MySQL, PostgreSQL, Oracle, SQL Server, and SQLite.
Is SQL easy to learn for beginners?
Yes. SQL is considered one of the easiest programming languages to learn because its syntax reads like plain English. Most beginners can write basic SELECT, WHERE, and ORDER BY queries within a few hours of study.
What is SQL used for?
SQL is used to manage and query relational databases. It is used in banking, e-commerce, social media, hospital management, ticket booking, data analytics, and almost every software application that stores structured data.
What are the main SQL commands?
The four main SQL commands are: SELECT (retrieve data), INSERT INTO (add new data), UPDATE (modify existing data), and DELETE (remove data). Additional commands include CREATE TABLE, DROP TABLE, ALTER TABLE, GRANT, and COMMIT.
What databases use SQL?
Popular databases that use SQL include MySQL, PostgreSQL, Microsoft SQL Server, Oracle Database, SQLite, and MariaDB. All support standard SQL with some database-specific extensions and syntax differences.
What is the difference between SQL and MySQL?
SQL is a language — the set of commands and syntax used to interact with databases. MySQL is a database management system (DBMS) that uses SQL as its query language. Other DBMS like PostgreSQL, Oracle, and SQL Server also use SQL.


✍️ About the Author: Pramod Behera

Pramod Behera is a SAP and SQL educator with 10+ years of experience in enterprise software and database systems. He founded LearnToSAP.com to help beginners learn SAP and SQL concepts through clear, practical, real-world examples. His tutorials have helped thousands of students and IT professionals across India and beyond.