SQL is not as declarative language as sometimes implied. There are programmatic aspects even to standard queries. This is even more true in MySQL, where one can expect a certain behavior on query execution. In this session we will observe some of this behavior and how to use it to create queries of programmatic nature. We will see how to take advantage of row evaluation order, control flow behavior, table & query inference order, and time evaluation and suspension.