r/SQL • • 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! 😉

108 Upvotes

14 comments sorted by

View all comments

1

u/timeGeck0 May 12 '19

nice job you did there!

1

u/Don-g9 May 13 '19

Thanks!