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 DirectorI 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
Data Management Strategies for the CIO