Problem solve Get help with specific problems with your technologies, process and projects.

What's the difference between DDL and DML?

What's the difference between DDL and DML? Get the answer and see examples of the Data Manipulation Language and Data Definition Language with help from our DBMS expert.

What's the difference between DDL and DML?

To be pedantic, DMLs and DDLs do exist outside of SQL, but I assume you are asking about the components of SQL.

SQL stands for Structured Query Language. In practice, this is really a misnomer. SQL can do much more than query data – indeed, the language splits neatly into two parts. There is the Data Definition Language (DDL) section and the Data Manipulation Language (DML) section. The former is the part of the language that is used for creating (and/or destroying) database objects such as tables.

Here is an example of DDL code:

CREATE TABLE [dbo].[Customer]
      [ID] [int] IDENTITY(1,1) NOT NULL,
      [FName] [varchar](20) NULL,
     [LName] [varcharint](20) NULL,
      [DateOfBirth] [datetime] NOT NULL,

And so on. You can add (within reason) as many columns to the table as you like.

DML statements aren't used to create data structures (or destroy them); they are used to manipulate the data. An example is a SELECT statement:

SELECT ID, FName, LName, DateOfBirth
FROM Customer;

This was last published in March 2010

Dig Deeper on Enterprise data architecture best practices

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

clear deffination do ddl and dml ki.