Skip to content
C

SQL Overview


SQL Overview

Definition

SQL (Structured Query Language) is the standard language used to define, manipulate, and query data stored in a relational database. Unlike a general-purpose language such as Java or Python, SQL is declarative: you state what result you want, and the database engine's query optimizer decides how to get it (which indexes to use, which join order, and so on).

How It Works

SQL is really four sub-languages bundled under one name, each covering a different job:

  • DDL (Data Definition Language) — CREATE, ALTER, DROP: defines the structure (tables, columns, constraints).
  • DML (Data Manipulation Language) — INSERT, UPDATE, DELETE: changes the data inside that structure.
  • DQL (Data Query Language) — SELECT: reads data back out.
  • DCL / TCLGRANT/REVOKE and COMMIT/ROLLBACK: control permissions and transaction boundaries.

Example: a college portal uses DDL once to create the students table, DML every time a new student registers or updates their address, DQL every time a result or a dashboard is displayed, and TCL to make sure a fee payment and its receipt are recorded together or not at all.

Edge Cases and Pitfalls

  • SQL is declarative, so two people can write very different-looking queries that return the same result — but with very different performance. "Correct" and "fast" are separate questions.
  • SQL keywords are case-insensitive (SELECT = select), but string data usually is not ('Asha' <> 'asha' in most default collations).
  • A missing semicolon at the end of a statement is harmless in a single-statement script but will merge two statements together in a multi-statement script, which can silently change meaning.

Key Takeaways

  • SQL = DDL + DML + DQL + DCL/TCL, one language for structure, data, retrieval, and control.
  • Declarative means "what," not "how" — the engine chooses the execution plan.
  • The same SQL statement type recurs across nearly every relational database product, which is why learning SQL transfers so well between MySQL, PostgreSQL, SQL Server, and Oracle.

Mock Test

  • SQL Overview - Quick Test

    8 questions on SQL Overview.

    8 questions · 8 min · Medium
    Start Mock Test