What is SQL
SQL · Introduction to SQL
Theory
SQL (Structured Query Language) is the standard language for working with relational databases such as PostgreSQL, MySQL, SQL Server, Oracle, SQLite and Snowflake. A relational database stores data in tables: each table has named columns with a data type, and each row is one record, like one employee or one order.
SQL is declarative: you describe the result you want ("names of IT employees in Jaipur") and the database engine decides how to fetch it, using indexes and an optimiser. The language is grouped into parts: DDL defines structure (CREATE, ALTER, DROP), DML changes data (INSERT, UPDATE, DELETE), DQL reads data (SELECT), DCL controls access (GRANT, REVOKE) and TCL manages transactions (COMMIT, ROLLBACK).
Why we use it
Almost every company keeps its important data in relational databases or warehouses. SQL is the common language to read, combine and summarise that data without writing loops by hand, and the same core skills carry over between engines.
When to use it
Use SQL whenever your data lives in tables and you need to filter, join, aggregate or change it. For heavy custom logic, ML or charts, you usually pull the SQL result into Python, a BI tool or a notebook and continue there.
How it works
- You have a question about data
- Write a SQL statement describing the result
- Database parses and checks the statement
- Optimiser picks an execution plan (indexes, join order)
- Engine reads tables and builds the result
- Rows are returned to you
Syntax
-- SQL is declarative: you describe WHAT you want, not HOW to get itExample
SELECT * FROM employees;Key points
- Works across nearly every relational database engine
- Split into DDL, DML, DQL, DCL and TCL sub-languages
- Declarative: you say what you want, the engine decides how
- Core standard is shared; each engine adds its own dialect extras
- Foundation skill for analytics, engineering and BI roles