What is SQL?
SQL (Structured Query Language) is a standard programming language used for managing and manipulating relational databases. It allows users to store, retrieve, update, and delete data efficiently.
SQL is used in almost every relational database system including MySQL, PostgreSQL, Oracle, Microsoft SQL Server, and SQLite.
History of SQL
- Developed by IBM in the early 1970s as SEQUEL (Structured English Query Language).
- Renamed to SQL and standardized by ANSI (American National Standards Institute) in 1986.
- Adopted widely in RDBMS systems and continues to evolve.
Key Features of SQL
- Data Querying: Retrieve data using SELECT statements.
- Data Manipulation: INSERT, UPDATE, DELETE records.
- Data Definition: CREATE, ALTER, DROP tables and databases.
- Data Control: Manage access using GRANT and REVOKE.
- Transaction Control: COMMIT, ROLLBACK, and SAVEPOINT for database transactions.
Types of SQL Commands
- DQL (Data Query Language): SELECT
- DML (Data Manipulation Language): INSERT, UPDATE, DELETE
- DDL (Data Definition Language): CREATE, ALTER, DROP
- DCL (Data Control Language): GRANT, REVOKE
- TCL (Transaction Control Language): COMMIT, ROLLBACK, SAVEPOINT
Basic SQL Syntax
-- Select all rows from a table
SELECT * FROM employees;
-- Insert a new row
INSERT INTO employees (name, age, department) VALUES ('John Doe', 30, 'Sales');
-- Update a row
UPDATE employees SET age = 31 WHERE name = 'John Doe';
-- Delete a row
DELETE FROM employees WHERE name = 'John Doe';
SQL in Real-World Applications
- Used by websites and apps to interact with user data.
- Powering backend systems of e-commerce, banking, CRM, and healthcare.
- Data analysis and reporting in BI tools.


