SQL Tutorial 7 : Summary & Cheatsheet

Here’s a cheatsheet to summarise the basic functions covered in this SQL Tutorial Series.

 

Function Syntax
AND / OR SELECT column_name

FROM table_name

WHERE condition

AND/OR condition

IN SELECT column_name

FROM table_name

WHERE column_name

IN (value1,value2,value3……)

GROUP BY SELECT column_name, aggregate_function(column_name)

FROM table_name

WHERE condition

GROUP BY column_name

HAVING SELECT column_name, aggregate_function(column_name)

FROM table_name

WHERE condition

GROUP BY column_name

HAVING aggregate_function(column_name) = x

ORDER BY SELECT column_name

FROM table_name

ORDER BY column_name (ASC/DESC)

JOIN SELECT column_name

FROM table_1

JOIN table_2   -(can be LEFT/RIGHT/INNER/OUTER)

ON table_1.column_name=table_2.column_name

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s