PostgreSQL Questions with Complete
Solutions
SUM add all the values in a specific column together
MIN calculate the minimum of specific column values
ORDER BY sort the query results
DESC specify that sorting should be done from largest number to smallest
GROUP BY specify that calculations (like AVG, MIN, MAX) should be summarized by
another column's values
HAVING filter the results of a GROUP BY operation
JOIN connect two tables
, ON specify the primary key - foreign key pair on which to base the JOIN operation
INNER JOIN a connection between two tables;includes only those rows with matching
primary key - foreign key values
USING like the ON keyword in a JOIN statement; used when primary key / foreign key
columns have the same name
CASE used within a query to identify complex conditions (similar to IF, ELSIF, ELSE
logic).
WHEN used within a CASE expression to identify conditions
THEN used within a CASE expression to identify returned results
ELSE used within a CASE expression to identify the result if all WHEN conditions fail