What is SQL?
SQL (Structured Query Language) is the standard language used to create, retrieve, update, and manage data in relational databases. SQL was developed by IBM in the 1970s and is supported by most Database Management Systems such as MySQL, Oracle, SQL Server, and PostgreSQL.
Features of SQL
- Simple and easy to learn
- Standard database language
- Supports data retrieval and manipulation
- Supports security and access control
- Works with all major RDBMS
Types of SQL Commands
- DDL (Data Definition Language)
- DML (Data Manipulation Language)
- DQL (Data Query Language)
- DCL (Data Control Language)
- TCL (Transaction Control Language)
DDL (Data Definition Language)
DDL commands are used to create and modify database objects.
- CREATE
- ALTER
- DROP
- TRUNCATE
- RENAME
DML (Data Manipulation Language)
DML commands are used to insert, update, and delete records from tables.
- INSERT
- UPDATE
- DELETE
DQL (Data Query Language)
The SELECT statement is used to retrieve data from one or more tables.
- SELECT
- WHERE
- ORDER BY
- GROUP BY
- HAVING
DCL (Data Control Language)
DCL commands control access to the database.
- GRANT
- REVOKE
TCL (Transaction Control Language)
TCL commands manage transactions in a database.
- COMMIT
- ROLLBACK
- SAVEPOINT
Common SQL Clauses
- WHERE
- ORDER BY
- GROUP BY
- HAVING
- DISTINCT
- LIMIT
Aggregate Functions
- COUNT()
- SUM()
- AVG()
- MIN()
- MAX()
Advantages of SQL
- Easy to use
- Fast data retrieval
- Portable across databases
- Supports security
- Efficient database management
Exam Points
- SQL stands for Structured Query Language.
- DDL defines database objects.
- DML modifies data.
- DQL retrieves data using SELECT.
- DCL controls user permissions.
- TCL manages transactions.