Components of SQL
1 Components of SQL
1. DDL - Data Definition Language:
DDL statements are used to define the database structure or schema. SQL commands which comes under Data Definition Language (DDL) are :
• CREATE – To create objects in the database
• ALTER – Alters the structure of the database
• DROP – Delete objects from the database
• TRUNCATE – Remove all records from a table, also free the space occupied by those records
2. DML – Data Manipulation Language:
DML statements are used for managing data within schema objects. SQL commands which comes under Data Manipulation Language (DML) are :
• INSERT – Insert data into a table
• UPDATE – Updates existing data within a table
• DELETE – Deletes all records from a table, the space occupied will remain
3. DCL – Data Control Language:
DCL statements are used to control access to the data and to the database.
• GRANT – Gives user’s access privileges to database.
• REVOKE – Withdraw access privileges given with the GRANT command.
4. TCL – Transaction Control
TCL statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.
• COMMIT – save the work done.
• SAVEPOINT – it marks a point in a transaction to which you can roll back.
• ROLLBACK – restore database to original since the last COMMIT or SAVEPOINT
5. DQL – Data Query Language
It includes SELECT statement. Using it one can query in database.
• SELECT – It display the records from table.