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

Learn the difference between a data definition language (DDL), also known as data descriptive language, and the Structured Query Language (SQL). Find examples of both DDL and SQL.

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

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]

Dig Deeper on Data integration