Signup/Sign In

Introduction to SQL

Structure Query Language(SQL) is a database query language used for storing and managing data in Relational DBMS. SQL was the first commercial language introduced for E.F Codd's Relational model of database. Today almost all RDBMS(MySql, Oracle, Infomix, Sybase, MS Access) use SQL as the standard database query language. SQL is used to perform all types of data operations in RDBMS.

SQL Command

SQL defines following ways to manipulate data stored in an RDBMS.

DDL: Data Definition Language

This includes changes to the structure of the table like creation of table, altering table, deleting a table etc.

All DDL commands are auto-committed. That means it saves all the changes permanently in the database.

createto create new table or database
alterfor alteration
truncatedelete data from table
dropto drop a table
renameto rename a table

DML: Data Manipulation Language

DML commands are used for manipulating the data stored in the table and not the table itself.

DML commands are not auto-committed. It means changes are not permanent to database, they can be rolled back.

insertto insert a new row
updateto update existing row
deleteto delete a row
mergemerging two rows or two tables

TCL: Transaction Control Language

These commands are to keep a check on other commands and their affect on the database. These commands can annul changes made by other commands by rolling the data back to its original state. It can also make any temporary change permanent.

committo permanently save
rollbackto undo change
savepointto save temporarily

DCL: Data Control Language

Data control language are the commands to grant and take back authority from any database user.

grantgrant permission of right
revoketake back permission.

DQL: Data Query Language

Data query language is used to fetch data from tables based on conditions that we can easily apply.

selectretrieve records from one or more table