SQL Commands Classification: DDL, DML, DCL, TCL, and DQL Exercise

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:

  1. CREATE TABLE Student (...);
  2. INSERT INTO Employee VALUES (...);
  3. SELECT Name, Salary FROM Employee;
  4. GRANT SELECT ON Student TO User1;
  5. COMMIT;

Solution:

SQL StatementTypeExplanation
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.

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন