SQL Commands

SQL Commands
This is a kind of instructions used to communicate with the database. By using sql commands, we can execute set of tasks on a database.

Types of sql commands

DDL - DDL stands for Data Definition Language. This command is used to change schema/structure of a table. These commands can not be roll back.

Example:
1. Create - This command is used to create table or database.
2. Alter - This command is used to update schema in a database.
3. Drop - This command is used to delete schema in a database.
4. Truncate - This command is used to delete rows from the table.

DML - DML stands for Data Manipulation Language. This command is used to modify the database. These commands can be roll back.

Example:
1. Insert - This command is used to insert data into database.
2. Update - This command is used to update data in a database.
3. Delete - This command is used to delete data in a database.

DCL - DCL stands for Data Control Language. This command is used to change permissions of a database user.

Example:
1. Grant - This command is used to give access to the user for the database.
2. Revoke - This command is used to take back permissions from the user.

TCL - TCL stands for Transaction Control Language. This command is used to save changes to the database. It can be only used with DML commands.

Example:
1. Commit - This command is used to save transactions to the database.
2. Rollback - This command is used to undo transactions that have not been saved to the database.
3. Savepoint - This command is used to create checkpoint to a certain point.

DQL - DQL stands for Data Query Language. This command is used to fetch data from the database.

Example:
1. Select - This command is used to fetch data from database.

Comments

Popular posts from this blog

SQL

SQL Examples