SQL stands for Structural Query Language. SQL language we use for the different database-related operations. Using this language we can create a new database or modify the existing Database. SQL contains commands like DDL, DQL, DML, DCL, and TCL.
In this article, we are going to check more details about these commands.
SQL Commands are following
- Data Defination Langauge (DDL)
- Data Query Langauge (DQL)
- Data Manupulation Language (DML)
- Data Control Language (DCL)
- Transaction Control Language (TCL)
Data Defination Langauge(DDL):
DDL consist of SQL commands that are used to define the database schema, structure of the data stored in tables. DDL is again divided into categories.
- CREATE : Used to create the objects like Table, functions, stored procedure etc
- ALTER: Used to modify the structure of the existing tables
- DROP: Used to delete objects from database
- TRUNCATE: Used to removed the records from table and it retains the identity
- COMMENT: Used to add the comments
- RENAME: Used to rename the existing objects
Data Query Langauge(DQL)
DQL is used the perform the query operation on the database within the schema.
SELECT: is used to fetch the records from objects example- tables
Data Manupulation Language(DML)
DML is used for the manipulation of data that is present in the database. It is responsible for all forms of changes in the database.
- INSERT: SQL statement is use for to insert the record into table
- UPDATE: Is used to update the table rows or table records.
- DELETE: Statement is use for to delete the records from table.
Data Control Language(DCL)
DCL commands are used for permission and access-related operation. If we want to work with access-related stuff then we need to use DCL commands. DCL commands having two categories
- GRANT: Giving user access permisson to the database.
- REVOKE: Withdraw or take back the permission from the user so user can’t access the perticular database.
Transaction Control Language(TCL)
TCL is used to manage the transaction in the database. TCL can only use with DML commands(Insert, Update, Delete) only.
- COMMIT: Commit the transaction, It saves the transaction in the database.
- ROLLBACK: Undo the transaction, not saved in database
- SAVEPOINT: Point in transaction in which we can roll back the transaction to a certain point instead of entire transaction.
Need help?
Read this post again, if you have any confusion or else add your questions in Community