SQL
In one line
SQL (Structured Query Language) is the language used to create, read, update, and delete data in relational databases.
In simple words
SQL (Structured Query Language) is the standard language for working with relational databases. You use it to create tables, insert data, query data, update records, and manage the database structure.
SQL has several categories of commands:
- DDL (Data Definition Language):
CREATE,ALTER,DROP— define structure. - DML (Data Manipulation Language):
INSERT,UPDATE,DELETE— modify data. - DQL (Data Query Language):
SELECT— read data. - DCL (Data Control Language):
GRANT,REVOKE— manage permissions.
SQL is declarative — you describe *what* you want, not *how* to get it. The database engine figures out the most efficient execution plan.
Example
sql
-- DDL: create a table
CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT);
-- DML: insert data
INSERT INTO users (name) VALUES ('Ada');
-- DQL: query data
SELECT * FROM users WHERE name = 'Ada';Three categories of SQL: defining structure, modifying data, and querying data.
Related terms
Related Resources
Related Lessons
- SQL Basics
Start writing SQL queries.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.