Which category of SQL statement (DDL vs DML vs DCL)
Verdict: Match the verb's purpose to its category: CREATE/ALTER/DROP change object structure (DDL); SELECT/INSERT/UPDATE/DELETE change or read row data (DML); GRANT/DENY/REVOKE change permissions (DCL).
| Criterion | DDL | DML | DCL |
|---|---|---|---|
| Purpose | Create, modify, and remove tables and other objects | Retrieve, insert, modify, or delete rows in tables | Manage access by granting, denying, or revoking permissions |
| Example statements | CREATE, ALTER, DROP | SELECT, INSERT, UPDATE, DELETE | GRANT, DENY, REVOKE |
| Acts on | Object structure (tables, views) | Row-level data inside tables | User permissions on database objects |
Rules
- Revoking a previously granted permission is a DCL action; DCL statements manage who is allowed to perform actions on database objects.
- SELECT is the DML statement that reads rows from a table; a WHERE clause restricts the result to rows matching given criteria.
- The four main DML statements are SELECT, INSERT, UPDATE, and DELETE, which retrieve, insert, modify, and delete the rows in tables.
Traps
- DML manipulates the data inside tables; it does not control which users hold permissions, so it is not the category for granting or revoking access.
- DDL changes the structure of objects, not the permissions assigned to users.
- CREATE is a DDL statement that builds objects; it does not retrieve rows of data, so it cannot answer a read/query requirement.
- DROP is a DDL statement, not DML, even though it also operates on a named table.