What's the difference between DDL and DML?
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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
Dig Deeper on Enterprise data architecture best practices
Related Q&A from Mark Whitehorn
The unstructured data types common in big data systems are often better managed by a NoSQL database than relational software, Mark Whitehorn says.continue reading
IT managers should ask cloud providers some pointed questions about the security of data stored in cloud databases, says expert Mark Whitehorn.continue reading
Expert Mark Whitehorn explains what skills are required for predictive modeling -- and whether business users can do the work of data scientists.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.