DML
DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database.
SELECT – Retrieves data from a table
INSERT –Â Inserts data into a table
UPDATE – Updates existing data into a table
DELETE – Deletes all records from a table
DDL
DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database.
CREATE – Creates objects in the database
ALTER – Alters objects of the database
DROP – Deletes objects of the database
TRUNCATE – Deletes all records from a table and resets table identity to initial value.
DCL
DCL is abbreviation of Data Control Language. It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it.
GRANT – Gives user’s access privileges to database
REVOKE – Withdraws user’s access privileges to database given with the GRANT command
TCL
TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database.
COMMIT – Saves work done in transactions
ROLLBACK – Restores database to original state since the last COMMIT command in transactions
SAVE TRANSACTION – Sets a savepoint within a transaction
Reference : Pinal Dave (https://blog.sqlauthority.com), Original Source
62 Comments. Leave new
The terms DML and DDL are used commonly enough amongst developers trying to get a point across. DCL is something i rarely see outside of books.
BTW, wouldn’t SAVE TRANSACTION also be part of TCL?
What about the BackUP and Restore Command ?
As a web developer, i find that info very intesting and benificail. never heard before.
thanks for nice explanation.
really a wonderful article. The information is very helpful.It cleared many doubts i was having.
hi its a nice description abt sql server .. i want to need more points from this way
hi pinaldave
i want to create a single trigger which monitor the inserted, Updated and Deleted transaction records to my customer table, and the effected datas should be archive to a table with the following tag
if a transaction Inserted TAG= INS
if a transaction updated TAG= UPD
if a Transaction Deleted TAG= DEL
and also should send a notification mail to operator
please help me.
thanks
@Nusrath,
You gave us your requirement which is good, but what is your question. What kind of help you want, please explain in detail and be very specific and provide more information if you want to notify through email on a scheduled basis or every occurrence of event (Insert, update, delete)
~ IM.
thanks for your response Mr. Imran Mohamed
Ok i’ll explain all.
i have a Database call posdb and the database contains following tables
1. customer table contains following columns
([cust_id] ,
[name] ,
[address] ,
[city],
[state],
[zip])
2. customer_archive table contains following columns
([cust_id] ,
[name] ,
[address] ,
[city],
[state],
[zip],
[IID],
[Tdate],
[user])
now my question is
1.how to create a DML trigger to accomplish following requirements.
#if a user delete records on customer table, the deleted records are should be saved on customer_archive Table with IID value = ‘DEL’ and deleted user.
#if a user update records on customer table, the updated records are should be saved on customer_archive Table with IID value = ‘UPD’ and deleted user.
#if a user insert records on customer table, the inserted records are should be saved on customer_archive Table with IID value = ‘INS’and deleted user.
and when the trigger fired notify the operator via email
and i am sorry im not fluent in English
please help me.
Good Notes
Its good and quite simple…
Thanks
quite simple to understand
it,s good……but i export more
Really good 1.. thanx for summing up everything in an easy to understand fashion
really good easy to learning the steps
Hello Sir,
I always your articles and it always help me but now in this article i have little bit confuse because of “Select command”.
1.) if select command comes in DML than which command comes in DQL ?
Second thing is that in most interview normally interviewer always ask one question that “Can we use DML commands in Function ?”
may be its answer is NO.
because we can’t use insert,update,delete command in Function. Now what about in that answer is that wrong ?
Please help me. in this
Hi sir..
Good Day….
I wnated to ask some help from you, could you please give me some example of ddl (data definition language) its our assignment form our class database menagement.
Thank you, God bless…
Hi sir..
Good Day….
I wanted to ask some help from you, could you please give me some example of ddl(data definition language) its our assignment form our class database menagement.
Thank you, God bless…
CREATE, ALTER and DROP statements
Hi lj082024,
you can find ddl queries anywhere over internet, just look for create, truncate, alter, and drop queries, if still you are with doubts then do come back.
I need some examples on TCL,DCL commands with syntax.
hi ,
i need more information on sql & plsql in interview point of view,can u suggest me on which topics i should be more perfect ..
thanku verymuch
Hi,
I have a logical issue which i am trying to solve from a long time but no success. Hopefully you will be able to help me.
The thing is iam trying to move an Excel report to SSRS plateform, The data in excel is populated through formulaes and if the condition doesnt satisfy it return 0 but the same thing doesnt apply in Sql. if the Condition doesnt satisfy it doesnt return anything not even zero and beacuse of which the column is also not reflecting in the report. so is there any logic which you can help me with. if the data for the column is not there will i be able to atleast show the column heading.
Thanks,
Fahim.
Fahim,
What i understood from your question is that you need to return at least something whether you have or not any data for any particular column?
ok, here you can simply go for ISNULL function which returns desired values of the developer if the value is null.
e.g.
Select ISNULL(ABC, “”)
here abc is a column of varchar type datatype. if it has null value then ISNULL function will return a blank which will avoid throwing any exception.
it depends on the columns datatype, if it is varchar, char then use double quotes and if int, double, decimal, float or similar datatypes then can go for 0.
hope that helps!!! Cheers!!!
Sorry, it won’t be a double quotes but single quotes.
hi sir..
can u explain about GRANT command with EXAMPLES..please