0% found this document useful (0 votes)
30 views

SQL Commands Cheat Sheet

There are five types of SQL commands: DDL for defining and modifying database schemas, DML for manipulating data, DCL for controlling access, TCL for transactions, and DQL for querying. Some key commands include CREATE and ALTER for DDL, INSERT and UPDATE for DML, GRANT and REVOKE for DCL, COMMIT and ROLLBACK for TCL, and SELECT for DQL. Constraints are used to enforce data integrity and indexes improve query performance.

Uploaded by

mahesheiruvuri
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

SQL Commands Cheat Sheet

There are five types of SQL commands: DDL for defining and modifying database schemas, DML for manipulating data, DCL for controlling access, TCL for transactions, and DQL for querying. Some key commands include CREATE and ALTER for DDL, INSERT and UPDATE for DML, GRANT and REVOKE for DCL, COMMIT and ROLLBACK for TCL, and SELECT for DQL. Constraints are used to enforce data integrity and indexes improve query performance.

Uploaded by

mahesheiruvuri
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

There are five types of SQL Commands

DDL - Data Definition Langauge


CREATE - create a new table
DROP - Delete both structure and records of table
ALTER - change/ Alter the table structure.
TRUNCATE - delete all the tables rows and reinstate Table
RENAME
COMMENT

DML - Data Manipulation Language


INSERT - Insert rows into the table
UPDATE - update /modify the table row data
DELETE - delete one or more rows from tables
LOCK
MERGE

DCL - Data Control Language


GRANT - grant permissions on the table for a user
REVOKE - revoke the permissions on the table from the user

TCL - Transaction control language


COMMIT - save all the transactions to the database.
ROLLBACK - rollback the transactions that have not been saved to database
SAVEPOINT - roll the transactions back to certain point without rolling back
the entire transactions.
SET TRANSACTION
DQL - Data query language
SELECT - used to query the database
where
and / or conjuctive operators
like clause (%, _
top,
limit
rownum
orderby - Ascending/Descending
groupby
having
distinct
alias

union
union all
Joins
inner join
outer join
full outer join
left outer join
right outer join

Constraint:

NOTNULL - ENSURES THAT


PRIMARY KEY
DEFAULT
UNIQUE
FOREIGN
CHEK CONSTRAINT
INDEX

You might also like