# Introduction to SQL

> SQL (Structured Query Language) is the standard language for interacting with relational databases: creating tables, inserting and updating data, and querying it back out. Almost every relational database speaks a dialect of SQL with a large shared core, and its statements fall into four categories: DDL, DML, DCL and TCL.

Canonical: https://devsunite.com/resources/core-subjects/dbms/introduction-to-sql
Last updated: 2026-11-22

Subject: DBMS · Category: SQL · 3 min read

SQL, Structured Query Language, is the standard language used to interact with relational databases: creating tables, inserting and updating data, and querying it back out. Almost every relational database (PostgreSQL, MySQL, SQL Server, Oracle, SQLite) speaks a dialect of SQL, with a large shared core that works nearly identically across all of them.

## The four broad categories of SQL

1. **DDL (Data Definition Language)**: statements that define the structure of the database itself, `CREATE TABLE`, `ALTER TABLE`, `DROP TABLE`.
2. **DML (Data Manipulation Language)**: statements that read and write actual rows of data, `SELECT`, `INSERT`, `UPDATE`, `DELETE`.
3. **DCL (Data Control Language)**: statements that manage permissions, `GRANT`, `REVOKE`.
4. **TCL (Transaction Control Language)**: statements that manage transaction boundaries, `BEGIN`, `COMMIT`, `ROLLBACK`.

Most day-to-day SQL work, especially for application developers, lives in DML: reading and writing rows.

## A worked example

Creating a simple table and running the four core DML statements against it:

```sql
CREATE TABLE students (
    student_id INT PRIMARY KEY,
    name VARCHAR(100),
    grade INT
);

INSERT INTO students (student_id, name, grade) VALUES (1, 'Aditi', 90);
INSERT INTO students (student_id, name, grade) VALUES (2, 'Rohan', 75);

SELECT name, grade FROM students WHERE grade > 80;
-- returns: Aditi | 90

UPDATE students SET grade = 82 WHERE student_id = 2;

DELETE FROM students WHERE student_id = 1;

SELECT * FROM students;
-- returns: 2 | Rohan | 82
```

Each statement does exactly one clear thing: define the shape of the data, add rows, read rows back with a filter, change a row, and remove a row.

## Where this matters in real systems

Nearly every backend application, regardless of programming language, ultimately talks to a relational database through SQL, whether written by hand or generated by an ORM (Object-Relational Mapper) like Django's ORM, Hibernate, or ActiveRecord. Even when a team never writes raw SQL directly, understanding what statements the ORM is actually generating underneath is essential for debugging slow queries or unexpected results.

## What interviewers actually ask about SQL basics

- **"What does SQL stand for, and what is it used for?"** Structured Query Language, used to define, query, and modify data in a relational database.
- **"What are DDL, DML, DCL, and TCL?"** DDL defines structure (CREATE, ALTER), DML manipulates data (SELECT, INSERT, UPDATE, DELETE), DCL manages permissions (GRANT, REVOKE), TCL manages transactions (COMMIT, ROLLBACK).
- **"Is SQL the same across every database?"** The core is standardized and shared, but each database has its own extensions and quirks (stored procedure syntax, specific functions), so not every statement is portable without changes.
- **"What's the difference between DELETE and DROP?"** DELETE removes rows from a table but keeps the table itself; DROP removes the entire table, structure and all.

## Key takeaways

- SQL is the standard language for defining and working with data in a relational database.
- It splits into DDL (structure), DML (data), DCL (permissions), and TCL (transactions).
- Application developers spend most of their time in DML: SELECT, INSERT, UPDATE, DELETE.
- Most backend applications talk to a database through SQL, whether written directly or generated by an ORM.

## Related

- [Previous: Boyce-Codd Normal Form (BCNF)](https://devsunite.com/resources/core-subjects/dbms/boyce-codd-normal-form-bcnf)
- [Next: SQL Data Types](https://devsunite.com/resources/core-subjects/dbms/sql-datatypes)
- [More in SQL: Basic SQL Commands](https://devsunite.com/resources/core-subjects/dbms/basic-sql-commands)
- [More in SQL: Other SQL Commands](https://devsunite.com/resources/core-subjects/dbms/other-sql-commands)
- [More in SQL: SQL Aggregate Functions](https://devsunite.com/resources/core-subjects/dbms/aggregate-functions)
- [More in SQL: SQL Joins](https://devsunite.com/resources/core-subjects/dbms/sql-joins)
- [More in SQL: SQL Views](https://devsunite.com/resources/core-subjects/dbms/sql-views)
- [More in SQL: SQL Indexes](https://devsunite.com/resources/core-subjects/dbms/sql-indexes)
- [More in SQL: SQL Subqueries](https://devsunite.com/resources/core-subjects/dbms/sql-subqueries)
- [More in SQL: SQL Stored Procedures](https://devsunite.com/resources/core-subjects/dbms/sql-stored-procedures)
- [All 174 DBMS interview questions](https://devsunite.com/resources/core-subjects/dbms)
