SQL stands for Structured Query Language. SQL is a computer language for accessing databases. It is used to store, manipulate and retrieve the data stored in a database.
SQL Commands are the instructions which are used to interact with the database to perform a specific task.
SQL Commands categories:
1. DDL (Data Definition Language):
DDL commands are used to define the structure of database objects.
1. CREATE – It is used to create database objects like table, view etc.
2. ALTER – It is used to alter the structure of the existing database object.
3. DROP – It is used to delete the existing objects from the database.
4. TRUNCATE – It remove all records from a table, including all spaces allocated for the records will be removed.
5. RENAME – It is used to rename an existing database object.
2. DML (Data Manipulation Language):
1. SELECT – It is used to retrieve the records from the database.
2. INSERT – It is used to create a record.
3. UPDATE – It is used to modify an existing record.
4. DELETE – It is used to delete all records from a table, the space for the records remain.
5. MERGE- It is used to insert or update a record.
6. CALL – call a PL/SQL or Java subprogram.
7. LOCK TABLE – It is used to control concurrency.
3. DCL (Data Control Language):
1. GRANT – It gives privileges to user.
2. REVOKE – It withdraw access privileges from a user given with the GRANT command.
4. TCL (Transaction Control):
1. COMMIT – It is used to save the work done.
2. SAVEPOINT – It is used to identify a point in a transaction to which you can roll back later.
3. ROLLBACK – It is used to restore the database to original since the last COMMIT.