Back to Developer Roadmap

Sql Subsets

src/data/question-groups/sql/content/sql-subsets.md

4.01.1 KB
Original Source

SQL is divided into several functional subsets:

  • Data Definition Language (DDL): Used to define or modify database structure. This includes commands like CREATE, ALTER, and DROP. For example, the ALTER table statement can be used to add, rename, and remove columns in a table.
  • Data Manipulation Language (DML): Used to insert, update, delete, or retrieve data. This includes commands like SELECT, INSERT, UPDATE, and DELETE. For example, the UPDATE statement can be used to change a user's email based on their ID
  • Data Control Language (DCL): Manages access to data by granting or revoking permissions. This includes commands like GRANT and REVOKE. For example, the GRANT statement can be used to give a user permission to select data from a table.

The major difference between these subsets lies in their purpose:

  • DDL affects the structure of the database.
  • DML interacts with the data itself.
  • DCL governs who can do what within the database system.