|
SQL >
Data Definition Language - DDL
Data Definition Language (DDL) is a part of SQL that is used to create, modify, and delete database objects such as table, view, and index, and to manage access privileges to these objects. Below are the most common DDL commands:
SQL Data Definition Language (DDL) covers commands that define and manage the structure of your database — including creating tables, managing indexes and views, dropping objects, and controlling access privileges via GRANT and REVOKE.
SQL CREATE TABLE
SQL Data Types
SQL View
SQL CREATE VIEW
SQL Index
SQL CREATE INDEX
SQL DROP TABLE
SQL TRUNCATE TABLE
SQL USE
SQL CREATE DATABASE
SQL DROP DATABASE
SQL GRANT
SQL REVOKE
Frequently Asked Questions
- What is Data Definition Language (DDL) in SQL?
- DDL is a subset of SQL focused on defining and managing database structure. It includes commands to create (CREATE TABLE, CREATE VIEW, CREATE INDEX), modify (ALTER TABLE), and delete (DROP TABLE, DROP DATABASE) database objects, as well as manage access privileges (GRANT, REVOKE).
- What is the difference between DDL and DML in SQL?
- DDL defines the database structure — it creates, alters, and drops tables, views, and indexes. DML (Data Manipulation Language) works with the data stored in those structures, using SELECT, INSERT, UPDATE, and DELETE to query and modify rows.
- What is the difference between DROP TABLE and TRUNCATE TABLE?
- DROP TABLE permanently removes both the table structure and all its data. TRUNCATE TABLE deletes all rows but preserves the table structure so new data can be inserted. TRUNCATE is typically faster than DELETE for clearing all rows since it doesn't log individual row deletions.
- What are GRANT and REVOKE in SQL?
- GRANT assigns specific privileges (such as SELECT, INSERT, UPDATE, DELETE) on database objects to a user or role. REVOKE removes those privileges. Together they implement database security and control who can access or modify data.
Next: SQL CREATE TABLE
This page was last updated on March 19, 2026.
Copyright © 2026 1keydata.com All Rights Reserved
Privacy Policy About Contact |