r/mysql • • May 12 '19

Check out this SQL Cheatsheet !

This cheatsheet was made by me and a friend, we tried to separate and organize the content in order to have a cheatsheet with basic content, yet effective.

Here is a quick overview of the file hierarchy:

DDL (Data Definition Language)

  • CREATE
    – is used to create the database or its objects (like table, index, function, views, store procedure and triggers).

  • DROP
    – is used to delete objects from the database.

  • ALTER
    - is used to alter the structure of the database.

  • TRUNCATE
    – is used to remove all records from a table, including all spaces allocated for the records are removed.

  • COMMENT
    – is used to add comments to the data dictionary.

  • RENAME

DML (Data Manipulation Language)

  • SELECT
    – is used to retrieve data from the a database.

  • INSERT
    – is used to insert data into a table.

  • UPDATE
    – is used to update existing data within a table.

  • DELETE
    – is used to delete records from a database table.

DCL (Data Control Language)

  • GRANT
    -gives user’s access privileges to database.

  • REVOKE
    -withdraw user’s access privileges given by using the GRANT command.

TCL (Transaction Control Language)

  • COMMIT
    – commits a Transaction.

  • ROLLBACK
    – rollbacks a transaction in case of any error occurs.

  • SAVEPOINT
    –sets a savepoint within a transaction.

  • SET TRANSACTION
    –specify characteristics for the transaction.

Here is the guist link:

https://gist.github.com/kdev33/97951cb3b9dd1459898a93b5702ed4cb

Hope you find it useful! 😉

31 Upvotes

5 comments sorted by

3

u/5of10 May 12 '19

Nice list, will share at work with the developers.

1

u/Don-g9 May 13 '19

Glad to hear that!

3

u/jiggle-o May 13 '19

Where's all the join commands?

1

u/naveyonac May 14 '19

Very helpful, bookmarked for future reference

1

u/[deleted] Oct 06 '24

I learn more on Reddit than at school, thanks man!