Sobes.tech
Middle

What is DDL, DML, DCL? What are their differences and examples of commands?

sobes.tech AI

Answer from AI

DDL (Data Definition Language) — a language for defining data. It is used to create and modify the structure of a database. Examples of commands:

  • CREATE TABLE
  • ALTER TABLE
  • DROP TABLE

DML (Data Manipulation Language) — a language for manipulating data. It allows adding, modifying, deleting, and retrieving data. Examples of commands:

  • SELECT
  • INSERT
  • UPDATE
  • DELETE

DCL (Data Control Language) — a language for managing access and permissions. Examples of commands:

  • GRANT (to grant permissions)
  • REVOKE (to revoke permissions)

Differences:

  • DDL works with the database structure.
  • DML works with the content of tables.
  • DCL manages user rights and security.