Covered quickly and explicitly skipped as non-essential for Homework 1, with half an hour of class remaining (41:41).
Output redirection
- Query results do not have to travel back to the client (terminal or application code) — the system can write them into another table instead (
41:41). SELECT ... INTO <table>stores the result set into a target table (42:10).- MySQL can create the destination table on the fly: because SQL is declarative, the system already knows the types of the accessed data and can infer the schema (
42:10,42:22). - PostgreSQL creates temporary tables this way by placing the
INTOclause immediately before theFROM(42:22).
Output control
DISTINCTandORDER BY(one or many columns) behave as expected (42:36).LIMITreturns the first n records; combined with an offset it produces jumps (42:36).- This is exactly the mechanism behind web pagination — search results showing 10 at a time, "next" fetching the next 10 (
42:36). - Additional clauses exist for handling ties (
42:59).