07. SQL Commands - DDL, DML, DQL, DCL, TCL
07. SQL Commands - DDL, DML, DQL, DCL, TCL
Table of Contents
SQL Commands are mainly categorized into five categories: ...................................................... 1
1. DDL – Data Definition Language ....................................................................................................... 1
2. DQL – Data Query Language ............................................................................................................ 2
3. DML – Data Manipulation Language ................................................................................................ 2
4. DCL – Data Control Language ........................................................................................................... 3
5. TCL – Transaction Control Language ................................................................................................. 3
This creates a table called "Students" with three columns: ID, Name, and Age.
Example:
This removes all data from the "Students" table but keeps the table structure.
This retrieves the "Name" and "Age" of students who are older than 18.
INSERT INTO Students (ID, Name, Age) VALUES (1, 'John', 20);
This adds a new record with ID=1, Name='John', and Age=20 to the "Students" table.
This removes the student with ID=1 from the "Students" table.
This gives "User1" permission to use the SELECT command on the "Students" table.
This removes the "SELECT" permission for "User1" on the "Students" table.
COMMIT;
ROLLBACK;
3. SAVEPOINT: Used to set a point within a transaction to which you can ROLLBACK later.
Example:
SAVEPOINT Save1;