I’m still looking for new entries. I get quite a few suggestions, but not all of them make it into quiz questions. Do send in your suggestions!
This wonderful quiz from Vladimir Kolesnikov is one of those that should make you stop and think for a moment…
Given this table and data:
mysql> SELECT * FROM t; +------+------+ | i1 | i2 | +------+------+ | 1 | 2 | | 2 | 1 | | 4 | 3 | | 3 | 4 | +------+------+ 4 rows in set (0.00 sec)
What is the result of the following three statements?
SELECT * FROM t ORDER BY 1
SELECT * FROM t ORDER BY 2
SELECT * FROM t ORDER BY 1+1