As one of the most famous languages out there that developers use all the time, knowing at least a few things about SQL can be quite helpful. Of course, you can refer back to one of its online documentations, or check up at w3schools.com, but you may also prefer a quick cheat sheet that you can use to refresh up your knowledge or learn something that you may have not learned before. A relatively new Github repository, at least at the time of this writing, has been created, which has some of the most common SQL commands that you may use in your daily tasks.

It includes commands on finding and modifying data, reporting, joining, viewing and also altering tables. Here is the list of commands categorized into six categories.

1. Finding Data Queries

SELECT: used to select data from a database

DISTINCT: filters away duplicate values and returns rows of specified column

WHERE: used to filter records/rows

ORDER BY: used to sort the result-set in ascending or descending order

SELECT TOP: used to specify the number of records to return from top of table

LIKE: operator used in a WHERE clause to search for a specific pattern in a column

IN: operator that allows you to specify multiple values in a WHERE clause

BETWEEN: operator selects values within a given range inclusive

NULL: values in a field with no value

AS: aliases are used to assign a temporary name to a table or column

UNION: operator used to combine the result-set of two or more SELECT statements

ANY|ALL: operator used to check subquery conditions used within a WHERE or HAVING clauses

GROUP BY: statement often used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result-set by one or more columns

HAVING: this clause was added to SQL because the WHERE keyword could not be used with aggregated functions

WITH: often used for retrieving hierarchical data or re-using temp result set several times in a query. Also referred to as “Common Table Expression”

2. Data Modification Queries

INSERT INTO: used to insert new records/rows in a table

UPDATE: used to modify the existing records in a table

DELETE: used to delete existing records/rows in a table

3. Reporting Queries

COUNT: returns the # of occurrences

MIN() and MAX(): returns the smallest/largest value of the selected column

AVG(): returns the average value of a numeric column

SUM(): returns the total sum of a numeric column

4. Join Queries

INNER JOIN: returns records that have matching value in both tables

LEFT (OUTER) JOIN: returns all records from the left table (table1), and the matched records from the right table (table2)

RIGHT (OUTER) JOIN: returns all records from the right table (table2), and the matched records from the left table (table1)

FULL (OUTER) JOIN: returns all records when there is a match in either left or right table

Self JOIN: a regular join, but the table is joined with itself

5. View Queries

CREATE: create a view

SELECT: retrieve a view

DROP: drop a view

6. Altering Table Queries

ADD: add a column

MODIFY: change data type of column

DROP: delete a column

This is the entire list that has been published at the time of this writing on the master branch of this project. You can refer back to it to see this list and potentially other additions and refinements of these queries.