SQL Commands Chart
Category Command Full Form Purpose / Description Example
DDL (Data Definition Language)
CREATE Create Creates a new table, database, view, or object.
CREATE TABLE Students (ID INT, Name V
ALTER Alter Modifies an existing database object. ALTER TABLE Students ADD Age INT;
DROP Drop Deletes an entire table, view, or database. DROP TABLE Students;
TRUNCATE Truncate Removes all records but keeps the structure. TRUNCATE TABLE Students;
RENAME Rename Renames a table or column. RENAME TABLE Students TO Learners;
COMMENT Comment Adds comments to the data dictionary. COMMENT ON TABLE Students IS 'Stores
DML (Data Manipulation
INSERT
Language) Insert Adds new records into a table. INSERT INTO Students VALUES (1, 'Amit',
UPDATE Update Modifies existing records. UPDATE Students SET Age = 21 WHERE
DELETE Delete Removes specific records. DELETE FROM Students WHERE ID = 1;
MERGE Merge Combines insert and update operations. MERGE INTO Target USING Source ON ...
DCL (Data Control Language)
GRANT Grant Gives user access privileges. GRANT SELECT ON Students TO user1;
REVOKE Revoke Removes access privileges. REVOKE SELECT ON Students FROM use
TCL (Transaction Control
COMMIT
Language) Commit Saves all changes made during the transaction.
COMMIT;
ROLLBACK Rollback Reverts changes if an error occurs. ROLLBACK;
SAVEPOINT Savepoint Sets a point within a transaction. SAVEPOINT sp1;
SET TRANSACTION
Set Transaction Defines characteristics of a transaction. SET TRANSACTION READ ONLY;
DQL (Data Query Language)
SELECT Select Retrieves data from one or more tables. SELECT Name, Age FROM Students;