0% found this document useful (0 votes)
3 views1 page

Comprehensive SQL Commands Guide

The document provides a reference for SQL commands categorized into four main types: Data Definition Language (DDL), Data Manipulation Language (DML), Transaction Control Language (TCL), and Data Control Language (DCL). Each category includes essential commands such as CREATE, SELECT, COMMIT, and GRANT, along with their functions. Additional useful commands for database management are also listed.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Comprehensive SQL Commands Guide

The document provides a reference for SQL commands categorized into four main types: Data Definition Language (DDL), Data Manipulation Language (DML), Transaction Control Language (TCL), and Data Control Language (DCL). Each category includes essential commands such as CREATE, SELECT, COMMIT, and GRANT, along with their functions. Additional useful commands for database management are also listed.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Commands Reference

Data Definition Language (DDL)


• CREATE DATABASE – creates a new database
• CREATE TABLE – creates a new table
• ALTER TABLE – modifies an existing table
• DROP TABLE – deletes a table
• TRUNCATE TABLE – removes all records from a table
• RENAME – renames a database object

Data Manipulation Language (DML)


• SELECT – retrieves data from the database
• INSERT – inserts data into a table
• UPDATE – updates existing records
• DELETE – deletes records from a table
• MERGE – upserts data (insert or update)

Transaction Control Language (TCL)


• COMMIT – saves the changes permanently
• ROLLBACK – undoes changes since the last COMMIT
• SAVEPOINT – sets a point within a transaction
• SET TRANSACTION – sets transaction properties

Data Control Language (DCL)


• GRANT – gives user access privileges
• REVOKE – removes user access privileges

Other Useful Commands


• CREATE INDEX – creates an index for faster search
• DROP INDEX – deletes an index
• EXPLAIN – shows query execution plan
• DESCRIBE – shows table structure
• SHOW DATABASES – lists all databases
• SHOW TABLES – lists tables in a database
• USE – selects a database to work with

You might also like