SQL has been the international standard used by relational databases since 1987. There are four types of SQL commands:

Data Definition Language (DDL) – These commands define the structure of the database. For example, drop, rename, alter, and create. They affect the database structure. For example, creating a database or renaming a table.Data Manipulation Language (DML) – These commands are used to work with the data. For example, insert, select, update, delete. These don’t affect the tables or database structure, but the data present in the tables. For example, inserting a new row, or updating a value in the row.Transaction Control Language (TCL) – These commands control the transaction processing in the database. For example, rollback, save, commit. These commands have a permanent impact on the database. For example, rolling back the entire transaction to the previous state even if one process fails.Data Control Language (DCL) – Data Control commands are used to authorize users and grant only the necessary permissions to a user or group. For example, one user can have read-only permission, whereas another can have read and write. The access control is done using the grant, deny and revoke commands.

Below is the SQL Cheat sheet containing the most useful commands. The cheat sheet will help you quickly reference the required commands with the correct syntax and expected result of a query. In this cheat sheet, we focus on DDL and DML commands as the other two types are quite straightforward to use.

Data Definition and Manipulation Queries

Aggregate functions

Aggregate functions are data manipulation commands that work on numeric columns like int, and float. These are helpful in filtering and sorting data at the database level itself. Some commonly used aggregate functions are:

SQL Joins

SQL joins are very important because they connect and filter data from multiple tables. Joins are a bit tricky and can give unexpected results, if not executed properly. The below table will help you quickly refer to the 4 types of SQL joins:

Additional resources

SQL is an important tool for software developers, data scientists, and analysts alike. A handy reference of SQL commands in the form of a cheat sheet can save you a lot of time, and help you understand the expected output of each keyword. For additional information, please refer to the following resources: SQL Tutorial: SQL Cheat Sheet Intellipaat: SQL Commands Cheat Sheet WebsiteSetup: SQL Cheat Sheet ProgrammingWithMosh: SQL Cheat Sheet PostgreSQL Cheat Sheet

Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 55Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 1Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 86Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 80Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 41Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 87Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 48Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 21Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 39Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 84Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 84Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 71Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 88Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 72Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 19Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 33Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 49Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 11Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 16Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 56Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 54Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 87Ultimate SQL Cheat Sheet to Bookmark for Later  2023  - 37