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

  1. You have a question about data
  2. Write a SQL statement describing the result
  3. Database parses and checks the statement
  4. Optimiser picks an execution plan (indexes, join order)
  5. Engine reads tables and builds the result
  6. Rows are returned to you

Syntax

-- SQL is declarative: you describe WHAT you want, not HOW to get it

Example

SELECT * FROM employees;

Key points

SQL topics

Introduction to SQL

Querying Data

Sorting Rows

Limiting Rows

Filtering Rows

Joining Multiple Tables

Grouping Rows

SET Operators

Working with Tables

Modifying Data

Views & Triggers

Conditional Expressions

SQL Subqueries

Aggregate Functions

Window Functions

String Functions

Date Functions

Math Functions

Extra Concepts

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Master SQL from Zero to Pro

All SQL topics in one place. Click any topic in the sidebar — content opens right here without leaving the page.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice SQL Online Solve 150 SQL interview problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

SQL  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
▶ Try It Live — runs against a real sample database
{{ liveError }}
{{ col }}
{{ cell }}
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic