Structure Query Language or in short form SQL is a database query language usually employed in storing and managing data in Relational DBMS. It is known to be the first commercial language introduced for E.F Codd's Relational model of a database. Currently, all RDBMS including Oracle, MySql, MS Access, Infomix, and Sybase, use SQL as their standard database query language. Structure Query Language is used to perform all types of data operations in RDBMS.
Below you will see how SQL defines different ways you can manipulate data stored in an RDBMS.
Data Definition Language includes changes to the structure of the table such as the creation of a table, altering a table, deleting a table, and so on.
Any command in DDL is auto-committed. This means it saves all the changes permanently in the database.
Command | Description |
---|---|
create | It is used to create new table or database |
alter | It is used for alteration |
truncate | It is used to delete data from table |
drop | It is used to drop a table |
rename | It is used to rename a table |
Data Manipulation Language or DML commands are basically employed in the manipulation of data stored in the table and not the table itself.
The command in DML is not auto-committed. That its changes are not permanent to the database but can be rolled back.
Command | Description |
---|---|
insert | It is used to insert a new row |
update | It is used to update an existing row |
delete | It is used to delete a row |
merge | It is used to merge two rows or two tables |
The commands in Transaction Control Language are used to keep a check on other commands and what they do on the database. TCL commands can cancel or annul changes made by other commands by rolling the data back to its original state. They can also be used to make a temporary change permanent.
Command | Description |
---|---|
commit | It is used to permanently save |
rollback | It is used to undo the change |
savepoint | It is used to save temporarily |
The commands in DCL are typically used to grant and take back authority from any database user.
Command | Description |
---|---|
grant | It is used to grant permission for right |
revoke | It is used to take back permission. |
The command in Data query language is basically used to fetch data from tables based on conditions that can be easily applied.
Command | Description |
---|---|
select | It is used to retrieve records from one or more table |