Review the following:
The format of the exam will be some short answers and some "work-out" problems similar to the homeworks. Here are some suggestions for things to know:
SELECT [list of attributes] FROM [list of relations] WHERE [condition] GROUP BY [grouping attributes] HAVING [condition about the groups to be included] ORDER BY [list of attributes] Only SELECT and FROM are mandatory; if HAVING is present, so must be GROUP BY. Some other keywords: * - all atributes AS - rename an attribute in SELECT; alias for a relation in FROM (optional) LIKE, % and _ for pattern matching in strings DESC, ASC - to sort in descending or ascending order Combining relations: [relation] UNION [relation] [relation] INTERSECT [relation] [relation] EXCEPT [relation] [relation] CROSS JOIN [relation] [relation] JOIN [relation] ON [condition] [relation] NATURAL JOIN [relation] [relation] NATURAL FULL/LEFT/RIGHT OUTER JOIN [relation] [relation] FULL/LEFT/RIGHT OUTER JOIN [relation] ON [condition] Conditions involving relations: EXISTS [relation] IN [relation] > ALL [relation] (and other comparison operators) > ANY [relation] (and other comparison operators) Also can use NOT in these DISTINCT - after SELECT to eliminate duplicates ALL - after UNION, INTERSECT, EXCEPT to keep duplicates Aggregation: SUM, AVG, MIN, MAX, COUNT - apply to an attribute in SELECT COUNT can also apply to * can put DISTINCT before attribute name