What is the difference between data definition language (DDL) and SQL?

What is the difference between data definition language (DDL) and SQL?

What’s the difference between a data definition language (DDL) and a query language?

    Requires Free Membership to View

    When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to keep you informed on the hottest data and information management trends today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchDataManagement.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDataManagement.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

I assume that you mean SQL in this question. SQL stands for “Structured Query Language,” which implies (erroneously) that the language can be used only for querying. Of course, it CAN be used for querying – but it can also be used to create database components. 

So SQL is split into sections, one of which is the query language. As the name implies, this part of SQL is for writing queries – for example:

SELECT EmployeeNo, FirstName, LastName, DateOfBirth, DateEmployed
FROM EMPLOYEES
WHERE EmployeeNo = 2;

The data definition language (also known as the data descriptive language) is composed of statements that can be used to create, or modify, components of a database, such as its tables. For example:

CREATE TABLE [dbo].[tblDataSheet](
      [SheetID] [int] IDENTITY(1,1) NOT NULL,
      [TDStamp] [datetime] NULL,
      [Family] [varchar](50) NULL,
      [Genus] [varchar](50) NULL,
      [Species] [varchar](50) NULL,
      … lots more columns described here….
      [BarCode] [varchar](50) NULL,
 CONSTRAINT [pkSheet] PRIMARY KEY CLUSTERED
(
      [SheetID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

This was first published in August 2010