MySQL. Usage of query variables |
||
People rather often ask whether there are equivalents for analytic (windowing) functions in MySQL. No, there are not. To replace them, self join queries, complex subqueries, etc, are used. Most of such workarounds turn out to be ineffective. There are no recursive queries in MySQL either. However, a part of problems usually solved by analytic functions or recursive queries can be handled by features available in MySQL. One of these features is the unique mechanism of processing variables within a Note: this article implies expressions within the SELECT statement are processed in order from left to right; however, there is no confirmation of such a processing order in the official MySQL documentation. You need to keep that in mind when switching from one server version to another. To ensure the required evaluation order, a fake CASE or IF statement can be used. |