SQL COMMANDS
A DBMS must provide appropriate languages and interfaces for each category of users to express database queries and updates. Database language are used to create and maintain database on computer.
TYPES OF SQL DATA LANGUAGES
A Relational database has following major components are:
- DDL(Data Definition Language.)
- DML(Data Manipulation Language.)
- DCL(Data Control Language.)
- TCL(Transaction Control Language.)
DDL
(DATA DEFINITION LANGUAGE)
DDL stands for DATA DEFINITION LANGUAGE. it is a language that allows the user to define data and their relationship to other types of data. It is mainly used to creates files, Database, data dictonary and tables within Database.
The following tables given an overview about usage od DDL Statements in SQL:
SrNo | DDL Statement | Need and Usage |
---|---|---|
1 | CREATE | Create schema object |
2 | ALTER | Alter schema object |
3 | DROP | Delete schema object |
4 | RENAME | Rename schema object |
DML
(DATA MANIPULATION LANGUAGE)
It is a language that provides a set of operation to supports the basic data manipulation operations on the data held in the database. The part of DML that involves data retrieval ia called a query language.
The following tables given an overview about usage od DML Statements in SQL:
SrNo | DML Statement | Need and Usage |
---|---|---|
1 | DELETE | Removes rows from tables or views |
2 | INSERT | Add new rows of data into table or view |
3 | SELECT | Retrieve data from one or more tables |
4 | UPDATE | Change column values in existing row of a table or view |
DCL
(DATA CONTROL LANGUAGE)
DCL Statements controls access to data and the database using statements such as GRANT(to gave permission) and REVOKE(to back permission).
GRANT: allow specified users to perform specified tasks.
REVOKE: Cancel previously granted or denied permission.
The following tables given an overview about usage od DCL Statements in SQL:
SrNo | DCL Statement | Need and Usage |
---|---|---|
1 | GRANT | Grant and take away priviliges and roles |
2 | REVOKE | Add acomment to the data dictionary |
TCL
(TRANSACTION CONTROL LANGUAGE)
Transaction Control Language commands are used to manage transactions in the database. These are used to manage the changes made by DML Statements.
Examples of TCL Commands:
SrNo | TCL Commands | Need and Usage |
---|---|---|
1 | COMMIT | commit commands is used to permanantly save any transaction into the Database. |
2 | ROLL BACK | This commands restores the database to last commited state. |
3 | SAVEPOINT | Savepoint command is used to temporarily save a transaction so that you can rollback to that point whenever necessary. |