SQL Cheatsheet

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

SQL

CONSIDER

Sources SUPPORTING ME

W3Schools.com

CHEATSHEET
DataQuest.io
@AbzAaron

Commands / Clauses Joins Examples

Select all columns with filter applied

a b

Select first 10 rows for two columns


a INNER JOIN b

Select all columns with multiple filters


a b

a LEFT JOIN b
Select all rows from col1 & col2 ordering by col1

a b
Return count of rows in table

a RIGHT JOIN b

Return sum of col1

a b

Return max value for col1


a FULL OUTER JOIN b

Compute summary stats by grouping col2

Data Definition Language Order Of


Execution
CREATE ALTER
Combine data from 2 tables using left join

FROM

DROP WHERE Aggregate and filter result

GROUP BY

Data Manipulation Language HAVING

UPDATE INSERT
SELECT Implementation of CASE statement

ORDER BY

DELETE SELECT LIMIT

You might also like