What are the main groups of SQL commands?
Options
- DDL, DML, DQL, DCL, TCL: structure, data, queries, rights, transactions (Correct option)
- Only SELECT and INSERT, because all the others are variations
- HTML, CSS and JS commands, which are used in web pages
- Frontend and backend commands, used by different developers
Answer
DDL (define structure: CREATE, ALTER, DROP), DML (change data: INSERT, UPDATE, DELETE), DQL (query: SELECT), DCL (permissions: GRANT, REVOKE), TCL (transactions: COMMIT, ROLLBACK)
Why
SQL commands are grouped by purpose:
- DDL (Data Definition Language): create or change the structure:
CREATE TABLE,ALTER TABLE,DROP TABLE. - DML (Data Manipulation): change data:
INSERT,UPDATE,DELETE. - DQL (Data Query): read data:
SELECT. - DCL (Data Control): permissions:
GRANT,REVOKE. - TCL (Transaction Control):
BEGIN,COMMIT,ROLLBACK.
Remember
DDL structure, DML change data, DQL read, DCL permissions, TCL transactions.