Blog

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 … Continue reading SQL Tutorial 7 : Summary & Cheatsheet

SQL Tutorial 5 : “HAVING” Function

The “HAVING” function can be described as a WHERE function, but used for Aggregation functions. For instance, a query which includes “WHERE sum(product_orders) > 10” will not work. Instead of using the WHERE function in such a scenario, the HAVING function will be used. (ie HAVING sum(product_orders) > 10) To illustrate, let's go back to … Continue reading SQL Tutorial 5 : “HAVING” Function

SQL Tutorial 4 : “GROUP BY” & “ORDER BY” Functions

“GROUP BY” Function The “GROUP BY” statement is used with the aggregate functions such as SUM and COUNT to group the result-set by one or more columns. Again, let’s use the same ”world_data” dataset to illustrate this. Consider that we want to find the total gdp of each continent from this dataset. We will write … Continue reading SQL Tutorial 4 : “GROUP BY” & “ORDER BY” Functions