SQL SERVER - DML, DDL, DCL and TCL Introduction
/****************************************************************************************************************************/
DDL
DDL is the abbreviation of Data Definition Language, It is used to create , modify and drop the Database objects.
Examples : CREATE, ALTER, DROP statements
Let we consider the Database objects : Table,View
Table
CREATE TABLE Emploee
(
id int identity(1,1),
name varchar(40) ,
age int
)
In the above example, we are creating a table and save the object to database. Table have columns id,name,age which are in data type int,varchar(40),int . Column id set a Identity that means each value in that column in unique starts with 1 and increment by 1 so we don't need to insert the value for this column . value is automatically inserted by Sql Server. varchar datatype is representing the string type with 40 length
ALTER TABLE Employee
ALTER address varchar(100)
In the above example, additional column address is added to the existing table Employee . Column address is defined as varchar(100)
DROP TABLE Employee
In the above example, Employee table is dropped from database
/****************************************************************************************************************************/
DML
DML is the abbreviation of Data Manipultation Language, It is used to insert, delete, update the Data which is stored in database
Examples : SELECT, UPDATE, INSERT statements
INSERT into Employee(name,age) values('Rajesh',23)
SELECT id,name From Employee
Update Employee
set name = 'Rajesh Kumar',
age = '24'
Where id =1
/*****************************************************************************************************************************/
DCL
DCL is the abbreviation of Data Control Language , It is used to create roles, Permission
Examples : GRANT, REVOKE
Grant exec on stored_procedure to public
/******************************************************************************************************************************/
TCL
TCL is the abbreviation of Transactional Control Language,It is used to manage the transactions takes place in database.
Example COMMIT, ROLLBACK
/*****************************************************************************************************************************/
/****************************************************************************************************************************/
DDL
DDL is the abbreviation of Data Definition Language, It is used to create , modify and drop the Database objects.
Examples : CREATE, ALTER, DROP statements
Let we consider the Database objects : Table,View
Table
CREATE TABLE Emploee
(
id int identity(1,1),
name varchar(40) ,
age int
)
In the above example, we are creating a table and save the object to database. Table have columns id,name,age which are in data type int,varchar(40),int . Column id set a Identity that means each value in that column in unique starts with 1 and increment by 1 so we don't need to insert the value for this column . value is automatically inserted by Sql Server. varchar datatype is representing the string type with 40 length
ALTER TABLE Employee
ALTER address varchar(100)
In the above example, additional column address is added to the existing table Employee . Column address is defined as varchar(100)
DROP TABLE Employee
In the above example, Employee table is dropped from database
/****************************************************************************************************************************/
DML
DML is the abbreviation of Data Manipultation Language, It is used to insert, delete, update the Data which is stored in database
Examples : SELECT, UPDATE, INSERT statements
INSERT into Employee(name,age) values('Rajesh',23)
SELECT id,name From Employee
Update Employee
set name = 'Rajesh Kumar',
age = '24'
Where id =1
/*****************************************************************************************************************************/
DCL
DCL is the abbreviation of Data Control Language , It is used to create roles, Permission
Examples : GRANT, REVOKE
Grant exec on stored_procedure to public
/******************************************************************************************************************************/
TCL
TCL is the abbreviation of Transactional Control Language,It is used to manage the transactions takes place in database.
Example COMMIT, ROLLBACK
/*****************************************************************************************************************************/
I feel SQL and many other aspects make it more interesting and important to look for many other aspects and solutions.
ReplyDeleteSQL Server Load Soap API