SQL Exercise – Classifying Commands by Type
Classify each of the following SQL statements into their correct category: DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language), TCL (Transaction Control Language), or DQL (Data Query Language). Explain your choice briefly.
SQL Statements:
CREATE TABLE Student (...);INSERT INTO Employee VALUES (...);SELECT Name, Salary FROM Employee;GRANT SELECT ON Student TO User1;COMMIT;
Solution:
| SQL Statement | Type | Explanation |
|---|---|---|
| CREATE TABLE Student (...); | DDL | Data Definition Language – used to define or modify database structures (tables, schemas). |
| INSERT INTO Employee VALUES (...); | DML | Data Manipulation Language – used to insert, update, or delete data in tables. |
| SELECT Name, Salary FROM Employee; | DQL | Data Query Language – used to retrieve data from the database. |
| GRANT SELECT ON Student TO User1; | DCL | Data Control Language – used to grant or revoke access privileges to users. |
| COMMIT; | TCL | Transaction Control Language – used to save (commit) or undo (rollback) transactions. |
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন