sqllogictest
Hex Artifact Content
Not logged in

Artifact c4239e5f4db309134e6825e823a136dce94b7820:


0000: 68 61 73 68 2d 74 68 72 65 73 68 6f 6c 64 20 38  hash-threshold 8
0010: 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b  ....statement ok
0020: 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 74  ..CREATE TABLE t
0030: 61 62 30 28 63 6f 6c 30 20 49 4e 54 45 47 45 52  ab0(col0 INTEGER
0040: 2c 20 63 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20  , col1 INTEGER, 
0050: 63 6f 6c 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d  col2 INTEGER)...
0060: 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43  .statement ok..C
0070: 52 45 41 54 45 20 54 41 42 4c 45 20 74 61 62 31  REATE TABLE tab1
0080: 28 63 6f 6c 30 20 49 4e 54 45 47 45 52 2c 20 63  (col0 INTEGER, c
0090: 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c  ol1 INTEGER, col
00a0: 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74  2 INTEGER)....st
00b0: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43 52 45 41  atement ok..CREA
00c0: 54 45 20 54 41 42 4c 45 20 74 61 62 32 28 63 6f  TE TABLE tab2(co
00d0: 6c 30 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 31  l0 INTEGER, col1
00e0: 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 32 20 49   INTEGER, col2 I
00f0: 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74 61 74 65  NTEGER)....state
0100: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0110: 49 4e 54 4f 20 74 61 62 30 20 56 41 4c 55 45 53  INTO tab0 VALUES
0120: 28 38 39 2c 39 31 2c 38 32 29 0d 0a 0d 0a 73 74  (89,91,82)....st
0130: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45  atement ok..INSE
0140: 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56 41 4c  RT INTO tab0 VAL
0150: 55 45 53 28 33 35 2c 39 37 2c 31 29 0d 0a 0d 0a  UES(35,97,1)....
0160: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
0170: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56  SERT INTO tab0 V
0180: 41 4c 55 45 53 28 32 34 2c 38 36 2c 33 33 29 0d  ALUES(24,86,33).
0190: 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d  ...statement ok.
01a0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 62  .INSERT INTO tab
01b0: 31 20 56 41 4c 55 45 53 28 36 34 2c 31 30 2c 35  1 VALUES(64,10,5
01c0: 37 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20  7)....statement 
01d0: 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  ok..INSERT INTO 
01e0: 74 61 62 31 20 56 41 4c 55 45 53 28 33 2c 32 36  tab1 VALUES(3,26
01f0: 2c 35 34 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e  ,54)....statemen
0200: 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54  t ok..INSERT INT
0210: 4f 20 74 61 62 31 20 56 41 4c 55 45 53 28 38 30  O tab1 VALUES(80
0220: 2c 31 33 2c 39 36 29 0d 0a 0d 0a 73 74 61 74 65  ,13,96)....state
0230: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0240: 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55 45 53  INTO tab2 VALUES
0250: 28 37 2c 33 31 2c 32 37 29 0d 0a 0d 0a 73 74 61  (7,31,27)....sta
0260: 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52  tement ok..INSER
0270: 54 20 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55  T INTO tab2 VALU
0280: 45 53 28 37 39 2c 31 37 2c 33 38 29 0d 0a 0d 0a  ES(79,17,38)....
0290: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
02a0: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 32 20 56  SERT INTO tab2 V
02b0: 41 4c 55 45 53 28 37 38 2c 35 39 2c 32 36 29 0d  ALUES(78,59,26).
02c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
02d0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
02e0: 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  NCT + col1 * - c
02f0: 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 * col0 FROM 
0300: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35  tab1..----..-135
0310: 32 30 0d 0a 2d 32 30 32 38 0d 0a 2d 36 34 30 30  20..-2028..-6400
0320: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0330: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
0340: 28 20 2b 20 39 32 20 29 20 2d 20 63 6f 6c 32 20  ( + 92 ) - col2 
0350: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
0360: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 36 0d 0a 2d  0..----..-146..-
0370: 31 34 39 0d 0a 2d 31 38 38 0d 0a 0d 0a 6f 6e 6c  149..-188....onl
0380: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
0390: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
03a0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
03b0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
03c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
03d0: 6c 61 62 65 6c 2d 32 0d 0a 53 45 4c 45 43 54 20  label-2..SELECT 
03e0: 2b 20 2d 20 31 38 20 2d 20 2d 20 63 6f 6c 32 20  + - 18 - - col2 
03f0: 2a 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28  * col2 * - CAST(
0400: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
0410: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
0420: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
0430: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
0440: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
0450: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
0460: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
0470: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 0d 0a 53  wsort label-2..S
0480: 45 4c 45 43 54 20 2b 20 2d 20 31 38 20 2d 20 2d  ELECT + - 18 - -
0490: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2d   col2 * col2 * -
04a0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
04b0: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
04c0: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
04d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
04e0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
04f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0500: 53 45 4c 45 43 54 20 39 30 20 2d 20 63 6f 6c 30  SELECT 90 - col0
0510: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
0520: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 32 36  r0..----..10..26
0530: 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..87....query I 
0540: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0550: 2b 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 32 20  + col2 + ( col2 
0560: 29 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 46  ) * - ( col1 ) F
0570: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
0580: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d  ..----..-1508..-
0590: 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75 65  608..-810....que
05a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
05b0: 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  LECT col0 * col0
05c0: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
05d0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
05e0: 0a 31 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36 34  .1225..19008..64
05f0: 39 35 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  9522....onlyif m
0600: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
0610: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
0620: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
0630: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0640: 62 65 6c 2d 36 0d 0a 53 45 4c 45 43 54 20 41 4c  bel-6..SELECT AL
0650: 4c 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  L - col0 DIV col
0660: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
0670: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  ab1..----..-1..-
0680: 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..-1....skipif 
0690: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
06a0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
06b0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 0d  rowsort label-6.
06c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
06d0: 6c 30 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 / col0 AS col
06e0: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
06f0: 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
0700: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0710: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0720: 54 20 35 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  T 53 AS col2 FRO
0730: 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
0740: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  cor0..----..53..
0750: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0760: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
0770: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   * - col1 + col2
0780: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0790: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
07a0: 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34  ..1560..684..864
07b0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
07c0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
07d0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
07e0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
07f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
0800: 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  9..SELECT + col2
0810: 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f   - col0 DIV - co
0820: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
0830: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
0840: 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a  --..55..58..97..
0850: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
0860: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
0870: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0880: 20 6c 61 62 65 6c 2d 39 0d 0a 53 45 4c 45 43 54   label-9..SELECT
0890: 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 2f   + col2 - col0 /
08a0: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
08b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
08c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d  0..----..55..58.
08d0: 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
08e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
08f0: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2b   col2 + - col0 +
0900: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
0910: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
0920: 30 35 0d 0a 31 31 32 0d 0a 35 30 0d 0a 0d 0a 71  05..112..50....q
0930: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0940: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0950: 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  + col0 * - col0 
0960: 2b 20 2d 20 39 38 20 2a 20 2b 20 63 6f 6c 31 20  + - 98 * + col1 
0970: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
0980: 0a 2d 31 31 38 36 36 0d 0a 2d 33 30 38 37 0d 0a  .-11866..-3087..
0990: 2d 37 39 30 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  -7907....skipif 
09a0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
09b0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
09c0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
09d0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
09e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
09f0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
0a00: 37 35 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 74 61  75 * col1 * + ta
0a10: 62 31 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f  b1.col1 col2 FRO
0a20: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
0a30: 36 37 35 0d 0a 35 30 37 30 30 0d 0a 37 35 30 30  675..50700..7500
0a40: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
0a50: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
0a60: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
0a70: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  rt..SELECT + CAS
0a80: 54 20 28 20 63 6f 6c 30 20 41 53 20 52 45 41 4c  T ( col0 AS REAL
0a90: 20 29 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   ) - col1 AS col
0aa0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
0ab0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  or0..----..-2..-
0ac0: 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79  62..-62....query
0ad0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0ae0: 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2b 20 63  CT ALL + - ( + c
0af0: 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  ol0 ) * - cor0.c
0b00: 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 * col2 AS co
0b10: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
0b20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39  cor0..----..2079
0b30: 33 36 0d 0a 37 33 37 32 38 30 0d 0a 38 37 34 38  36..737280..8748
0b40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0b50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
0b60: 2d 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 31 2e  - col1 + - tab1.
0b70: 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 2b 20  col0 / - col1 + 
0b80: 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab1.col1 AS col
0b90: 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52  0 FROM tab1 WHER
0ba0: 45 20 4e 4f 54 20 2d 20 63 6f 6c 32 20 42 45 54  E NOT - col2 BET
0bb0: 57 45 45 4e 20 28 20 4e 55 4c 4c 20 29 20 41 4e  WEEN ( NULL ) AN
0bc0: 44 20 2b 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a  D + col2..----..
0bd0: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
0be0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
0bf0: 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 63 6f  OM tab2 WHERE co
0c00: 6c 32 20 2a 20 63 6f 6c 30 20 42 45 54 57 45 45  l2 * col0 BETWEE
0c10: 4e 20 4e 55 4c 4c 20 41 4e 44 20 63 6f 6c 32 0d  N NULL AND col2.
0c20: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
0c30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0c40: 20 63 6f 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c   col1 + tab0.col
0c50: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
0c60: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a  ab0..----..119..
0c70: 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79  173..98....query
0c80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0c90: 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a  CT col0 + col0 *
0ca0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
0cb0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
0cc0: 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31  .196..2106..3081
0cd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0ce0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
0cf0: 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  b2.col0 AS col1 
0d00: 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
0d10: 4e 4f 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  NOT - col1 * col
0d20: 32 20 49 4e 20 28 20 2b 20 63 6f 6c 31 20 2a 20  2 IN ( + col1 * 
0d30: 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  col2 )..----..-7
0d40: 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75  ..-78..-79....qu
0d50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0d60: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
0d70: 6f 6c 31 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20  ol1 - tab2.col0 
0d80: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
0d90: 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d  .-19..-62..24...
0da0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0db0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 41 53  ..SELECT col2 AS
0dc0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
0dd0: 57 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f 6c 30  WHERE NOT - col0
0de0: 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c 20   BETWEEN ( NULL 
0df0: 29 20 41 4e 44 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d  ) AND col0..----
0e00: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
0e10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
0e20: 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
0e30: 4e 4f 54 20 4e 55 4c 4c 20 3c 20 63 6f 6c 31 0d  NOT NULL < col1.
0e40: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
0e50: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0e60: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
0e70: 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20 2a  WHERE NOT col1 *
0e80: 20 2b 20 63 6f 6c 31 20 49 4e 20 28 20 2b 20 63   + col1 IN ( + c
0e90: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 29 0d 0a  ol0 * + col0 )..
0ea0: 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
0eb0: 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
0ec0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
0ed0: 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45   * FROM tab2 WHE
0ee0: 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20 2b 20 63  RE NULL IN ( + c
0ef0: 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol0 )..----....q
0f00: 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
0f10: 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
0f20: 74 61 62 30 20 57 48 45 52 45 20 63 6f 6c 30 20  tab0 WHERE col0 
0f30: 3c 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d  < ( NULL )..----
0f40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0f50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
0f60: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d 20 63 6f  col0 * col0 - co
0f70: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
0f80: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a  tab2..----..42..
0f90: 36 30 30 36 0d 0a 36 31 36 32 0d 0a 0d 0a 71 75  6006..6162....qu
0fa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0fb0: 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63  ELECT ALL tab2.c
0fc0: 6f 6c 32 20 2d 20 2b 20 74 61 62 32 2e 63 6f 6c  ol2 - + tab2.col
0fd0: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
0fe0: 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a  -..-33..-4..21..
0ff0: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
1000: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
1010: 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f  OM tab0 WHERE NO
1020: 54 20 2b 20 63 6f 6c 32 20 3d 20 2b 20 63 6f 6c  T + col2 = + col
1030: 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
1040: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 38 61  s hashing to 38a
1050: 31 36 37 33 65 32 65 30 39 64 36 39 34 63 38 63  1673e2e09d694c8c
1060: 65 63 34 35 63 37 39 37 30 33 34 61 37 0d 0a 0d  ec45c797034a7...
1070: 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
1080: 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f  rt..SELECT * FRO
1090: 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54  M tab2 WHERE NOT
10a0: 20 2d 20 63 6f 6c 30 20 4e 4f 54 20 42 45 54 57   - col0 NOT BETW
10b0: 45 45 4e 20 28 20 4e 55 4c 4c 20 29 20 41 4e 44  EEN ( NULL ) AND
10c0: 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
10d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10e0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
10f0: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
1100: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   tab1..----..364
1110: 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30 0d  80..4212..99840.
1120: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1130: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1140: 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  NCT - cor0.col2 
1150: 2b 20 2b 20 63 6f 6c 30 20 2a 20 34 35 20 41 53  + + col0 * 45 AS
1160: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1170: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1180: 38 32 33 0d 0a 33 35 30 34 0d 0a 38 31 0d 0a 0d  823..3504..81...
1190: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11a0: 0d 0a 53 45 4c 45 43 54 20 38 20 41 53 20 63 6f  ..SELECT 8 AS co
11b0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
11c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 0d 0a 38  cor0..----..8..8
11d0: 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..8....query I r
11e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
11f0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
1200: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol1 * - col1 FRO
1210: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1220: 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32  ----..-7396..-82
1230: 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65  81..-9409....que
1240: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1250: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  LECT col2 * col1
1260: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * - col1 + + co
1270: 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l2 * col1 * col1
1280: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1290: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
12a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12b0: 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 30  LECT - tab1.col0
12c0: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
12d0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
12e0: 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30 0d 0a 2d  .-4096..-6400..-
12f0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1300: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1310: 31 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 - + col0 AS co
1320: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
1330: 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d  --..2..62..62...
1340: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1350: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1360: 30 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  0 * col0 - - col
1370: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1380: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 31 35 33 0d  ab1..----..4153.
1390: 0a 36 33 0d 0a 36 34 39 36 0d 0a 0d 0a 71 75 65  .63..6496....que
13a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13b0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
13c0: 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  col1 - col1 * - 
13d0: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
13e0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
13f0: 0a 32 37 35 32 0d 0a 37 33 37 31 0d 0a 0d 0a 71  .2752..7371....q
1400: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1410: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f  SELECT col0 + co
1420: 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 * + col0 AS c
1430: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
1440: 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32 0d 0a  ---..165..3712..
1450: 37 37 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7760....onlyif m
1460: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1470: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1480: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1490: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
14a0: 62 65 6c 2d 34 30 0d 0a 53 45 4c 45 43 54 20 2d  bel-40..SELECT -
14b0: 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31   col2 DIV + col1
14c0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
14d0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  b2..----..-2..0.
14e0: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
14f0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1500: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1510: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 0d 0a 53  sort label-40..S
1520: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 2b  ELECT - col2 / +
1530: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1540: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
1550: 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  2..0..0....query
1560: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1570: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
1580: 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col0 + cor0.col1
1590: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
15a0: 72 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e  r0 WHERE NULL IN
15b0: 20 28 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   ( col2 * - col1
15c0: 20 2b 20 2b 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d   + + col0 )..---
15d0: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
15e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15f0: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  TINCT - col2 * c
1600: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1610: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1620: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a  ---..-1..-1089..
1630: 2d 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -6724....query I
1640: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1650: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
1660: 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46   + + tab2.col1 F
1670: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1680: 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d 0a  -19..-62..24....
1690: 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
16a0: 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
16b0: 20 74 61 62 31 20 57 48 45 52 45 20 28 20 4e 55   tab1 WHERE ( NU
16c0: 4c 4c 20 29 20 3d 20 2d 20 63 6f 6c 30 20 2a 20  LL ) = - col0 * 
16d0: 2d 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  - col1..----....
16e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16f0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1700: 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b   col0 * col2 + +
1710: 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab0.col0 FROM 
1720: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a  tab0..----..70..
1730: 37 33 38 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65  7387..816....que
1740: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1750: 4c 45 43 54 20 63 6f 6c 30 20 2b 20 74 61 62 31  LECT col0 + tab1
1760: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
1770: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
1780: 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65  9..74..93....que
1790: 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
17a0: 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
17b0: 62 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e  b2 WHERE NOT ( N
17c0: 55 4c 4c 20 29 20 4e 4f 54 20 49 4e 20 28 20 2d  ULL ) NOT IN ( -
17d0: 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 63 6f 6c   tab2.col0 * col
17e0: 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c  1 )..----....onl
17f0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1800: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1810: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1820: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1830: 72 74 20 6c 61 62 65 6c 2d 34 38 0d 0a 53 45 4c  rt label-48..SEL
1840: 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 33  ECT + col2 + + 3
1850: 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f  2 DIV - col0 FRO
1860: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
1870: 0a 33 32 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69  .32..82....skipi
1880: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1890: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
18a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18b0: 34 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  48..SELECT + col
18c0: 32 20 2b 20 2b 20 33 32 20 2f 20 2d 20 63 6f 6c  2 + + 32 / - col
18d0: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
18e0: 2d 0d 0a 31 0d 0a 33 32 0d 0a 38 32 0d 0a 0d 0a  -..1..32..82....
18f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1900: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
1910: 37 34 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  74 FROM tab0 cor
1920: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
1930: 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
1940: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1950: 67 20 74 6f 20 32 63 63 66 38 65 66 33 66 34 37  g to 2ccf8ef3f47
1960: 37 65 31 61 31 61 33 65 33 30 63 38 62 38 31 35  7e1a1a3e30c8b815
1970: 34 66 66 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49  4ff31....query I
1980: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1990: 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2d   - tab2.col1 + -
19a0: 20 39 36 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   96 FROM tab2..-
19b0: 2d 2d 2d 0d 0a 2d 31 31 33 0d 0a 2d 31 32 37 0d  ---..-113..-127.
19c0: 0a 2d 31 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .-155....query I
19d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19e0: 20 2d 20 63 6f 6c 30 20 2a 20 33 30 20 2a 20 63   - col0 * 30 * c
19f0: 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 + cor0.col2 
1a00: 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20 63  * - ( col1 ) * c
1a10: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 35  ol2 + col0 * - 5
1a20: 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  9 FROM tab2 AS c
1a30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 34  or0..----..-2164
1a40: 33 39 0d 0a 2d 32 32 37 30 30 36 0d 0a 2d 32 34  39..-227006..-24
1a50: 34 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  482....query I r
1a60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1a70: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63   col1 * + cor0.c
1a80: 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
1a90: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1aa0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 38  or0..----..-1328
1ab0: 0d 0a 2d 31 34 30 37 0d 0a 2d 36 33 34 0d 0a 0d  ..-1407..-634...
1ac0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ad0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1ae0: 6f 6c 30 20 2a 20 2d 20 28 20 33 38 20 29 20 46  ol0 * - ( 38 ) F
1af0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1b00: 2d 31 31 34 0d 0a 2d 32 34 33 32 0d 0a 2d 33 30  -114..-2432..-30
1b10: 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  40....onlyif mys
1b20: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1b30: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1b40: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1b50: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b60: 6c 2d 35 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-54..SELECT ALL
1b70: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56   + cor0.col0 DIV
1b80: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1b90: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1ba0: 0a 30 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 73 6b 69  .0..1..35....ski
1bb0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1bc0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1bd0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1be0: 6c 2d 35 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-54..SELECT ALL
1bf0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b   + cor0.col0 / +
1c00: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1c10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1c20: 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79  ..1..35....query
1c30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c40: 43 54 20 2d 20 33 20 46 52 4f 4d 20 74 61 62 32  CT - 3 FROM tab2
1c50: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
1c60: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
1c70: 61 73 68 69 6e 67 20 74 6f 20 39 35 62 36 62 39  ashing to 95b6b9
1c80: 62 34 61 61 65 35 63 63 32 64 39 35 34 35 64 62  b4aae5cc2d9545db
1c90: 39 66 38 39 34 30 62 32 64 63 0d 0a 0d 0a 71 75  9f8940b2dc....qu
1ca0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cb0: 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 32 36 20  ELECT col1 + 26 
1cc0: 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
1cd0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 37 0d 0a  b0..----..1007..
1ce0: 32 34 30 35 0d 0a 37 31 30 0d 0a 0d 0a 71 75 65  2405..710....que
1cf0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d00: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1d10: 28 20 34 33 20 29 20 2a 20 63 6f 6c 30 20 46 52  ( 43 ) * col0 FR
1d20: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
1d30: 30 31 0d 0a 33 33 35 34 0d 0a 33 33 39 37 0d 0a  01..3354..3397..
1d40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d50: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1d60: 36 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  61 * col2 + col2
1d70: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 34 30 0d  r0..----..-3240.
1d90: 0a 2d 33 34 32 30 0d 0a 2d 35 37 36 30 0d 0a 0d  .-3420..-5760...
1da0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1db0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 30 20  ..SELECT ALL 10 
1dc0: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
1dd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1de0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1df0: 74 6f 20 61 34 37 31 39 34 34 32 39 66 33 65 30  to a47194429f3e0
1e00: 33 35 38 61 33 61 65 62 66 66 64 35 66 30 35 30  358a3aebffd5f050
1e10: 31 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  113....query I r
1e20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1e30: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
1e40: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   - col1 + + col1
1e50: 20 2d 20 2b 20 34 30 20 2a 20 63 6f 6c 32 20 2a   - + 40 * col2 *
1e60: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
1e70: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1e80: 0a 2d 2d 2d 2d 0d 0a 2d 32 39 39 39 32 38 0d 0a  .----..-299928..
1e90: 2d 33 33 36 35 38 0d 0a 2d 34 36 39 38 0d 0a 0d  -33658..-4698...
1ea0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1eb0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1ec0: 54 20 2b 20 63 6f 6c 30 20 2a 20 39 35 20 2a 20  T + col0 * 95 * 
1ed0: 74 61 62 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31  tab0.col2 + col1
1ee0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
1ef0: 0d 0a 33 34 32 32 0d 0a 36 39 33 34 30 31 0d 0a  ..3422..693401..
1f00: 37 35 33 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  75326....onlyif 
1f10: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1f20: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1f30: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1f40: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1f50: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f60: 6c 2d 36 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-62..SELECT ALL
1f70: 20 2b 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f   + CAST( cor0.co
1f80: 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  l1 AS SIGNED ) +
1f90: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
1fa0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  1 cor0..----..20
1fb0: 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 73 6b 69 70  ..26..52....skip
1fc0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1fd0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1fe0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ff0: 2d 36 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  -62..SELECT ALL 
2000: 2b 20 43 41 53 54 20 28 20 63 6f 72 30 2e 63 6f  + CAST ( cor0.co
2010: 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
2020: 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
2030: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
2040: 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 73 6b 69  0..26..52....ski
2050: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2060: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2070: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2080: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2090: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
20a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20b0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
20c0: 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  - col1 + - col2 
20d0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
20e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
20f0: 30 38 0d 0a 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a  08..608..810....
2100: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2110: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2120: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2130: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2140: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 0d 0a  wsort label-64..
2150: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2160: 28 20 2b 20 63 6f 6c 30 20 29 20 44 49 56 20 63  ( + col0 ) DIV c
2170: 6f 6c 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20  ol1 + col0 col1 
2180: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2190: 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 39 0d 0a  0..----..7..79..
21a0: 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  83....skipif pos
21b0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
21c0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
21d0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
21e0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
21f0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2200: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2210: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2220: 62 65 6c 2d 36 34 0d 0a 53 45 4c 45 43 54 20 44  bel-64..SELECT D
2230: 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 30  ISTINCT ( + col0
2240: 20 29 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   ) / col1 + col0
2250: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2260: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
2270: 0d 0a 37 39 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70  ..79..83....skip
2280: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2290: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
22a0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
22b0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
22c0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
22d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
22e0: 54 49 4e 43 54 20 2d 20 34 39 20 63 6f 6c 30 20  TINCT - 49 col0 
22f0: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
2300: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2310: 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  49....query I ro
2320: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2330: 4c 20 32 35 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  L 25 + col1 FROM
2340: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d   tab2..----..42.
2350: 0a 35 36 0d 0a 38 34 0d 0a 0d 0a 73 6b 69 70 69  .56..84....skipi
2360: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2370: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2380: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2390: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
23a0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
23b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
23c0: 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 63 6f 6c  .col2 + col2 col
23d0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
23e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35  or0..----..52..5
23f0: 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  4..76....query I
2400: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2410: 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c 30 20   ALL + ( - col0 
2420: 29 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 35 33 20  ) + col0 * + 53 
2430: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2440: 0a 31 32 34 38 0d 0a 31 38 32 30 0d 0a 34 36 32  .1248..1820..462
2450: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2460: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2470: 54 49 4e 43 54 20 2d 20 30 20 46 52 4f 4d 20 74  TINCT - 0 FROM t
2480: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2490: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
24a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 20 2a  sort..SELECT 2 *
24b0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
24c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d  cor0..----..178.
24d0: 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 73 6b 69 70 69  .48..70....skipi
24e0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
24f0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2500: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2510: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2520: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2530: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2540: 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  INCT col1 * col0
2550: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2560: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2570: 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
2580: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2590: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
25a0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
25b0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
25c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
25d0: 32 0d 0a 53 45 4c 45 43 54 20 2b 20 35 36 20 44  2..SELECT + 56 D
25e0: 49 56 20 63 6f 6c 31 20 2d 20 2d 20 43 41 53 54  IV col1 - - CAST
25f0: 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ( - col0 AS SIGN
2600: 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ED ) AS col2 FRO
2610: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2620: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 35 39 0d 0a 2d  ----..-1..-59..-
2630: 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  76....skipif mys
2640: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2650: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2660: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 0d 0a 53  sort label-72..S
2670: 45 4c 45 43 54 20 2b 20 35 36 20 2f 20 63 6f 6c  ELECT + 56 / col
2680: 31 20 2d 20 2d 20 43 41 53 54 20 28 20 2d 20 63  1 - - CAST ( - c
2690: 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
26a0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
26b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
26c0: 0d 0a 2d 31 0d 0a 2d 35 39 0d 0a 2d 37 36 0d 0a  ..-1..-59..-76..
26d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26e0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
26f0: 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  - col0 * + col2 
2700: 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
2710: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2720: 0d 0a 32 30 37 39 33 36 0d 0a 37 33 37 32 38 30  ..207936..737280
2730: 0d 0a 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8748....query 
2740: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2750: 54 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52  T col2 - col0 FR
2760: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2770: 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30  --..-41..-52..20
2780: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2790: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
27a0: 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  INCT - col0 + co
27b0: 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l0 * + col1 FROM
27c0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
27d0: 0d 0a 35 37 36 0d 0a 37 35 0d 0a 39 36 30 0d 0a  ..576..75..960..
27e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27f0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2800: 31 36 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  16 + col1 AS col
2810: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2820: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37  or0..----..70..7
2830: 35 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  5..81....query I
2840: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2850: 20 41 4c 4c 20 2d 20 2b 20 34 31 20 46 52 4f 4d   ALL - + 41 FROM
2860: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2870: 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 34 31 0d 0a 2d  ---..-41..-41..-
2880: 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  41....skipif pos
2890: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
28a0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
28b0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
28c0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
28d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28e0: 53 45 4c 45 43 54 20 2b 20 32 36 20 2a 20 2b 20  SELECT + 26 * + 
28f0: 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
2900: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2910: 2d 0d 0a 31 34 30 34 0d 0a 31 34 38 32 0d 0a 32  -..1404..1482..2
2920: 34 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  496....onlyif my
2930: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2940: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2950: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2960: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2970: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2980: 37 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  79..SELECT - + c
2990: 6f 6c 32 20 2a 20 43 41 53 54 28 20 63 6f 6c 31  ol2 * CAST( col1
29a0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63   AS SIGNED ) + c
29b0: 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
29c0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
29d0: 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d  ..-1508..-608..-
29e0: 38 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  810....skipif my
29f0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2a00: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2a10: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 0d 0a  wsort label-79..
2a20: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
2a30: 2a 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53  * CAST ( col1 AS
2a40: 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 72   INTEGER ) + cor
2a50: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
2a60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a70: 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d 38 31  -1508..-608..-81
2a80: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2a90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2aa0: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2d  TINCT + + col2 -
2ab0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2ac0: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2ad0: 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
2ae0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2af0: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
2b00: 20 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f   + ( col2 ) * co
2b10: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2b20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 33  cor0..----..2913
2b30: 0d 0a 33 31 38 35 0d 0a 39 31 33 36 0d 0a 0d 0a  ..3185..9136....
2b40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b50: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2b60: 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 34 31 20 2b   - col0 * + 41 +
2b70: 20 33 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   37 AS col2 FROM
2b80: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2b90: 2d 2d 2d 0d 0a 2d 32 35 30 0d 0a 2d 33 31 36 31  ---..-250..-3161
2ba0: 0d 0a 2d 33 32 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-3202....query
2bb0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bc0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
2bd0: 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 41 53  col2 - + col2 AS
2be0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2bf0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2c00: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c10: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
2c20: 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  col1 * col2 + - 
2c30: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
2c40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 37  or0..----..0..27
2c50: 35 32 0d 0a 37 33 37 31 0d 0a 0d 0a 71 75 65 72  52..7371....quer
2c60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c70: 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b  ECT - + col2 + +
2c80: 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c   cor0.col1 * col
2c90: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2ca0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 35 0d  or0..----..1305.
2cb0: 0a 31 39 30 0d 0a 34 35 37 36 0d 0a 0d 0a 71 75  .190..4576....qu
2cc0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2cd0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
2ce0: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30   + - col2 * cor0
2cf0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
2d00: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d10: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 34 0d 0a 2d 32  .----..-2054..-2
2d20: 31 36 0d 0a 2d 33 30 34 30 0d 0a 0d 0a 71 75 65  16..-3040....que
2d30: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2d40: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2d50: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  col1 + col0 * co
2d60: 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
2d70: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2d80: 2d 0d 0a 33 36 34 37 30 0d 0a 34 31 38 36 0d 0a  -..36470..4186..
2d90: 39 39 38 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49  99827....query I
2da0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2db0: 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 32 38 20 2a   ALL col0 * 28 *
2dc0: 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d   col0 + col1 * -
2dd0: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f   col2 * col2 FRO
2de0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2df0: 2d 2d 2d 2d 0d 0a 2d 37 35 35 36 34 0d 0a 35 39  ----..-75564..59
2e00: 33 39 32 0d 0a 38 32 31 39 38 0d 0a 0d 0a 71 75  392..82198....qu
2e10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e20: 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b  ELECT - - col2 +
2e30: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
2e40: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2e50: 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d  -..121..176..57.
2e60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e70: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2e80: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2b   col2 + - col0 +
2e90: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2ea0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2eb0: 32 34 0d 0a 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65  24..51..7....que
2ec0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ed0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2ee0: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  - cor0.col1 + co
2ef0: 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l2 + + col2 AS c
2f00: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2f10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
2f20: 0d 0a 31 37 39 0d 0a 38 32 0d 0a 0d 0a 71 75 65  ..179..82....que
2f30: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f40: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 31 2e  LECT ALL + cor1.
2f50: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
2f60: 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20  M tab1, tab1 AS 
2f70: 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
2f80: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
2f90: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64  ues hashing to d
2fa0: 36 37 31 61 30 36 34 65 32 64 61 37 30 39 63 61  671a064e2da709ca
2fb0: 34 63 64 66 65 61 33 31 37 62 38 65 38 39 32 0d  4cdfea317b8e892.
2fc0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2fd0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2fe0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2ff0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
3000: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
3010: 33 0d 0a 53 45 4c 45 43 54 20 37 35 20 44 49 56  3..SELECT 75 DIV
3020: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
3030: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
3040: 2d 2d 0d 0a 30 0d 0a 32 0d 0a 33 0d 0a 0d 0a 73  --..0..2..3....s
3050: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
3060: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
3070: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
3080: 62 65 6c 2d 39 33 0d 0a 53 45 4c 45 43 54 20 37  bel-93..SELECT 7
3090: 35 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  5 / col0 AS col2
30a0: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
30b0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 33 0d 0a  .----..0..2..3..
30c0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
30d0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
30e0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
30f0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
3100: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34  rowsort label-94
3110: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
3120: 32 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 63  2 + - col2 DIV c
3130: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
3140: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35   cor0..----..-55
3150: 0d 0a 2d 35 38 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b  ..-58..-97....sk
3160: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
3170: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
3180: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
3190: 65 6c 2d 39 34 0d 0a 53 45 4c 45 43 54 20 2b 20  el-94..SELECT + 
31a0: 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  - col2 + - col2 
31b0: 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  / col2 FROM tab1
31c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31d0: 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 39 37 0d 0a 0d  -55..-58..-97...
31e0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
31f0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3200: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3210: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3220: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 0d  owsort label-95.
3230: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
3240: 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63   DIV + col2 AS c
3250: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
3260: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a  r0..----..1..2..
3270: 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
3280: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
3290: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
32a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 0d 0a 53  sort label-95..S
32b0: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2f  ELECT + + col1 /
32c0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
32d0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
32e0: 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 39 37 0d 0a  ----..1..2..97..
32f0: 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
3300: 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
3310: 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
3320: 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30 2c 20  ab2, tab2 cor0, 
3330: 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61  tab2 AS cor1, ta
3340: 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32  b1, tab0 AS cor2
3350: 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
3360: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
3370: 61 36 33 30 38 35 65 38 63 61 62 36 66 39 37 35  a63085e8cab6f975
3380: 39 31 66 64 30 61 36 62 36 66 66 66 66 30 37 0d  91fd0a6b6ffff07.
3390: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33a0: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
33b0: 2a 20 2d 20 34 30 20 41 53 20 63 6f 6c 31 20 46  * - 40 AS col1 F
33c0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
33d0: 2d 32 31 36 30 0d 0a 2d 32 32 38 30 0d 0a 2d 33  -2160..-2280..-3
33e0: 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  840....query I r
33f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
3400: 49 53 54 49 4e 43 54 20 2d 20 74 61 62 32 2e 63  ISTINCT - tab2.c
3410: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 31  ol0 + + col2 * 1
3420: 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  9 FROM tab2..---
3430: 2d 0d 0a 34 31 36 0d 0a 35 30 36 0d 0a 36 34 33  -..416..506..643
3440: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3450: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3460: 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29 20  col0 * ( col1 ) 
3470: 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * - col1 AS col2
3480: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
3490: 0d 0a 2d 31 33 35 32 30 0d 0a 2d 32 30 32 38 0d  ..-13520..-2028.
34a0: 0a 2d 36 34 30 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-6400....skipif
34b0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
34c0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
34d0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
34e0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
34f0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
3500: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
3510: 20 28 20 63 6f 6c 30 20 29 20 63 6f 6c 31 20 46   ( col0 ) col1 F
3520: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
3530: 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d  -24..-35..-89...
3540: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
3550: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
3560: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
3570: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
3580: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
3590: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35a0: 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e  T DISTINCT tab0.
35b0: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 31  col2 * col0 col1
35c0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
35d0: 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d  ..35..7298..792.
35e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35f0: 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 38  rt..SELECT ( + 8
3600: 30 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  0 ) FROM tab1..-
3610: 2d 2d 2d 0d 0a 38 30 0d 0a 38 30 0d 0a 38 30 0d  ---..80..80..80.
3620: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3630: 72 74 0d 0a 53 45 4c 45 43 54 20 36 32 20 2b 20  rt..SELECT 62 + 
3640: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
3650: 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 38 38 0d 0a 38  ----..100..88..8
3660: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
3670: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
3680: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
3690: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
36a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36b0: 2d 31 30 34 0d 0a 53 45 4c 45 43 54 20 2b 20 43  -104..SELECT + C
36c0: 41 53 54 28 20 34 20 41 53 20 53 49 47 4e 45 44  AST( 4 AS SIGNED
36d0: 20 29 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 30   ) + - tab1.col0
36e0: 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   DIV - col0 FROM
36f0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a   tab1..----..5..
3700: 35 0d 0a 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5..5....skipif m
3710: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
3720: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
3730: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
3740: 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20  ..SELECT + CAST 
3750: 28 20 34 20 41 53 20 49 4e 54 45 47 45 52 20 29  ( 4 AS INTEGER )
3760: 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2f   + - tab1.col0 /
3770: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
3780: 31 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 35 0d 0a 35  1..----..5..5..5
3790: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
37b0: 2b 20 31 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 13 AS col1 FRO
37c0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37d0: 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 33 0d 0a 31 33  ----..13..13..13
37e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3800: 39 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  92 * col1 * col0
3810: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
3820: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 38 38 38  b0..----..189888
3830: 0d 0a 33 31 32 33 34 30 0d 0a 37 34 35 31 30 38  ..312340..745108
3840: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3850: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
3860: 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  - col1 + cor0.co
3870: 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l0 * - col2 FROM
3880: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
3890: 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35 38 0d 0a 2d  ..-188..-3658..-
38a0: 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7693....query I 
38b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38c0: 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b  ALL ( + col1 ) +
38d0: 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20   - tab0.col1 AS 
38e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
38f0: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
3900: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
3910: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
3920: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
3930: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
3940: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
3950: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3960: 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  T + col1 + - col
3970: 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
3980: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3990: 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65  53..9..96....que
39a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
39b0: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 74 61 62 31  LECT col2 + tab1
39c0: 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 46  .col2 - + col1 F
39d0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
39e0: 31 30 34 0d 0a 31 37 39 0d 0a 38 32 0d 0a 0d 0a  104..179..82....
39f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3a00: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
3a10: 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  l1 + + col1 * - 
3a20: 28 20 38 32 20 29 20 41 53 20 63 6f 6c 32 20 46  ( 82 ) AS col2 F
3a30: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
3a40: 2d 31 33 37 37 0d 0a 2d 32 35 31 31 0d 0a 2d 34  -1377..-2511..-4
3a50: 37 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  779....query I r
3a60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
3a70: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a   col1 + - col2 *
3a80: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
3a90: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
3aa0: 0d 0a 32 30 37 39 32 36 0d 0a 37 33 37 32 36 37  ..207926..737267
3ab0: 0d 0a 38 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20  ..8722....query 
3ac0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3ad0: 54 20 2d 20 34 31 20 2b 20 63 6f 6c 32 20 41 53  T - 41 + col2 AS
3ae0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
3af0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
3b00: 31 34 0d 0a 2d 31 35 0d 0a 2d 33 0d 0a 0d 0a 71  14..-15..-3....q
3b10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3b20: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
3b30: 6f 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 - + cor0.col
3b40: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
3b50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a  or0..----..-21..
3b60: 33 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  33..4....query I
3b70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3b80: 20 41 4c 4c 20 2d 20 33 30 20 2b 20 63 6f 6c 31   ALL - 30 + col1
3b90: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
3ba0: 0d 0a 2d 31 33 0d 0a 31 0d 0a 32 39 0d 0a 0d 0a  ..-13..1..29....
3bb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3bc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 20 41 53  .SELECT ALL 8 AS
3bd0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
3be0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
3bf0: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
3c00: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
3c10: 68 69 6e 67 20 74 6f 20 33 33 30 36 39 61 64 63  hing to 33069adc
3c20: 33 63 31 31 34 32 64 33 31 35 31 31 65 63 38 38  3c1142d31511ec88
3c30: 66 63 66 61 34 30 61 66 0d 0a 0d 0a 71 75 65 72  fcfa40af....quer
3c40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3c50: 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 33 20  ECT DISTINCT 83 
3c60: 2a 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53  * - cor1.col1 AS
3c70: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c   col0 FROM tab2,
3c80: 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 31   tab0 cor0, tab1
3c90: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
3ca0: 2d 31 30 37 39 0d 0a 2d 32 31 35 38 0d 0a 2d 38  -1079..-2158..-8
3cb0: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
3cc0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
3cd0: 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  L - col0 * col2 
3ce0: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  * col1 FROM tab2
3cf0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
3d00: 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35  9652..-51034..-5
3d10: 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  859....query I r
3d20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
3d30: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a  ISTINCT - col2 *
3d40: 20 28 20 34 38 20 29 20 41 53 20 63 6f 6c 30 20   ( 48 ) AS col0 
3d50: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
3d60: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 34 0d 0a  0..----..-1584..
3d70: 2d 33 39 33 36 0d 0a 2d 34 38 0d 0a 0d 0a 71 75  -3936..-48....qu
3d80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3d90: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
3da0: 6c 30 20 2b 20 2d 20 34 20 46 52 4f 4d 20 74 61  l0 + - 4 FROM ta
3db0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
3dc0: 0d 0a 2d 36 38 0d 0a 2d 37 0d 0a 2d 38 34 0d 0a  ..-68..-7..-84..
3dd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3de0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
3df0: 6c 31 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20  l1 + ( - col2 ) 
3e00: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
3e10: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d  0..----..-119..-
3e20: 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72  173..-98....quer
3e30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3e40: 45 43 54 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 72  ECT - col0 - cor
3e50: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
3e60: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
3e70: 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d  0..-132..-180...
3e80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3e90: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
3ea0: 35 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  59 FROM tab0 AS 
3eb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 0d  cor0..----..148.
3ec0: 0a 38 33 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79  .83..94....query
3ed0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3ee0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
3ef0: 63 6f 6c 31 20 2d 20 35 34 20 46 52 4f 4d 20 74  col1 - 54 FROM t
3f00: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3f10: 2d 0d 0a 33 32 0d 0a 33 37 0d 0a 34 33 0d 0a 0d  -..32..37..43...
3f20: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
3f30: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
3f40: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
3f50: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
3f60: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
3f70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3f80: 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  T col2 * + col1 
3f90: 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 63  * + ( col1 ) + c
3fa0: 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
3fb0: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
3fc0: 31 30 32 30 0d 0a 32 35 39 37 34 0d 0a 39 30 35  1020..25974..905
3fd0: 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
3fe0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
3ff0: 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  l0 + - col2 AS c
4000: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
4010: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34  r0..----..-20..4
4020: 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..52....query I
4030: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4040: 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2a 20   ALL - + col0 * 
4050: 33 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  3 + col2 AS col0
4060: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
4070: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a  r0..----..-104..
4080: 2d 31 38 35 0d 0a 2d 33 39 0d 0a 0d 0a 73 6b 69  -185..-39....ski
4090: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
40a0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
40b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
40c0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
40d0: 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 34   col1 * CAST ( 4
40e0: 35 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d  5 AS REAL ) FROM
40f0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
4100: 2d 2d 2d 0d 0a 2d 33 38 37 30 0d 0a 2d 34 30 39  ---..-3870..-409
4110: 35 0d 0a 2d 34 33 36 35 0d 0a 0d 0a 6f 6e 6c 79  5..-4365....only
4120: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
4130: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
4140: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
4150: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
4160: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4170: 61 62 65 6c 2d 31 32 39 0d 0a 53 45 4c 45 43 54  abel-129..SELECT
4180: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
4190: 6c 30 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c  l0 * - CAST( NUL
41a0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
41b0: 2d 20 39 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 92 AS col2 FRO
41c0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
41d0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
41e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
41f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
4200: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4210: 65 6c 2d 31 32 39 0d 0a 53 45 4c 45 43 54 20 44  el-129..SELECT D
4220: 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30  ISTINCT - + col0
4230: 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   * - CAST ( NULL
4240: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
4250: 2d 20 39 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 92 AS col2 FRO
4260: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4270: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
4280: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4290: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
42a0: 6f 6c 32 20 2b 20 2b 20 32 39 20 46 52 4f 4d 20  ol2 + + 29 FROM 
42b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
42c0: 2d 2d 0d 0a 31 31 31 0d 0a 33 30 0d 0a 36 32 0d  --..111..30..62.
42d0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
42e0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
42f0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
4300: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
4310: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
4320: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4330: 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63  ECT + - col0 - c
4340: 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
4350: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4360: 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36 0d 0a 2d 35  ..-121..-176..-5
4370: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
4380: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
4390: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 35  TINCT - col2 * 5
43a0: 36 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  6 + col0 FROM ta
43b0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
43c0: 0d 0a 2d 31 38 32 34 0d 0a 2d 32 31 0d 0a 2d 34  ..-1824..-21..-4
43d0: 35 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  503....query I r
43e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
43f0: 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 63 6f 72   tab0.col1 * cor
4400: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
4410: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
4420: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
4430: 61 73 68 69 6e 67 20 74 6f 20 35 65 30 35 66 35  ashing to 5e05f5
4440: 30 63 63 35 31 65 39 36 36 64 37 65 30 35 35 61  0cc51e966d7e055a
4450: 31 31 33 64 33 30 61 35 65 30 0d 0a 0d 0a 71 75  113d30a5e0....qu
4460: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4470: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d  ELECT + col0 * -
4480: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
4490: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
44a0: 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31  49..-6084..-6241
44b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
44c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
44d0: 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32  b2.col2 * + col2
44e0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
44f0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a  b2..----..1444..
4500: 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 6f 6e 6c 79  676..729....only
4510: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
4520: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
4530: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
4540: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4550: 74 20 6c 61 62 65 6c 2d 31 33 36 0d 0a 53 45 4c  t label-136..SEL
4560: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
4570: 2d 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  - - col2 DIV - c
4580: 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
4590: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
45a0: 0d 0a 32 0d 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 73  ..2..63..79....s
45b0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
45c0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
45d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
45e0: 62 65 6c 2d 31 33 36 0d 0a 53 45 4c 45 43 54 20  bel-136..SELECT 
45f0: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20  + cor0.col0 - - 
4600: 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30 2e 63 6f  col2 / - cor0.co
4610: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
4620: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36  cor0..----..2..6
4630: 33 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..79....skipif 
4640: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
4650: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
4660: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
4670: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
4680: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4690: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
46a0: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 63   col2 * + col1 c
46b0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
46c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a  r0..----..1560..
46d0: 36 38 34 0d 0a 38 36 34 0d 0a 0d 0a 6f 6e 6c 79  684..864....only
46e0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
46f0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
4700: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
4710: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4720: 74 20 6c 61 62 65 6c 2d 31 33 38 0d 0a 53 45 4c  t label-138..SEL
4730: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
4740: 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  - + col1 * + col
4750: 30 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20  0 DIV + col0 AS 
4760: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
4770: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a  or0..----..-33..
4780: 2d 34 0d 0a 32 31 0d 0a 0d 0a 73 6b 69 70 69 66  -4..21....skipif
4790: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
47a0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
47b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
47c0: 33 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  38..SELECT + cor
47d0: 30 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20  0.col2 - + col1 
47e0: 2a 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  * + col0 / + col
47f0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
4800: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
4810: 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71  -33..-4..21....q
4820: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4830: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
4840: 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col1 + col2 FROM
4850: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
4860: 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31  ---..-33..-4..21
4870: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4880: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
4890: 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 74 61  l1 + col1 + - ta
48a0: 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b2.col0 FROM tab
48b0: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 34 30  2..----..-45..40
48c0: 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..55....query I 
48d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
48e0: 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
48f0: 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
4900: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
4910: 2d 0d 0a 2d 31 30 39 38 32 0d 0a 2d 32 35 39 34  -..-10982..-2594
4920: 37 0d 0a 2d 39 30 35 30 36 0d 0a 0d 0a 71 75 65  7..-90506....que
4930: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4940: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LECT - col2 + co
4950: 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  l2 * - col2 * + 
4960: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
4970: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
4980: 2d 0d 0a 2d 32 32 36 32 36 0d 0a 2d 32 34 35 38  -..-22626..-2458
4990: 36 0d 0a 2d 33 39 39 31 30 0d 0a 0d 0a 71 75 65  6..-39910....que
49a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
49b0: 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LECT cor0.col1 *
49c0: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
49d0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
49e0: 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39  064..-3395..-809
49f0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
4a00: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
4a10: 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 63   cor0.col2 - - c
4a20: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
4a30: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
4a40: 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37  ---..-16..-51..7
4a50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4a60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
4a70: 33 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  35 AS col2 FROM 
4a80: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
4a90: 2d 2d 0d 0a 2d 33 35 0d 0a 2d 33 35 0d 0a 2d 33  --..-35..-35..-3
4aa0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
4ab0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
4ac0: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol0 + + col1 * +
4ad0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
4ae0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
4af0: 36 0d 0a 36 37 33 0d 0a 38 39 0d 0a 0d 0a 71 75  6..673..89....qu
4b00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4b10: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
4b20: 20 38 39 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f   89 - col0 AS co
4b30: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
4b40: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33  cor0..----..-113
4b50: 0d 0a 2d 31 32 34 0d 0a 2d 31 37 38 0d 0a 0d 0a  ..-124..-178....
4b60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4b70: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
4b80: 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20 63 6f  cor0.col1 ) * co
4b90: 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 + col1 FROM t
4ba0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
4bb0: 2d 0d 0a 31 35 39 33 0d 0a 36 36 33 0d 0a 38 36  -..1593..663..86
4bc0: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
4bd0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
4be0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
4bf0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4c00: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4c10: 2d 31 34 39 0d 0a 53 45 4c 45 43 54 20 39 35 20  -149..SELECT 95 
4c20: 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV + col0 FROM 
4c30: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
4c40: 2d 2d 0d 0a 31 0d 0a 31 0d 0a 33 31 0d 0a 0d 0a  --..1..1..31....
4c50: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
4c60: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
4c70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4c80: 61 62 65 6c 2d 31 34 39 0d 0a 53 45 4c 45 43 54  abel-149..SELECT
4c90: 20 39 35 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f   95 / + col0 FRO
4ca0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
4cb0: 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 33 31 0d 0a  ----..1..1..31..
4cc0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
4cd0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
4ce0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
4cf0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
4d00: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
4d10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4d20: 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  CT + - col2 * co
4d30: 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f  r0.col2 col2 FRO
4d40: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4d50: 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37  ----..-1444..-67
4d60: 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 6f 6e 6c 79 69  6..-729....onlyi
4d70: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
4d80: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
4d90: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
4da0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4db0: 20 6c 61 62 65 6c 2d 31 35 31 0d 0a 53 45 4c 45   label-151..SELE
4dc0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
4dd0: 6c 32 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c 32  l2 DIV col1 col2
4de0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
4df0: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
4e00: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
4e10: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
4e20: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
4e30: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
4e40: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
4e50: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
4e60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4e70: 61 62 65 6c 2d 31 35 31 0d 0a 53 45 4c 45 43 54  abel-151..SELECT
4e80: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
4e90: 20 2f 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f   / col1 col2 FRO
4ea0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
4eb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
4ec0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 31  rt..SELECT + + 1
4ed0: 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
4ee0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
4ef0: 2d 0d 0a 31 35 0d 0a 31 35 0d 0a 31 35 0d 0a 0d  -..15..15..15...
4f00: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
4f10: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
4f20: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
4f30: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
4f40: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33  owsort label-153
4f50: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
4f60: 30 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b  0 + - col2 DIV +
4f70: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
4f80: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
4f90: 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 36 39 0d 0a  .----..-5..-69..
4fa0: 2d 38 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -87....skipif my
4fb0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
4fc0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
4fd0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 0d  wsort label-153.
4fe0: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
4ff0: 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f   + - col2 / + co
5000: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
5010: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
5020: 2d 2d 0d 0a 2d 35 0d 0a 2d 36 39 0d 0a 2d 38 37  --..-5..-69..-87
5030: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5040: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
5050: 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f  l2 * col0 - + co
5060: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
5070: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
5080: 2d 2d 0d 0a 31 36 32 0d 0a 32 30 30 32 0d 0a 32  --..162..2002..2
5090: 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  964....query I r
50a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
50b0: 20 35 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   51 AS col1 FROM
50c0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31   tab2..----..-51
50d0: 0d 0a 2d 35 31 0d 0a 2d 35 31 0d 0a 0d 0a 71 75  ..-51..-51....qu
50e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
50f0: 45 4c 45 43 54 20 2b 20 39 39 20 2b 20 63 6f 6c  ELECT + 99 + col
5100: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
5110: 2d 0d 0a 31 30 30 0d 0a 31 33 32 0d 0a 31 38 31  -..100..132..181
5120: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5130: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5140: 49 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20  INCT + ( + col0 
5150: 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
5160: 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
5170: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
5180: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
5190: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
51a0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
51b0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
51c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
51d0: 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  T cor0.col2 * co
51e0: 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
51f0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5200: 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30  .1248..1404..570
5210: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5220: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
5230: 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  - col1 * - col1 
5240: 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20  * ( - col2 ) AS 
5250: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
5260: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 30  or0..----..-2440
5270: 36 38 0d 0a 2d 36 37 39 30 34 32 0d 0a 2d 39 34  68..-679042..-94
5280: 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
5290: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
52a0: 32 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  20 AS col1 FROM 
52b0: 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
52c0: 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
52d0: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
52e0: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 62 33  s hashing to eb3
52f0: 61 36 36 37 32 38 30 36 32 39 36 33 63 63 63 62  a66728062963cccb
5300: 64 31 35 62 64 32 66 35 63 39 65 65 65 0d 0a 0d  d15bd2f5c9eee...
5310: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5320: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
5330: 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b  T + col0 + + ( +
5340: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20   col1 ) AS col2 
5350: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5360: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
5370: 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20  2..180....query 
5380: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5390: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
53a0: 6f 6c 30 20 2a 20 2d 20 28 20 39 36 20 29 20 2a  ol0 * - ( 96 ) *
53b0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
53c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
53d0: 33 39 33 32 31 36 0d 0a 2d 36 31 34 34 30 30 0d  393216..-614400.
53e0: 0a 2d 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-864....query I
53f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5400: 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20   col1 * col2 AS 
5410: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
5420: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
5430: 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a  38..7462..97....
5440: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5450: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
5460: 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l2 * col1 + + co
5470: 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l1 * col1 * col1
5480: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
5490: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 30 0d 0a  r0..----..1570..
54a0: 31 38 39 38 30 0d 0a 33 34 34 35 0d 0a 0d 0a 6f  18980..3445....o
54b0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
54c0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
54d0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
54e0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
54f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5500: 74 20 6c 61 62 65 6c 2d 31 36 35 0d 0a 53 45 4c  t label-165..SEL
5510: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
5520: 6f 6c 32 20 2a 20 43 41 53 54 28 20 2b 20 63 6f  ol2 * CAST( + co
5530: 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  l2 AS SIGNED ) +
5540: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
5550: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
5560: 0a 2d 31 30 30 33 0d 0a 2d 36 36 33 33 0d 0a 39  .-1003..-6633..9
5570: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
5580: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
5590: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
55a0: 6f 72 74 20 6c 61 62 65 6c 2d 31 36 35 0d 0a 53  ort label-165..S
55b0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
55c0: 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 2b   col2 * CAST ( +
55d0: 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
55e0: 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) + + col1 FROM
55f0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
5600: 2d 2d 2d 0d 0a 2d 31 30 30 33 0d 0a 2d 36 36 33  ---..-1003..-663
5610: 33 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..96....onlyif 
5620: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
5630: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
5640: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
5650: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5660: 61 62 65 6c 2d 31 36 36 0d 0a 53 45 4c 45 43 54  abel-166..SELECT
5670: 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20   ALL - col2 + + 
5680: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 46 52  col1 DIV col0 FR
5690: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
56a0: 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d 38 31 0d  .----..-30..-81.
56b0: 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
56c0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
56d0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
56e0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 36 0d 0a  sort label-166..
56f0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
5700: 32 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c  2 + + col1 / col
5710: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
5720: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a  or0..----..-30..
5730: 2d 38 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  -81..1....skipif
5740: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
5750: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
5760: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
5770: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
5780: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
5790: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
57a0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63   + cor0.col1 * c
57b0: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63  ol2 + + col1 * c
57c0: 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
57d0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
57e0: 0d 0a 2d 31 33 32 36 0d 0a 2d 32 30 38 0d 0a 37  ..-1326..-208..7
57f0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
5800: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
5810: 20 63 6f 6c 31 20 2b 20 2d 20 32 39 20 41 53 20   col1 + - 29 AS 
5820: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
5830: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
5840: 31 35 0d 0a 2d 31 32 30 0d 0a 2d 31 32 36 0d 0a  15..-120..-126..
5850: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5860: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
5870: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63 6f  CT + - col0 - co
5880: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
5890: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 38  cor0..----..-128
58a0: 0d 0a 2d 31 36 30 0d 0a 2d 36 0d 0a 0d 0a 71 75  ..-160..-6....qu
58b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
58c0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
58d0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   + cor0.col1 + -
58e0: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41   col2 * + col2 A
58f0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
5900: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
5910: 31 32 0d 0a 2d 32 36 37 39 0d 0a 2d 37 39 36 38  12..-2679..-7968
5920: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
5930: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
5940: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
5950: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
5960: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5970: 31 37 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  171..SELECT DIST
5980: 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  INCT - col0 + co
5990: 72 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30  r0.col1 DIV col0
59a0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
59b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
59c0: 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 35 0d 0a 0d  ..-64..-80..5...
59d0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
59e0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
59f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5a00: 6c 61 62 65 6c 2d 31 37 31 0d 0a 53 45 4c 45 43  label-171..SELEC
5a10: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
5a20: 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20  0 + cor0.col1 / 
5a30: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
5a40: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
5a50: 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a  ----..-64..-80..
5a60: 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
5a70: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
5a80: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
5a90: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
5aa0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
5ab0: 2d 31 37 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -172..SELECT - c
5ac0: 6f 6c 32 20 44 49 56 20 2b 20 28 20 2b 20 63 6f  ol2 DIV + ( + co
5ad0: 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74  r0.col0 ) FROM t
5ae0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
5af0: 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30 0d 0a 0d  -..-1..-18..0...
5b00: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5b10: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5b20: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5b30: 6c 61 62 65 6c 2d 31 37 32 0d 0a 53 45 4c 45 43  label-172..SELEC
5b40: 54 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 28 20 2b  T - col2 / + ( +
5b50: 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f   cor0.col0 ) FRO
5b60: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
5b70: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30  ----..-1..-18..0
5b80: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5b90: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5ba0: 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  INCT + - col1 * 
5bb0: 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e  - col2 + - cor0.
5bc0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
5bd0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
5be0: 2d 2d 2d 2d 0d 0a 31 31 36 38 0d 0a 31 34 30 31  ----..1168..1401
5bf0: 0d 0a 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..506....query I
5c00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5c10: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
5c20: 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l1 * col2 + col0
5c30: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
5c40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36 38 0d  r0..----..-1168.
5c50: 0a 2d 31 34 30 31 0d 0a 2d 35 30 36 0d 0a 0d 0a  .-1401..-506....
5c60: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
5c70: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
5c80: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
5c90: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
5ca0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 35 0d  wsort label-175.
5cb0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
5cc0: 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 28 20   - col2 DIV - ( 
5cd0: 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 46 52  col0 ) + col0 FR
5ce0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
5cf0: 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 35 0d 0a 38  .----..25..35..8
5d00: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
5d10: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
5d20: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
5d30: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 35 0d 0a 53  ort label-175..S
5d40: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
5d50: 20 63 6f 6c 32 20 2f 20 2d 20 28 20 63 6f 6c 30   col2 / - ( col0
5d60: 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   ) + col0 FROM t
5d70: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
5d80: 2d 0d 0a 32 35 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..25..35..89...
5d90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5da0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
5db0: 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 * cor0.col1 
5dc0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
5dd0: 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32  ----..2838..7462
5de0: 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..97....onlyif m
5df0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
5e00: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
5e10: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
5e20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
5e30: 62 65 6c 2d 31 37 37 0d 0a 53 45 4c 45 43 54 20  bel-177..SELECT 
5e40: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20  DISTINCT col2 + 
5e50: 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c  - col2 DIV + col
5e60: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
5e70: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
5e80: 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39 35 0d 0a 0d  -..53..56..95...
5e90: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5ea0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5eb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5ec0: 6c 61 62 65 6c 2d 31 37 37 0d 0a 53 45 4c 45 43  label-177..SELEC
5ed0: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
5ee0: 2b 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  + - col2 / + col
5ef0: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
5f00: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
5f10: 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39 35 0d 0a 0d  -..53..56..95...
5f20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5f30: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
5f40: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63  ol1 * - col2 + c
5f50: 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 * + cor0.col
5f60: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
5f70: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
5f80: 2d 0d 0a 2d 31 33 39 35 0d 0a 33 35 32 36 0d 0a  -..-1395..3526..
5f90: 35 31 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5152....query I 
5fa0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5fb0: 2b 20 63 6f 6c 31 20 2a 20 32 37 20 2a 20 2b 20  + col1 * 27 * + 
5fc0: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
5fd0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
5fe0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 34 38 30 0d  r0..----..17480.
5ff0: 0a 32 32 36 32 36 0d 0a 34 31 34 34 34 0d 0a 0d  .22626..41444...
6000: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6010: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
6020: 30 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c  0 * + col1 - col
6030: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
6040: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 38  or0..----..-2088
6050: 0d 0a 2d 33 34 33 30 0d 0a 2d 38 31 38 38 0d 0a  ..-3430..-8188..
6060: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
6070: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
6080: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
6090: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
60a0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38  rowsort label-18
60b0: 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44  1..SELECT col1 D
60c0: 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  IV + col2 + - co
60d0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
60e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d  cor0..----..-84.
60f0: 0a 2d 39 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  .-90..0....skipi
6100: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
6110: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
6120: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
6130: 31 38 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  181..SELECT col1
6140: 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   / + col2 + - co
6150: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
6160: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d  cor0..----..-84.
6170: 0a 2d 39 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  .-90..0....query
6180: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6190: 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  CT + col2 + + co
61a0: 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  l1 * col2 + + co
61b0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
61c0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
61d0: 0a 31 35 38 36 0d 0a 37 32 32 0d 0a 38 39 31 0d  .1586..722..891.
61e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
61f0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
6200: 20 37 37 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20   77 * - col1 AS 
6210: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
6220: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
6230: 36 32 32 0d 0a 2d 37 30 30 37 0d 0a 2d 37 34 36  622..-7007..-746
6240: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
6250: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35  sort..SELECT + 5
6260: 39 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  9 + - col2 FROM 
6270: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
6280: 2d 2d 0d 0a 32 31 0d 0a 33 32 0d 0a 33 33 0d 0a  --..21..32..33..
6290: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
62a0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
62b0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
62c0: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
62d0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
62e0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 35 0d 0a  sort label-185..
62f0: 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31  SELECT cor0.col1
6300: 20 2a 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b   * col2 / col0 +
6310: 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
6320: 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f   SIGNED ) * - co
6330: 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 + + col1 AS c
6340: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
6350: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
6360: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
6370: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
6380: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
6390: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
63a0: 6c 61 62 65 6c 2d 31 38 35 0d 0a 53 45 4c 45 43  label-185..SELEC
63b0: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  T cor0.col1 * co
63c0: 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 43 41  l2 / col0 + + CA
63d0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
63e0: 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 30 20  EGER ) * - col0 
63f0: 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  + + col1 AS col0
6400: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
6410: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
6420: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
6430: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6440: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 31 20  ELECT ALL - + 1 
6450: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6460: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
6470: 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 6f  .-1..-1..-1....o
6480: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
6490: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
64a0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
64b0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
64c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
64d0: 74 20 6c 61 62 65 6c 2d 31 38 37 0d 0a 53 45 4c  t label-187..SEL
64e0: 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53  ECT col0 * - CAS
64f0: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
6500: 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  D ) AS col1 FROM
6510: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
6520: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
6530: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
6540: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
6550: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6560: 6c 61 62 65 6c 2d 31 38 37 0d 0a 53 45 4c 45 43  label-187..SELEC
6570: 54 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20  T col0 * - CAST 
6580: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
6590: 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
65a0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
65b0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
65c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
65d0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
65e0: 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  or0.col2 + col1 
65f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
6600: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33  0..----..-21..33
6610: 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..4....query I r
6620: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
6630: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30   - col2 + + col0
6640: 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
6650: 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
6660: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d 0a 31 36 33  ..----..134..163
6670: 0d 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..65....query I 
6680: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6690: 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 31 35 20  DISTINCT + + 15 
66a0: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
66b0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
66c0: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 0d 0a 31 39 35  ..----..150..195
66d0: 0d 0a 33 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..390....query I
66e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
66f0: 20 2b 20 32 38 20 2b 20 32 31 20 2a 20 63 6f 6c   + 28 + 21 * col
6700: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
6710: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35 30 0d  or0..----..1750.
6720: 0a 34 39 0d 0a 37 32 31 0d 0a 0d 0a 71 75 65 72  .49..721....quer
6730: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6740: 45 43 54 20 41 4c 4c 20 2d 20 37 20 46 52 4f 4d  ECT ALL - 7 FROM
6750: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
6760: 0d 0a 2d 37 0d 0a 2d 37 0d 0a 2d 37 0d 0a 0d 0a  ..-7..-7..-7....
6770: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6780: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
6790: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  col0 * col2 * - 
67a0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col1 + + col0 AS
67b0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
67c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
67d0: 33 33 36 30 0d 0a 2d 36 36 34 30 32 39 0d 0a 2d  3360..-664029..-
67e0: 36 38 30 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  68088....query I
67f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6800: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
6810: 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   + col1 + + col1
6820: 20 2b 20 2b 20 34 30 20 46 52 4f 4d 20 74 61 62   + + 40 FROM tab
6830: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 32 39  0..----..234..29
6840: 36 34 0d 0a 37 35 39 33 0d 0a 0d 0a 6f 6e 6c 79  64..7593....only
6850: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
6860: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
6870: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
6880: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6890: 74 20 6c 61 62 65 6c 2d 31 39 35 0d 0a 53 45 4c  t label-195..SEL
68a0: 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 63  ECT - col2 DIV c
68b0: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2d  ol0 + + col2 - -
68c0: 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
68d0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
68e0: 2d 2d 0d 0a 31 36 34 0d 0a 32 0d 0a 36 35 0d 0a  --..164..2..65..
68f0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
6900: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
6910: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6920: 20 6c 61 62 65 6c 2d 31 39 35 0d 0a 53 45 4c 45   label-195..SELE
6930: 43 54 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 30  CT - col2 / col0
6940: 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 74 61   + + col2 - - ta
6950: 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  b0.col2 AS col1 
6960: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
6970: 0a 31 36 34 0d 0a 32 0d 0a 36 35 0d 0a 0d 0a 73  .164..2..65....s
6980: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
6990: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
69a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
69b0: 45 4c 45 43 54 20 43 41 53 54 20 28 20 2b 20 63  ELECT CAST ( + c
69c0: 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20 2b 20  ol2 AS REAL ) + 
69d0: 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab2.col1 AS col
69e0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
69f0: 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d  -..55..58..85...
6a00: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
6a10: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
6a20: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
6a30: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
6a40: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
6a50: 6f 72 74 20 6c 61 62 65 6c 2d 31 39 37 0d 0a 53  ort label-197..S
6a60: 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55  ELECT + CAST( NU
6a70: 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
6a80: 2a 20 37 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 70 AS col2 FRO
6a90: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
6aa0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
6ab0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
6ac0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
6ad0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6ae0: 20 6c 61 62 65 6c 2d 31 39 37 0d 0a 53 45 4c 45   label-197..SELE
6af0: 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
6b00: 20 41 53 20 52 45 41 4c 20 29 20 2a 20 37 30 20   AS REAL ) * 70 
6b10: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6b20: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
6b30: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
6b40: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6b50: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
6b60: 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46  l2 + cor0.col1 F
6b70: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
6b80: 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 39 36 39  ---..-158..-1969
6b90: 0d 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79  ..-2985....query
6ba0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6bb0: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20  CT ALL - + col0 
6bc0: 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
6bd0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
6be0: 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
6bf0: 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79  ..-7680....query
6c00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6c10: 43 54 20 2d 20 32 33 20 2a 20 63 6f 6c 31 20 46  CT - 23 * col1 F
6c20: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
6c30: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 30 0d 0a 2d 32  ..----..-230..-2
6c40: 39 39 0d 0a 2d 35 39 38 0d 0a 0d 0a 71 75 65 72  99..-598....quer
6c50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6c60: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 32 31 20 2a  ECT ALL - + 21 *
6c70: 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
6c80: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
6c90: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
6ca0: 2d 0d 0a 2d 31 33 35 36 36 0d 0a 2d 31 37 35 37  -..-13566..-1757
6cb0: 37 0d 0a 2d 33 32 32 31 34 0d 0a 0d 0a 6f 6e 6c  7..-32214....onl
6cc0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
6cd0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
6ce0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
6cf0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
6d00: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6d10: 6c 61 62 65 6c 2d 32 30 32 0d 0a 53 45 4c 45 43  label-202..SELEC
6d20: 54 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72  T - col2 / - cor
6d30: 30 2e 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20 63  0.col0 + + ( - c
6d40: 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2b 20 63  or0.col2 ) * + c
6d50: 6f 6c 30 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ol0 + CAST( NULL
6d60: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
6d70: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
6d80: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
6d90: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
6da0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
6db0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6dc0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
6dd0: 30 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  02..SELECT - col
6de0: 32 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  2 / - cor0.col0 
6df0: 2b 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  + + ( - cor0.col
6e00: 32 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 43  2 ) * + col0 + C
6e10: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
6e20: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
6e30: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6e40: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
6e50: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
6e60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
6e70: 20 2b 20 39 35 20 2a 20 2b 20 63 6f 6c 32 20 46   + 95 * + col2 F
6e80: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
6e90: 0d 0a 2d 2d 2d 2d 0d 0a 35 31 33 30 0d 0a 35 34  ..----..5130..54
6ea0: 31 35 0d 0a 39 31 32 30 0d 0a 0d 0a 71 75 65 72  15..9120....quer
6eb0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6ec0: 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72  ECT - col0 + cor
6ed0: 30 2e 63 6f 6c 30 20 2b 20 2d 20 32 30 20 46 52  0.col0 + - 20 FR
6ee0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
6ef0: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 30 0d  .----..-20..-20.
6f00: 0a 2d 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-20....query I 
6f10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6f20: 41 4c 4c 20 2d 20 2b 20 36 37 20 2b 20 63 6f 6c  ALL - + 67 + col
6f30: 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
6f40: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 35 30  ..----..-36..-50
6f50: 0d 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-8....query I 
6f60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6f70: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28 20 2d  DISTINCT - - ( -
6f80: 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 41   col2 ) + col0 A
6f90: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
6fa0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6fb0: 2d 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71  -20..41..52....q
6fc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6fd0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 38 20  SELECT ALL - 48 
6fe0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
6ff0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
7000: 0a 2d 34 38 0d 0a 2d 34 38 0d 0a 2d 34 38 0d 0a  .-48..-48..-48..
7010: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
7020: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
7030: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
7040: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
7050: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
7060: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 38 0d 0a  sort label-208..
7070: 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20  SELECT - - col2 
7080: 2a 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20 4e  * col0 + CAST( N
7090: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
70a0: 2a 20 2d 20 28 20 2b 20 63 6f 6c 31 20 2b 20 63  * - ( + col1 + c
70b0: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 29 20 46  ol2 * + col0 ) F
70c0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
70d0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
70e0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
70f0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
7100: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
7110: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7120: 2d 32 30 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -208..SELECT - -
7130: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 43   col2 * col0 + C
7140: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
7150: 54 45 47 45 52 20 29 20 2a 20 2d 20 28 20 2b 20  TEGER ) * - ( + 
7160: 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  col1 + col2 * + 
7170: 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31  col0 ) FROM tab1
7180: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7190: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
71a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
71b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
71c0: 49 4e 43 54 20 2b 20 2d 20 36 34 20 2a 20 63 6f  INCT + - 64 * co
71d0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
71e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38  cor0..----..-108
71f0: 38 0d 0a 2d 31 39 38 34 0d 0a 2d 33 37 37 36 0d  8..-1984..-3776.
7200: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7210: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7220: 4e 43 54 20 2d 20 35 30 20 41 53 20 63 6f 6c 30  NCT - 50 AS col0
7230: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
7240: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7250: 2d 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -50....onlyif my
7260: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
7270: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
7280: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
7290: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
72a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
72b0: 32 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  211..SELECT - co
72c0: 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  l0 * cor0.col0 +
72d0: 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
72e0: 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f   SIGNED ) + - co
72f0: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
7300: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
7310: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
7320: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
7330: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
7340: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
7350: 6f 72 74 20 6c 61 62 65 6c 2d 32 31 31 0d 0a 53  ort label-211..S
7360: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  ELECT - col0 * c
7370: 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 43 41 53  or0.col0 + + CAS
7380: 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
7390: 47 45 52 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63  GER ) + - cor0.c
73a0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
73b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
73c0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
73d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
73e0: 0d 0a 53 45 4c 45 43 54 20 31 34 20 41 53 20 63  ..SELECT 14 AS c
73f0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
7400: 2d 2d 2d 0d 0a 31 34 0d 0a 31 34 0d 0a 31 34 0d  ---..14..14..14.
7410: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
7420: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
7430: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
7440: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
7450: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
7460: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7470: 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ECT + col2 + col
7480: 32 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 63 6f  2 * tab2.col1 co
7490: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
74a0: 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38  --..1560..684..8
74b0: 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  64....onlyif mys
74c0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
74d0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
74e0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
74f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7500: 6c 2d 32 31 34 0d 0a 53 45 4c 45 43 54 20 41 4c  l-214..SELECT AL
7510: 4c 20 32 36 20 2a 20 63 6f 6c 31 20 44 49 56 20  L 26 * col1 DIV 
7520: 2d 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  - tab1.col1 AS c
7530: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
7540: 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 36 0d 0a 2d  ---..-26..-26..-
7550: 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
7560: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
7570: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
7580: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 34 0d 0a  sort label-214..
7590: 53 45 4c 45 43 54 20 41 4c 4c 20 32 36 20 2a 20  SELECT ALL 26 * 
75a0: 63 6f 6c 31 20 2f 20 2d 20 74 61 62 31 2e 63 6f  col1 / - tab1.co
75b0: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
75c0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  tab1..----..-26.
75d0: 0a 2d 32 36 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65  .-26..-26....que
75e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
75f0: 4c 45 43 54 20 41 4c 4c 20 2d 20 38 39 20 2a 20  LECT ALL - 89 * 
7600: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
7610: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7620: 32 36 37 0d 0a 35 36 39 36 0d 0a 37 31 32 30 0d  267..5696..7120.
7630: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7640: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
7650: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   + cor0.col2 * +
7660: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
7670: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
7680: 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d  1..-1089..-6724.
7690: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
76a0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35  rt..SELECT ALL 5
76b0: 37 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2d  7 + col0 + + ( -
76c0: 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
76d0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37  0 cor0..----..57
76e0: 0d 0a 35 37 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70  ..57..57....skip
76f0: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
7700: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
7710: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
7720: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
7730: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
7740: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
7750: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a  TINCT + + col1 *
7760: 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 63   + col1 - col1 c
7770: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
7780: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 31 30 0d 0a  r0..----..7310..
7790: 38 31 39 30 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75  8190..9312....qu
77a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
77b0: 45 4c 45 43 54 20 2b 20 28 20 28 20 2b 20 63 6f  ELECT + ( ( + co
77c0: 6c 30 20 29 20 29 20 41 53 20 63 6f 6c 30 20 46  l0 ) ) AS col0 F
77d0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
77e0: 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a  ..----..24..35..
77f0: 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  89....skipif pos
7800: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
7810: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
7820: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
7830: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
7840: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7850: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
7860: 37 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  72 + col1 * col1
7870: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
7880: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 31 0d 0a 2d 37  .----..-1271..-7
7890: 36 37 0d 0a 2d 39 33 35 0d 0a 0d 0a 6f 6e 6c 79  67..-935....only
78a0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
78b0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
78c0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
78d0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
78e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
78f0: 61 62 65 6c 2d 32 32 31 0d 0a 53 45 4c 45 43 54  abel-221..SELECT
7900: 20 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20   0 * - col2 + - 
7910: 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 4e  col2 * - CAST( N
7920: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
7930: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
7940: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
7950: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
7960: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
7970: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
7980: 6f 72 74 20 6c 61 62 65 6c 2d 32 32 31 0d 0a 53  ort label-221..S
7990: 45 4c 45 43 54 20 30 20 2a 20 2d 20 63 6f 6c 32  ELECT 0 * - col2
79a0: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 43 41   + - col2 * - CA
79b0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
79c0: 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31  EGER ) FROM tab1
79d0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
79e0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
79f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7a00: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34  ECT DISTINCT + 4
7a10: 35 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  5 + cor0.col1 * 
7a20: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
7a30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
7a40: 34 0d 0a 2d 35 35 0d 0a 2d 36 33 31 0d 0a 0d 0a  4..-55..-631....
7a50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7a60: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 38 31  .SELECT ALL + 81
7a70: 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   + - ( + col2 ) 
7a80: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
7a90: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 32 34  1..----..-15..24
7aa0: 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..27....query I 
7ab0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7ac0: 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b  ALL ( + col1 ) +
7ad0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
7ae0: 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39  .----..29..74..9
7af0: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
7b00: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
7b10: 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20   + ( col1 ) + - 
7b20: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
7b30: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
7b40: 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a  ----..-54..-67..
7b50: 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  23....onlyif mys
7b60: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
7b70: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
7b80: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
7b90: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7ba0: 6c 2d 32 32 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-226..SELECT AL
7bb0: 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  L cor0.col1 + + 
7bc0: 32 30 20 2b 20 63 6f 6c 31 20 44 49 56 20 31 31  20 + col1 DIV 11
7bd0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
7be0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31  r0..----..113..1
7bf0: 31 39 0d 0a 31 32 35 0d 0a 0d 0a 73 6b 69 70 69  19..125....skipi
7c00: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
7c10: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
7c20: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7c30: 32 32 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  226..SELECT ALL 
7c40: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 32 30  cor0.col1 + + 20
7c50: 20 2b 20 63 6f 6c 31 20 2f 20 31 31 20 46 52 4f   + col1 / 11 FRO
7c60: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
7c70: 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 31 39 0d 0a  ----..113..119..
7c80: 31 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  125....query I r
7c90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
7ca0: 20 36 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   65 AS col2 FROM
7cb0: 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63   tab2, tab2 AS c
7cc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
7cd0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
7ce0: 62 65 66 32 65 61 31 66 30 35 66 33 35 31 34 36  bef2ea1f05f35146
7cf0: 33 33 66 38 35 31 33 31 32 62 64 64 38 30 35 0d  33f851312bdd805.
7d00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7d10: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28  rt..SELECT - + (
7d20: 20 2b 20 35 33 20 29 20 46 52 4f 4d 20 74 61 62   + 53 ) FROM tab
7d30: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
7d40: 0a 2d 35 33 0d 0a 2d 35 33 0d 0a 2d 35 33 0d 0a  .-53..-53..-53..
7d50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7d60: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
7d70: 2d 20 28 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63  - ( col2 ) + - c
7d80: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
7d90: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
7da0: 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79  .16..51....query
7db0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7dc0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
7dd0: 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20  l2 * ( - col0 ) 
7de0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
7df0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
7e00: 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
7e10: 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
7e20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
7e30: 49 53 54 49 4e 43 54 20 2d 20 2b 20 35 37 20 2b  ISTINCT - + 57 +
7e40: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
7e50: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
7e60: 32 34 0d 0a 2d 35 36 0d 0a 32 35 0d 0a 0d 0a 71  24..-56..25....q
7e70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7e80: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7e90: 39 37 20 2b 20 38 33 20 46 52 4f 4d 20 74 61 62  97 + 83 FROM tab
7ea0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
7eb0: 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .180....query I 
7ec0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7ed0: 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  + + col1 * - col
7ee0: 32 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 - + col1 AS co
7ef0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
7f00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36  cor0..----..-126
7f10: 31 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38 30 0d 0a  1..-1430..-580..
7f20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7f30: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
7f40: 43 54 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f  CT cor1.col1 FRO
7f50: 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
7f60: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
7f70: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31  r1..----..17..31
7f80: 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..59....query I 
7f90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7fa0: 41 4c 4c 20 2d 20 2b 20 36 38 20 2a 20 36 37 20  ALL - + 68 * 67 
7fb0: 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
7fc0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7fd0: 0d 0a 2d 34 35 38 30 0d 0a 2d 34 35 39 31 0d 0a  ..-4580..-4591..
7fe0: 2d 34 36 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49  -4645....query I
7ff0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8000: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 39 38 20 2a   - col2 + + 98 *
8010: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
8020: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
8030: 0a 2d 2d 2d 2d 0d 0a 32 35 32 32 0d 0a 32 36 31  .----..2522..261
8040: 39 0d 0a 33 36 38 36 0d 0a 0d 0a 71 75 65 72 79  9..3686....query
8050: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8060: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
8070: 63 6f 6c 30 20 2b 20 31 35 20 2b 20 63 6f 6c 30  col0 + 15 + col0
8080: 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
8090: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
80a0: 2d 37 31 39 34 0d 0a 2d 37 35 33 0d 0a 31 35 0d  -7194..-753..15.
80b0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
80c0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
80d0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
80e0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
80f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8100: 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  38..SELECT col1 
8110: 2b 20 2b 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  + + col1 DIV - c
8120: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
8130: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d   cor0..----..85.
8140: 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  .90..96....skipi
8150: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
8160: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
8170: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8180: 32 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  238..SELECT col1
8190: 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63 6f   + + col1 / - co
81a0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
81b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a  cor0..----..85..
81c0: 39 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  90..96....query 
81d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
81e0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2b  T ALL + col1 * +
81f0: 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
8200: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
8210: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d  cor0..----..289.
8220: 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 71 75  .3481..961....qu
8230: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8240: 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  ELECT + - cor0.c
8250: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ol1 + + col0 * c
8260: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 * + col0 AS 
8270: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
8280: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
8290: 0a 32 36 32 31 33 34 0d 0a 35 31 31 39 38 37 0d  .262134..511987.
82a0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
82b0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
82c0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
82d0: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
82e0: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
82f0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 31 0d  wsort label-241.
8300: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
8310: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
8320: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
8330: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8340: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
8350: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
8360: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
8370: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
8380: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 31 0d  wsort label-241.
8390: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
83a0: 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
83b0: 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
83c0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
83d0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
83e0: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
83f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8400: 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2d 20 2d 20   ALL + col2 - - 
8410: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
8420: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
8430: 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72  4..2..66....quer
8440: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8450: 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29  ECT + ( - col1 )
8460: 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b   * col0 * col2 +
8470: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
8480: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
8490: 2d 2d 0d 0a 2d 33 33 39 34 0d 0a 2d 36 36 34 30  --..-3394..-6640
84a0: 33 36 0d 0a 2d 36 38 30 37 39 0d 0a 0d 0a 71 75  36..-68079....qu
84b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
84c0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 31 2e 63  ELECT ALL cor1.c
84d0: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
84e0: 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
84f0: 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
8500: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
8510: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 65  es hashing to 1e
8520: 31 66 31 30 39 35 33 65 62 38 65 66 66 65 39 62  1f10953eb8effe9b
8530: 32 30 65 37 34 36 66 38 61 37 66 64 38 33 0d 0a  20e746f8a7fd83..
8540: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8550: 74 0d 0a 53 45 4c 45 43 54 20 35 31 20 41 53 20  t..SELECT 51 AS 
8560: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
8570: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
8580: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
8590: 68 69 6e 67 20 74 6f 20 64 38 62 66 30 61 30 35  hing to d8bf0a05
85a0: 63 39 63 34 64 32 61 39 33 38 31 32 64 31 30 36  c9c4d2a93812d106
85b0: 62 61 61 65 34 37 35 32 0d 0a 0d 0a 71 75 65 72  baae4752....quer
85c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
85d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38  ECT DISTINCT - 8
85e0: 31 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63  1 + - col2 - - c
85f0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
8600: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
8610: 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 37 32 0d 0a 31  ---..-28..-72..1
8620: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
8630: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8640: 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20  TINCT cor0.col0 
8650: 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
8660: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
8670: 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d  ..110..132..180.
8680: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8690: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34  rt..SELECT - - 4
86a0: 36 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  6 * - col0 AS co
86b0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
86c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 32  cor0..----..-322
86d0: 0d 0a 2d 33 35 38 38 0d 0a 2d 33 36 33 34 0d 0a  ..-3588..-3634..
86e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
86f0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
8700: 43 54 20 2d 20 37 35 20 2a 20 63 6f 72 30 2e 63  CT - 75 * cor0.c
8710: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 * - col0 FRO
8720: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
8730: 2d 2d 2d 2d 0d 0a 31 34 31 37 35 0d 0a 31 35 32  ----..14175..152
8740: 31 30 30 0d 0a 32 32 35 31 35 30 0d 0a 0d 0a 71  100..225150....q
8750: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8760: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
8770: 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  2 + - col2 AS co
8780: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
8790: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d  cor0..----..-52.
87a0: 0a 2d 35 34 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65  .-54..-76....que
87b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
87c0: 4c 45 43 54 20 2d 20 28 20 63 6f 72 30 2e 63 6f  LECT - ( cor0.co
87d0: 6c 32 20 2b 20 32 34 20 29 20 41 53 20 63 6f 6c  l2 + 24 ) AS col
87e0: 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
87f0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8800: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
8810: 67 20 74 6f 20 32 34 30 39 39 39 32 64 32 30 37  g to 2409992d207
8820: 31 66 36 32 61 34 33 35 35 63 38 35 38 31 37 37  1f62a4355c858177
8830: 37 31 30 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  71062....query I
8840: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8850: 20 44 49 53 54 49 4e 43 54 20 32 33 20 2b 20 2b   DISTINCT 23 + +
8860: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 46   col0 * + col2 F
8870: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
8880: 31 38 35 0d 0a 33 36 37 31 0d 0a 37 37 30 33 0d  185..3671..7703.
8890: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
88a0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
88b0: 31 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  1 * col0 - + col
88c0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
88d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37 0d  or0..----..1027.
88e0: 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a 6f 6e 6c 79  .52..630....only
88f0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
8900: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
8910: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
8920: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8930: 74 20 6c 61 62 65 6c 2d 32 35 34 0d 0a 53 45 4c  t label-254..SEL
8940: 45 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b  ECT - col0 DIV +
8950: 20 63 6f 6c 31 20 2b 20 31 37 20 46 52 4f 4d 20   col1 + 17 FROM 
8960: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8970: 2d 2d 0d 0a 31 33 0d 0a 31 36 0d 0a 31 37 0d 0a  --..13..16..17..
8980: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
8990: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
89a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
89b0: 20 6c 61 62 65 6c 2d 32 35 34 0d 0a 53 45 4c 45   label-254..SELE
89c0: 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f  CT - col0 / + co
89d0: 6c 31 20 2b 20 31 37 20 46 52 4f 4d 20 74 61 62  l1 + 17 FROM tab
89e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
89f0: 0a 31 33 0d 0a 31 36 0d 0a 31 37 0d 0a 0d 0a 73  .13..16..17....s
8a00: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
8a10: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
8a20: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
8a30: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
8a40: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
8a50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8a60: 44 49 53 54 49 4e 43 54 20 39 31 20 2b 20 2b 20  DISTINCT 91 + + 
8a70: 74 61 62 32 2e 63 6f 6c 31 20 63 6f 6c 30 20 46  tab2.col1 col0 F
8a80: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20  ROM tab2, tab1, 
8a90: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8aa0: 2d 2d 0d 0a 31 30 38 0d 0a 31 32 32 0d 0a 31 35  --..108..122..15
8ab0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
8ac0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
8ad0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
8ae0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
8af0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8b00: 2d 32 35 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -256..SELECT ALL
8b10: 20 2b 20 33 38 20 44 49 56 20 63 6f 6c 30 20 2b   + 38 DIV col0 +
8b20: 20 39 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   93 AS col2 FROM
8b30: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35   tab1..----..105
8b40: 0d 0a 39 33 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70  ..93..93....skip
8b50: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
8b60: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
8b70: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8b80: 2d 32 35 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -256..SELECT ALL
8b90: 20 2b 20 33 38 20 2f 20 63 6f 6c 30 20 2b 20 39   + 38 / col0 + 9
8ba0: 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  3 AS col2 FROM t
8bb0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a  ab1..----..105..
8bc0: 39 33 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20  93..93....query 
8bd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8be0: 54 20 2d 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e  T - col1 + tab1.
8bf0: 63 6f 6c 31 20 2b 20 2b 20 74 61 62 31 2e 63 6f  col1 + + tab1.co
8c00: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
8c10: 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a  --..10..13..26..
8c20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8c30: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
8c40: 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r0.col0 AS col2 
8c50: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
8c60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
8c70: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
8c80: 64 64 31 38 62 39 33 32 36 33 61 36 63 64 34 32  dd18b93263a6cd42
8c90: 35 66 63 37 63 63 38 34 64 39 31 33 37 38 37 30  5fc7cc84d9137870
8ca0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8cb0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
8cc0: 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20  INCT + + col2 + 
8cd0: 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20  + ( + col0 ) AS 
8ce0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
8cf0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
8d00: 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75  1..176..57....qu
8d10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8d20: 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
8d30: 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  0 * col2 AS col2
8d40: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
8d50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32  r0..----..189..2
8d60: 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65  028..3002....que
8d70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8d80: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
8d90: 39 34 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  94 FROM tab2..--
8da0: 2d 2d 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20  --..94....query 
8db0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8dc0: 54 20 2b 20 63 6f 6c 31 20 2a 20 34 20 2a 20 2d  T + col1 * 4 * -
8dd0: 20 36 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   6 FROM tab2..--
8de0: 2d 2d 0d 0a 2d 31 34 31 36 0d 0a 2d 34 30 38 0d  --..-1416..-408.
8df0: 0a 2d 37 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-744....query I
8e00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8e10: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
8e20: 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - - col2 AS col
8e30: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
8e40: 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a  -..109..67..80..
8e50: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
8e60: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
8e70: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
8e80: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
8e90: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36  rowsort label-26
8ea0: 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44  4..SELECT col1 D
8eb0: 49 56 20 33 20 46 52 4f 4d 20 74 61 62 30 0d 0a  IV 3 FROM tab0..
8ec0: 2d 2d 2d 2d 0d 0a 32 38 0d 0a 33 30 0d 0a 33 32  ----..28..30..32
8ed0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
8ee0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
8ef0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
8f00: 72 74 20 6c 61 62 65 6c 2d 32 36 34 0d 0a 53 45  rt label-264..SE
8f10: 4c 45 43 54 20 63 6f 6c 31 20 2f 20 33 20 46 52  LECT col1 / 3 FR
8f20: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
8f30: 38 0d 0a 33 30 0d 0a 33 32 0d 0a 0d 0a 71 75 65  8..30..32....que
8f40: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8f50: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
8f60: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col2 * + col2 * 
8f70: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
8f80: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 34 36 34 0d 0a  ..----..157464..
8f90: 31 38 35 31 39 33 0d 0a 38 38 34 37 33 36 0d 0a  185193..884736..
8fa0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8fb0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
8fc0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   * cor0.col1 FRO
8fd0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
8fe0: 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d  -..-1248..-1404.
8ff0: 0a 2d 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-570....skipif 
9000: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
9010: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
9020: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
9030: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
9040: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9050: 74 0d 0a 53 45 4c 45 43 54 20 32 30 20 63 6f 6c  t..SELECT 20 col
9060: 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
9070: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
9080: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
9090: 67 20 74 6f 20 32 66 64 64 39 34 32 66 65 30 33  g to 2fdd942fe03
90a0: 30 37 61 36 66 66 36 36 62 36 33 30 30 34 65 66  07a6ff66b63004ef
90b0: 31 30 32 63 34 0d 0a 0d 0a 71 75 65 72 79 20 49  102c4....query I
90c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
90d0: 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 2b 20 63   tab1.col2 * + c
90e0: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
90f0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   tab1..----..291
9100: 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d  6..3249..9216...
9110: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9120: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32  ..SELECT ALL - 2
9130: 36 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  6 FROM tab1, tab
9140: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
9150: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
9160: 20 68 61 73 68 69 6e 67 20 74 6f 20 34 65 34 39   hashing to 4e49
9170: 65 61 63 30 32 32 64 61 65 61 65 36 66 38 38 66  eac022daeae6f88f
9180: 36 31 30 36 34 34 62 61 33 37 35 34 0d 0a 0d 0a  610644ba3754....
9190: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
91a0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
91b0: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 29 20 41 53  + tab1.col0 ) AS
91c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
91d0: 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
91e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
91f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
9200: 49 4e 43 54 20 2d 20 35 37 20 41 53 20 63 6f 6c  INCT - 57 AS col
9210: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
9220: 2d 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20  -..-57....query 
9230: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9240: 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20  T ALL cor0.col0 
9250: 2a 20 31 36 20 46 52 4f 4d 20 74 61 62 32 2c 20  * 16 FROM tab2, 
9260: 74 61 62 32 20 63 6f 72 30 2c 20 74 61 62 31 20  tab2 cor0, tab1 
9270: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
9280: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
9290: 20 74 6f 20 39 39 65 36 34 39 63 65 36 32 63 64   to 99e649ce62cd
92a0: 36 64 34 33 63 39 38 31 39 66 35 30 36 64 62 61  6d43c9819f506dba
92b0: 33 63 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3c86....query I 
92c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
92d0: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f  cor0.col0 * - co
92e0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
92f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  0..----..-1040..
9300: 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c  -640..-78....onl
9310: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
9320: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
9330: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
9340: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
9350: 72 74 20 6c 61 62 65 6c 2d 32 37 34 0d 0a 53 45  rt label-274..SE
9360: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
9370: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 63 6f  col2 * col0 - co
9380: 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52  l1 DIV + col2 FR
9390: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
93a0: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 37 32  .----..-132..-72
93b0: 39 39 0d 0a 2d 37 39 34 0d 0a 0d 0a 73 6b 69 70  99..-794....skip
93c0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
93d0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
93e0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
93f0: 2d 32 37 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -274..SELECT DIS
9400: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  TINCT - col2 * c
9410: 6f 6c 30 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63  ol0 - col1 / + c
9420: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
9430: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
9440: 32 0d 0a 2d 37 32 39 39 0d 0a 2d 37 39 34 0d 0a  2..-7299..-794..
9450: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9460: 74 0d 0a 53 45 4c 45 43 54 20 31 30 20 2b 20 2b  t..SELECT 10 + +
9470: 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
9480: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
9490: 2d 2d 0d 0a 32 30 0d 0a 32 33 0d 0a 33 36 0d 0a  --..20..23..36..
94a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
94b0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
94c0: 31 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  13 AS col1 FROM 
94d0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d  tab0..----..-13.
94e0: 0a 2d 31 33 0d 0a 2d 31 33 0d 0a 0d 0a 71 75 65  .-13..-13....que
94f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9500: 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63  LECT ALL + ( - c
9510: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 0d  ol2 ) FROM tab0.
9520: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a  .----..-1..-33..
9530: 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -82....onlyif my
9540: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
9550: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
9560: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
9570: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
9580: 65 6c 2d 32 37 38 0d 0a 53 45 4c 45 43 54 20 2b  el-278..SELECT +
9590: 20 31 20 44 49 56 20 2d 20 63 6f 6c 30 20 63 6f   1 DIV - col0 co
95a0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
95b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
95c0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
95d0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
95e0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
95f0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
9600: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
9610: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
9620: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
9630: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9640: 6c 2d 32 37 38 0d 0a 53 45 4c 45 43 54 20 2b 20  l-278..SELECT + 
9650: 31 20 2f 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20  1 / - col0 col0 
9660: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
9670: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
9680: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9690: 0d 0a 53 45 4c 45 43 54 20 2b 20 31 30 20 2a 20  ..SELECT + 10 * 
96a0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20  + cor0.col1 * ( 
96b0: 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  - col0 ) FROM ta
96c0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
96d0: 0d 0a 2d 31 30 34 30 30 0d 0a 2d 36 34 30 30 0d  ..-10400..-6400.
96e0: 0a 2d 37 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-780....query I
96f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9700: 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20   - ( col1 ) + - 
9710: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f  col2 * col2 * co
9720: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
9730: 2d 2d 0d 0a 2d 31 37 36 33 35 0d 0a 2d 31 39 37  --..-17635..-197
9740: 31 34 0d 0a 2d 35 34 38 38 39 0d 0a 0d 0a 71 75  14..-54889....qu
9750: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9760: 45 4c 45 43 54 20 37 30 20 41 53 20 63 6f 6c 32  ELECT 70 AS col2
9770: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
9780: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 30  r0..----..70..70
9790: 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..70....query I 
97a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
97b0: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + - cor0.col2 + 
97c0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
97d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
97e0: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
97f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9800: 20 2d 20 2b 20 39 30 20 2b 20 63 6f 6c 31 20 46   - + 90 + col1 F
9810: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9820: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 37 37  ..----..-64..-77
9830: 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-80....query I
9840: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9850: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
9860: 20 2a 20 34 38 20 41 53 20 63 6f 6c 30 20 46 52   * 48 AS col0 FR
9870: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
9880: 33 36 0d 0a 33 37 34 34 0d 0a 33 37 39 32 0d 0a  36..3744..3792..
9890: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
98a0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
98b0: 63 6f 6c 31 20 2a 20 39 38 20 41 53 20 63 6f 6c  col1 * 98 AS col
98c0: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
98d0: 2d 0d 0a 38 34 32 38 0d 0a 38 39 31 38 0d 0a 39  -..8428..8918..9
98e0: 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  506....query I r
98f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
9900: 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b   col1 * - col0 +
9910: 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 46 52 4f   col0 - col1 FRO
9920: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab2..----..14
9930: 30 35 0d 0a 31 39 33 0d 0a 34 36 32 31 0d 0a 0d  05..193..4621...
9940: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9950: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
9960: 6f 6c 30 20 2a 20 2d 20 35 30 20 2a 20 2d 20 63  ol0 * - 50 * - c
9970: 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ol0 + col1 * - c
9980: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
9990: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30   tab0..----..-30
99a0: 38 36 34 0d 0a 2d 34 30 34 31 34 39 0d 0a 2d 36  864..-404149..-6
99b0: 34 36 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4645....query I 
99c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
99d0: 2d 20 2d 20 39 34 20 2a 20 35 35 20 41 53 20 63  - - 94 * 55 AS c
99e0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
99f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31 37   cor0..----..517
9a00: 30 0d 0a 35 31 37 30 0d 0a 35 31 37 30 0d 0a 0d  0..5170..5170...
9a10: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
9a20: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
9a30: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
9a40: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
9a50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 39  owsort label-289
9a60: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49  ..SELECT col2 DI
9a70: 56 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  V cor0.col0 FROM
9a80: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
9a90: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a  ---..0..0..1....
9aa0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
9ab0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
9ac0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9ad0: 61 62 65 6c 2d 32 38 39 0d 0a 53 45 4c 45 43 54  abel-289..SELECT
9ae0: 20 63 6f 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c   col2 / cor0.col
9af0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
9b00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
9b10: 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
9b20: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
9b30: 28 20 2b 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63  ( + col2 ) + - c
9b40: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 * + col1 FRO
9b50: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
9b60: 2d 2d 2d 2d 0d 0a 2d 32 30 39 37 0d 0a 2d 33 33  ----..-2097..-33
9b70: 39 36 0d 0a 2d 38 31 38 31 0d 0a 0d 0a 71 75 65  96..-8181....que
9b80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9b90: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
9ba0: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  col0 + col0 + - 
9bb0: 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 30 20  col0 * ( - col0 
9bc0: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
9bd0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32 34 30 0d  or0..----..6240.
9be0: 0a 36 33 0d 0a 36 33 39 39 0d 0a 0d 0a 73 6b 69  .63..6399....ski
9bf0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
9c00: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
9c10: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
9c20: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
9c30: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
9c40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9c50: 53 54 49 4e 43 54 20 2d 20 2b 20 34 39 20 2a 20  STINCT - + 49 * 
9c60: 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 63 6f 6c 31  col1 + col0 col1
9c70: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
9c80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 31 0d  r0..----..-1271.
9c90: 0a 2d 34 32 36 0d 0a 2d 35 35 37 0d 0a 0d 0a 73  .-426..-557....s
9ca0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9cb0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9cc0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
9cd0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
9ce0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
9cf0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9d00: 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20 63  DISTINCT + ( + c
9d10: 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f 72  or0.col2 ) + cor
9d20: 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  0.col2 col0 FROM
9d30: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
9d40: 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d  ---..52..54..76.
9d50: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9d60: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
9d70: 4e 43 54 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 31  NCT + + ( - col1
9d80: 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
9d90: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9da0: 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39  --..-86..-91..-9
9db0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
9dc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
9dd0: 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 + - col0 FROM 
9de0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
9df0: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
9e00: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9e10: 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d  ECT ALL col2 + -
9e20: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f   col2 * col2 FRO
9e30: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
9e40: 2d 0d 0a 2d 31 30 35 36 0d 0a 2d 36 36 34 32 0d  -..-1056..-6642.
9e50: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
9e60: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9e70: 53 54 49 4e 43 54 20 2d 20 36 33 20 2b 20 2b 20  STINCT - 63 + + 
9e80: 37 34 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 72 30  74 * col0 * cor0
9e90: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20  .col2 FROM tab2 
9ea0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
9eb0: 33 39 32 33 0d 0a 31 35 30 30 30 39 0d 0a 32 32  3923..150009..22
9ec0: 32 30 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2085....query I 
9ed0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9ee0: 44 49 53 54 49 4e 43 54 20 2d 20 36 32 20 2b 20  DISTINCT - 62 + 
9ef0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  - cor0.col0 * + 
9f00: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
9f10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
9f20: 32 34 0d 0a 2d 33 37 31 30 0d 0a 2d 37 37 34 32  24..-3710..-7742
9f30: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9f40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
9f50: 33 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  30 AS col1 FROM 
9f60: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9f70: 2d 2d 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30 0d 0a  --..30..30..30..
9f80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9f90: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
9fa0: 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 37 20 2b 20  r0.col2 * + 7 + 
9fb0: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52  + col0 * col2 FR
9fc0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9fd0: 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 35 36 31 0d 0a  .----..28..561..
9fe0: 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
9ff0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a000: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
a010: 2a 20 2d 20 31 35 20 41 53 20 63 6f 6c 31 20 46  * - 15 AS col1 F
a020: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
a030: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 30 0d 0a 2d  ..----..-1290..-
a040: 31 33 36 35 0d 0a 2d 31 34 35 35 0d 0a 0d 0a 71  1365..-1455....q
a050: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a060: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
a070: 28 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20  ( col0 ) * col1 
a080: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a090: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a0a0: 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a  .1040..640..78..
a0b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a0c0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 35 20 41  t..SELECT - 35 A
a0d0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
a0e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a0f0: 2d 33 35 0d 0a 2d 33 35 0d 0a 2d 33 35 0d 0a 0d  -35..-35..-35...
a100: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a110: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
a120: 2a 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a  * + ( + col2 ) *
a130: 20 2d 20 32 36 20 2b 20 2b 20 35 30 20 41 53 20   - 26 + + 50 AS 
a140: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
a150: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 37 30  or0..----..14870
a160: 0d 0a 33 32 34 39 38 0d 0a 33 36 35 35 34 0d 0a  ..32498..36554..
a170: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a180: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 20  t..SELECT ALL 4 
a190: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a1a0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
a1b0: 0a 34 0d 0a 34 0d 0a 34 0d 0a 0d 0a 71 75 65 72  .4..4..4....quer
a1c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a1d0: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 74  ECT ALL col1 - t
a1e0: 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ab0.col0 AS col2
a1f0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
a200: 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a 6f  ..2..62..62....o
a210: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
a220: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
a230: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
a240: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
a250: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a260: 74 20 6c 61 62 65 6c 2d 33 30 37 0d 0a 53 45 4c  t label-307..SEL
a270: 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
a280: 53 20 44 45 43 49 4d 41 4c 20 29 20 2d 20 2b 20  S DECIMAL ) - + 
a290: 31 35 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32  15 * - tab1.col2
a2a0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
a2b0: 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b1, tab2 AS cor0
a2c0: 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
a2d0: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
a2e0: 68 61 73 68 69 6e 67 20 74 6f 20 31 36 62 65 38  hashing to 16be8
a2f0: 38 36 38 61 31 65 36 66 34 65 38 38 35 30 35 30  868a1e6f4e885050
a300: 39 66 39 33 32 37 61 66 65 39 30 0d 0a 0d 0a 73  9f9327afe90....s
a310: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
a320: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
a330: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
a340: 62 65 6c 2d 33 30 37 0d 0a 53 45 4c 45 43 54 20  bel-307..SELECT 
a350: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52  CAST ( NULL AS R
a360: 45 41 4c 20 29 20 2d 20 2b 20 31 35 20 2a 20 2d  EAL ) - + 15 * -
a370: 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f   tab1.col2 AS co
a380: 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
a390: 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b2 AS cor0, tab1
a3a0: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
a3b0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
a3c0: 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65  g to 16be8868a1e
a3d0: 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37  6f4e8850509f9327
a3e0: 61 66 65 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  afe90....query I
a3f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a400: 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   + col1 + - col0
a410: 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
a420: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
a430: 2d 31 38 0d 0a 2d 36 30 32 35 0d 0a 2d 36 32 32  -18..-6025..-622
a440: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
a450: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b  sort..SELECT ( +
a460: 20 63 6f 6c 32 20 29 20 2a 20 28 20 2b 20 32 35   col2 ) * ( + 25
a470: 20 29 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63   ) * + col2 AS c
a480: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
a490: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38   cor0..----..168
a4a0: 31 30 30 0d 0a 32 35 0d 0a 32 37 32 32 35 0d 0a  100..25..27225..
a4b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a4c0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
a4d0: 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   * col1 + - col1
a4e0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
a4f0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
a500: 0d 0a 2d 31 33 36 30 0d 0a 2d 32 34 38 0d 0a 2d  ..-1360..-248..-
a510: 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4661....query I 
a520: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a530: 2d 20 35 37 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  - 57 + col2 FROM
a540: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
a550: 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 33 39 0d 0a  ---..-3..0..39..
a560: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a570: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
a580: 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 72 30  l0 * col1 + cor0
a590: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
a5a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
a5b0: 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d  150..3492..8190.
a5c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a5d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
a5e0: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol2 + - col2 AS 
a5f0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
a600: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
a610: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
a620: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a630: 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   ALL col2 + col2
a640: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
a650: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a660: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 33 38  0..----..36..738
a670: 30 0d 0a 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20  0..825....query 
a680: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a690: 54 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 32 20  T col0 * ( col2 
a6a0: 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ) + cor0.col2 AS
a6b0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
a6c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
a6d0: 30 35 34 0d 0a 32 31 36 0d 0a 33 30 34 30 0d 0a  054..216..3040..
a6e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a6f0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
a700: 43 54 20 2b 20 2d 20 32 34 20 41 53 20 63 6f 6c  CT + - 24 AS col
a710: 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
a720: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  2 cor0..----..-2
a730: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
a740: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
a750: 31 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  1 - - col1 FROM 
a760: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
a770: 0a 31 37 32 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a  .172..182..194..
a780: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a790: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 34 20 46  t..SELECT - 24 F
a7a0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
a7b0: 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
a7c0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
a7d0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
a7e0: 20 66 32 65 34 30 66 36 65 35 63 64 62 63 32 38   f2e40f6e5cdbc28
a7f0: 37 37 38 34 33 31 39 31 63 62 32 36 31 39 37 35  77843191cb261975
a800: 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  f....query I row
a810: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
a820: 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b  TINCT - + col0 +
a830: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
a840: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
a850: 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
a860: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a870: 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 37 20  CT + + col1 * 7 
a880: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
a890: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 32 0d 0a 36 33  0..----..602..63
a8a0: 37 0d 0a 36 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  7..679....onlyif
a8b0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
a8c0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
a8d0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
a8e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
a8f0: 6c 61 62 65 6c 2d 33 32 31 0d 0a 53 45 4c 45 43  label-321..SELEC
a900: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
a910: 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 + - cor0.col
a920: 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20  1 DIV cor0.col0 
a930: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a940: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a950: 0a 31 30 0d 0a 31 33 0d 0a 31 38 0d 0a 0d 0a 73  .10..13..18....s
a960: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
a970: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
a980: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
a990: 62 65 6c 2d 33 32 31 0d 0a 53 45 4c 45 43 54 20  bel-321..SELECT 
a9a0: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
a9b0: 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 + - cor0.col1 
a9c0: 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  / cor0.col0 AS c
a9d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
a9e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d   cor0..----..10.
a9f0: 0a 31 33 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79  .13..18....query
aa00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
aa10: 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 63 6f  CT - col1 - + co
aa20: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
aa30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d  cor0..----..-29.
aa40: 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65  .-74..-93....que
aa50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
aa60: 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
aa70: 6c 32 20 2b 20 37 33 20 46 52 4f 4d 20 74 61 62  l2 + 73 FROM tab
aa80: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
aa90: 0a 31 30 30 0d 0a 31 31 31 0d 0a 39 39 0d 0a 0d  .100..111..99...
aaa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
aab0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
aac0: 54 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 72  T - col0 - + cor
aad0: 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  0.col1 * cor0.co
aae0: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
aaf0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
ab00: 2d 2d 0d 0a 2d 33 35 35 39 0d 0a 2d 33 36 38 0d  --..-3559..-368.
ab10: 0a 2d 39 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-968....query I
ab20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ab30: 20 63 6f 6c 30 20 2a 20 2d 20 36 34 20 2b 20 63   col0 * - 64 + c
ab40: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
ab50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 37 0d 0a  r0..----..-417..
ab60: 2d 34 39 33 33 0d 0a 2d 35 30 33 39 0d 0a 0d 0a  -4933..-5039....
ab70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ab80: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
ab90: 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32  r0.col2 * - col2
aba0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
abb0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
abc0: 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a  ..-2916..-3249..
abd0: 2d 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -9216....query I
abe0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
abf0: 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30   + col1 + - cor0
ac00: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
ac10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
ac20: 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a  28..-47..-83....
ac30: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ac40: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
ac50: 63 6f 6c 31 20 2a 20 2b 20 28 20 32 34 20 29 20  col1 * + ( 24 ) 
ac60: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
ac70: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
ac80: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 34 34 38 0d  ..----..-110448.
ac90: 0a 2d 33 32 32 33 32 0d 0a 2d 35 32 30 38 0d 0a  .-32232..-5208..
aca0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
acb0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
acc0: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  CT - col0 + + co
acd0: 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l2 * col2 + - co
ace0: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
acf0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 38 37  tab1..----..2887
ad00: 0d 0a 33 31 37 35 0d 0a 39 31 32 33 0d 0a 0d 0a  ..3175..9123....
ad10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ad20: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
ad30: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d   - cor0.col1 - -
ad40: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
ad50: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
ad60: 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36  --..-53..-9..-96
ad70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ad80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
ad90: 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  INCT - + col0 * 
ada0: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f  cor0.col0 * - co
adb0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
adc0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 32 31 34 34 0d  0..----..262144.
add0: 0a 32 37 0d 0a 35 31 32 30 30 30 0d 0a 0d 0a 71  .27..512000....q
ade0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
adf0: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2d 20  SELECT col0 - - 
ae00: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col2 * - col1 * 
ae10: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
ae20: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
ae30: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 32 0d 0a  ..----..-22592..
ae40: 2d 32 34 34 36 39 0d 0a 2d 33 39 38 30 36 0d 0a  -24469..-39806..
ae50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ae60: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
ae70: 43 54 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f  CT col0 * ( + co
ae80: 6c 32 20 2a 20 63 6f 6c 31 20 29 20 46 52 4f 4d  l2 * col1 ) FROM
ae90: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
aea0: 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 31 30  ---..119652..510
aeb0: 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 6f 6e 6c 79  34..5859....only
aec0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
aed0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
aee0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
aef0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
af00: 74 20 6c 61 62 65 6c 2d 33 33 34 0d 0a 53 45 4c  t label-334..SEL
af10: 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b  ECT - ( col1 ) +
af20: 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56 20 63   tab0.col1 DIV c
af30: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
af40: 2d 2d 2d 0d 0a 2d 38 33 0d 0a 2d 39 30 0d 0a 2d  ---..-83..-90..-
af50: 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  95....skipif mys
af60: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
af70: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
af80: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 34 0d 0a  sort label-334..
af90: 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 31 20  SELECT - ( col1 
afa0: 29 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2f 20  ) + tab0.col1 / 
afb0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
afc0: 2d 2d 2d 2d 0d 0a 2d 38 33 0d 0a 2d 39 30 0d 0a  ----..-83..-90..
afd0: 2d 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -95....onlyif my
afe0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
aff0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
b000: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
b010: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b020: 65 6c 2d 33 33 35 0d 0a 53 45 4c 45 43 54 20 63  el-335..SELECT c
b030: 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c  ol0 + - tab1.col
b040: 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 63 6f 6c  0 DIV + col2 col
b050: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
b060: 2d 0d 0a 33 0d 0a 36 33 0d 0a 38 30 0d 0a 0d 0a  -..3..63..80....
b070: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
b080: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
b090: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
b0a0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
b0b0: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
b0c0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
b0d0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
b0e0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33  rowsort label-33
b0f0: 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  5..SELECT col0 +
b100: 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2f 20 2b   - tab1.col0 / +
b110: 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
b120: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36  tab1..----..3..6
b130: 33 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..80....onlyif 
b140: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
b150: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
b160: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
b170: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
b180: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
b190: 6c 2d 33 33 36 0d 0a 53 45 4c 45 43 54 20 63 6f  l-336..SELECT co
b1a0: 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 2d 20 43 41  l0 / - col1 - CA
b1b0: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
b1c0: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  ED ) FROM tab1..
b1d0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
b1e0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
b1f0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
b200: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
b210: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
b220: 33 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  36..SELECT col0 
b230: 2f 20 2d 20 63 6f 6c 31 20 2d 20 43 41 53 54 20  / - col1 - CAST 
b240: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
b250: 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  R ) FROM tab1..-
b260: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
b270: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
b280: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b290: 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 74 61 62 32   + col1 - - tab2
b2a0: 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f  .col2 * col2 FRO
b2b0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab2..----..14
b2c0: 36 31 0d 0a 37 33 35 0d 0a 37 36 30 0d 0a 0d 0a  61..735..760....
b2d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b2e0: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
b2f0: 20 2a 20 2b 20 34 36 20 46 52 4f 4d 20 74 61 62   * + 46 FROM tab
b300: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
b310: 0a 31 31 39 36 0d 0a 31 32 34 32 0d 0a 31 37 34  .1196..1242..174
b320: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
b330: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
b340: 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 31 37 20 46   - - col2 + 17 F
b350: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
b360: 0d 0a 2d 2d 2d 2d 0d 0a 34 33 0d 0a 34 34 0d 0a  ..----..43..44..
b370: 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  55....query I ro
b380: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
b390: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
b3a0: 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f  - ( - col2 ) FRO
b3b0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
b3c0: 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34  ----..-162..-364
b3d0: 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72  8..-7680....quer
b3e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b3f0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
b400: 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32   + col2 - + col2
b410: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
b420: 0d 0a 2d 32 31 36 0d 0a 2d 33 37 30 35 0d 0a 2d  ..-216..-3705..-
b430: 37 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7776....query I 
b440: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b450: 41 4c 4c 20 2b 20 2b 20 35 34 20 46 52 4f 4d 20  ALL + + 54 FROM 
b460: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
b470: 2d 2d 0d 0a 35 34 0d 0a 35 34 0d 0a 35 34 0d 0a  --..54..54..54..
b480: 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 20 72  ..query IIIIII r
b490: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
b4a0: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
b4b0: 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e   AS cor0 WHERE N
b4c0: 4f 54 20 4e 55 4c 4c 20 3d 20 4e 55 4c 4c 0d 0a  OT NULL = NULL..
b4d0: 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ----....onlyif m
b4e0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
b4f0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
b500: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
b510: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
b520: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b530: 2d 33 34 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -344..SELECT - c
b540: 6f 6c 30 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c  ol0 / CAST( NULL
b550: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
b560: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab2..----..NU
b570: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
b580: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
b590: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
b5a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b5b0: 20 6c 61 62 65 6c 2d 33 34 34 0d 0a 53 45 4c 45   label-344..SELE
b5c0: 43 54 20 2d 20 63 6f 6c 30 20 2f 20 43 41 53 54  CT - col0 / CAST
b5d0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
b5e0: 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  ER ) FROM tab2..
b5f0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
b600: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
b610: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b620: 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  T + + col0 * cor
b630: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0.col1 FROM tab2
b640: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34   cor0..----..134
b650: 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a  3..217..4602....
b660: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
b670: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
b680: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
b690: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
b6a0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 36 0d  wsort label-346.
b6b0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
b6c0: 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f   - col0 DIV - co
b6d0: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
b6e0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
b6f0: 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a  .-24..-35..-89..
b700: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
b710: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
b720: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b730: 20 6c 61 62 65 6c 2d 33 34 36 0d 0a 53 45 4c 45   label-346..SELE
b740: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT - col0 * - co
b750: 6c 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 / - cor0.col0
b760: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
b770: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
b780: 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69 70 69  35..-89....skipi
b790: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
b7a0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
b7b0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
b7c0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
b7d0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
b7e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
b7f0: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  INCT + col2 * co
b800: 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
b810: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  1 cor0..----..16
b820: 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d  2..3648..7680...
b830: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b840: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
b850: 2b 20 63 6f 6c 30 20 2a 20 2b 20 36 31 20 41 53  + col0 * + 61 AS
b860: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
b870: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
b880: 38 30 0d 0a 33 38 34 30 0d 0a 34 38 30 30 0d 0a  80..3840..4800..
b890: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b8a0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 33  t..SELECT ALL 53
b8b0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
b8c0: 62 32 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  b2, tab1 cor0..-
b8d0: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
b8e0: 73 68 69 6e 67 20 74 6f 20 66 65 64 65 36 30 33  shing to fede603
b8f0: 33 64 65 65 33 34 36 64 62 64 32 37 32 30 38 35  3dee346dbd272085
b900: 63 30 35 37 32 34 66 64 61 0d 0a 0d 0a 71 75 65  c05724fda....que
b910: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
b920: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
b930: 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  + col2 * - col0 
b940: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
b950: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
b960: 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
b970: 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
b980: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
b990: 4c 4c 20 2b 20 2b 20 35 36 20 41 53 20 63 6f 6c  LL + + 56 AS col
b9a0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
b9b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 35  or0..----..56..5
b9c0: 36 0d 0a 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  6..56....query I
b9d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b9e0: 20 2d 20 34 35 20 2d 20 63 6f 6c 30 20 41 53 20   - 45 - col0 AS 
b9f0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
ba00: 2d 2d 2d 2d 0d 0a 2d 31 32 33 0d 0a 2d 31 32 34  ----..-123..-124
ba10: 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-52....query I
ba20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ba30: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d   - cor0.col0 - -
ba40: 20 32 33 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   23 FROM tab1 co
ba50: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
ba60: 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
ba70: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
ba80: 6e 67 20 74 6f 20 33 36 62 64 31 30 65 33 36 63  ng to 36bd10e36c
ba90: 61 34 64 62 63 39 36 37 36 32 34 35 38 61 62 35  a4dbc96762458ab5
baa0: 32 65 35 39 63 61 0d 0a 0d 0a 71 75 65 72 79 20  2e59ca....query 
bab0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
bac0: 54 20 44 49 53 54 49 4e 43 54 20 33 39 20 41 53  T DISTINCT 39 AS
bad0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
bae0: 0a 2d 2d 2d 2d 0d 0a 33 39 0d 0a 0d 0a 71 75 65  .----..39....que
baf0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
bb00: 4c 45 43 54 20 36 38 20 41 53 20 63 6f 6c 32 20  LECT 68 AS col2 
bb10: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
bb20: 0a 36 38 0d 0a 36 38 0d 0a 36 38 0d 0a 0d 0a 73  .68..68..68....s
bb30: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
bb40: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
bb50: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
bb60: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
bb70: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
bb80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
bb90: 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 30 20  DISTINCT ( col0 
bba0: 2b 20 35 30 20 29 20 2a 20 63 6f 6c 30 20 63 6f  + 50 ) * col0 co
bbb0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
bbc0: 2d 2d 0d 0a 31 30 31 39 31 0d 0a 33 39 39 0d 0a  --..10191..399..
bbd0: 39 39 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9984....query I 
bbe0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
bbf0: 44 49 53 54 49 4e 43 54 20 2d 20 36 36 20 41 53  DISTINCT - 66 AS
bc00: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
bc10: 0a 2d 2d 2d 2d 0d 0a 2d 36 36 0d 0a 0d 0a 71 75  .----..-66....qu
bc20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
bc30: 45 4c 45 43 54 20 2d 20 38 39 20 2b 20 74 61 62  ELECT - 89 + tab
bc40: 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  1.col2 FROM tab1
bc50: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a 2d 33 35  ..----..-32..-35
bc60: 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
bc70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
bc80: 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 2a   col0 - + col2 *
bc90: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
bca0: 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 32 0d 0a 2d 37  .----..-1612..-7
bcb0: 32 35 0d 0a 2d 38 34 34 0d 0a 0d 0a 71 75 65 72  25..-844....quer
bcc0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bcd0: 45 43 54 20 33 38 20 2a 20 2d 20 63 6f 6c 32 20  ECT 38 * - col2 
bce0: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
bcf0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
bd00: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37 38 34 34 0d  ..----..-107844.
bd10: 0a 2d 32 38 33 35 35 36 0d 0a 2d 33 36 38 36 0d  .-283556..-3686.
bd20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bd30: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
bd40: 4e 43 54 20 35 31 20 46 52 4f 4d 20 74 61 62 30  NCT 51 FROM tab0
bd50: 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 0d 0a 73 6b  ..----..51....sk
bd60: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
bd70: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
bd80: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
bd90: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
bda0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
bdb0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
bdc0: 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c 32 20 46   + col1 ) col2 F
bdd0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
bde0: 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b  10..13..26....sk
bdf0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
be00: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
be10: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
be20: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
be30: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
be40: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
be50: 49 53 54 49 4e 43 54 20 2b 20 39 30 20 63 6f 6c  ISTINCT + 90 col
be60: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
be70: 2d 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -..90....query I
be80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
be90: 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 30 20   ALL - ( + col0 
bea0: 29 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ) - col0 AS col2
beb0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
bec0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 0d 0a  r0..----..-178..
bed0: 2d 34 38 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72  -48..-70....quer
bee0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bef0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
bf00: 32 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  2 + + col1 + col
bf10: 32 20 2a 20 38 32 20 41 53 20 63 6f 6c 31 20 46  2 * 82 AS col1 F
bf20: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
bf30: 0d 0a 2d 2d 2d 2d 0d 0a 34 35 30 38 0d 0a 34 37  ..----..4508..47
bf40: 34 31 0d 0a 37 39 38 31 0d 0a 0d 0a 71 75 65 72  41..7981....quer
bf50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bf60: 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 33 20  ECT DISTINCT 73 
bf70: 2b 20 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b  + - ( - col0 ) +
bf80: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   + col2 * + col0
bf90: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
bfa0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
bfb0: 0d 0a 32 31 37 39 0d 0a 32 36 39 0d 0a 33 31 35  ..2179..269..315
bfc0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
bfd0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37  sort..SELECT - 7
bfe0: 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 * - col2 AS co
bff0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
c000: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 38 30 0d 0a 33  0..----..3780..3
c010: 39 39 30 0d 0a 36 37 32 30 0d 0a 0d 0a 71 75 65  990..6720....que
c020: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c030: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
c040: 28 20 34 37 20 29 20 2b 20 2d 20 63 6f 6c 31 20  ( 47 ) + - col1 
c050: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
c060: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d 36  0..----..-57..-6
c070: 30 0d 0a 2d 37 33 0d 0a 0d 0a 71 75 65 72 79 20  0..-73....query 
c080: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c090: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
c0a0: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d  ol0 * - col1 + -
c0b0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
c0c0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
c0d0: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 31 0d 0a 2d 32  .----..-1381..-2
c0e0: 34 34 0d 0a 2d 34 36 32 38 0d 0a 0d 0a 71 75 65  44..-4628....que
c0f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c100: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20 63 6f  LECT + col2 - co
c110: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
c120: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
c130: 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36  --..-53..-9..-96
c140: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c150: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 34  ort..SELECT + 24
c160: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   - cor0.col1 FRO
c170: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
c180: 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 0d 0a 37  ----..-35..-7..7
c190: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
c1a0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
c1b0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
c1c0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
c1d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
c1e0: 33 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  372..SELECT ALL 
c1f0: 2b 20 2b 20 36 36 20 44 49 56 20 2d 20 63 6f 6c  + + 66 DIV - col
c200: 31 20 2b 20 2b 20 33 37 20 41 53 20 63 6f 6c 30  1 + + 37 AS col0
c210: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
c220: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 33 32  r0..----..31..32
c230: 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..35....skipif m
c240: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
c250: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
c260: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 32  owsort label-372
c270: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
c280: 20 36 36 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 2b   66 / - col1 + +
c290: 20 33 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   37 AS col0 FROM
c2a0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
c2b0: 2d 2d 2d 0d 0a 33 31 0d 0a 33 32 0d 0a 33 35 0d  ---..31..32..35.
c2c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c2d0: 72 74 0d 0a 53 45 4c 45 43 54 20 35 35 20 46 52  rt..SELECT 55 FR
c2e0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  OM tab0, tab2 AS
c2f0: 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
c300: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
c310: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
c320: 38 33 32 31 32 38 61 64 62 31 64 64 63 36 35 63  832128adb1ddc65c
c330: 33 31 30 35 65 32 39 63 63 32 63 38 62 33 61 33  3105e29cc2c8b3a3
c340: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c350: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
c360: 63 6f 6c 31 20 2a 20 2d 20 37 36 20 46 52 4f 4d  col1 * - 76 FROM
c370: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
c380: 2d 2d 2d 0d 0a 2d 31 39 37 36 0d 0a 2d 37 36 30  ---..-1976..-760
c390: 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75 65 72 79 20  ..-988....query 
c3a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c3b0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
c3c0: 30 20 2a 20 38 32 20 2a 20 63 6f 6c 31 20 41 53  0 * 82 * col1 AS
c3d0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
c3e0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
c3f0: 31 36 39 32 34 38 0d 0a 2d 32 37 38 33 39 30 0d  169248..-278390.
c400: 0a 2d 36 36 34 31 31 38 0d 0a 0d 0a 71 75 65 72  .-664118....quer
c410: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c420: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32  ECT ALL - + col2
c430: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
c440: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
c450: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
c460: 0d 0a 31 34 30 36 0d 0a 36 35 30 0d 0a 37 30 32  ..1406..650..702
c470: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c480: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
c490: 6c 30 20 2a 20 39 32 20 41 53 20 63 6f 6c 30 20  l0 * 92 AS col0 
c4a0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
c4b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 30 38 0d 0a  0..----..-2208..
c4c0: 2d 33 32 32 30 0d 0a 2d 38 31 38 38 0d 0a 0d 0a  -3220..-8188....
c4d0: 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
c4e0: 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
c4f0: 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
c500: 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30   tab0, tab0 cor0
c510: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 2c 20  , tab0 AS cor1, 
c520: 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
c530: 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76  r2..----..3645 v
c540: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
c550: 20 62 61 30 33 38 31 39 32 31 34 31 30 66 35 39   ba0381921410f59
c560: 35 31 39 63 63 36 35 38 64 38 65 36 35 65 65 65  519cc658d8e65eee
c570: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
c580: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
c590: 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
c5a0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
c5b0: 2d 0d 0a 38 34 0d 0a 38 34 0d 0a 38 34 0d 0a 0d  -..84..84..84...
c5c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c5d0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
c5e0: 2a 20 32 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 28 AS col0 FRO
c5f0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
c600: 2d 2d 2d 2d 0d 0a 32 32 39 36 0d 0a 32 38 0d 0a  ----..2296..28..
c610: 39 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  924....query I r
c620: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
c630: 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30 20 2b   col2 + ( col0 +
c640: 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 29 20 46   - tab1.col0 ) F
c650: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
c660: 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d  -54..-57..-96...
c670: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c680: 0d 0a 53 45 4c 45 43 54 20 2b 20 38 32 20 41 53  ..SELECT + 82 AS
c690: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
c6a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
c6b0: 32 0d 0a 38 32 0d 0a 38 32 0d 0a 0d 0a 71 75 65  2..82..82....que
c6c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c6d0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
c6e0: 37 38 20 2b 20 33 31 20 2a 20 63 6f 72 30 2e 63  78 + 31 * cor0.c
c6f0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol1 FROM tab2, t
c700: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
c710: 2d 0d 0a 32 33 32 0d 0a 33 32 35 0d 0a 37 32 38  -..232..325..728
c720: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c730: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
c740: 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  l0 + col0 * col0
c750: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
c760: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
c770: 0d 0a 34 30 33 32 0d 0a 36 0d 0a 36 33 32 30 0d  ..4032..6..6320.
c780: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
c790: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
c7a0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
c7b0: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
c7c0: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
c7d0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 35 0d  wsort label-385.
c7e0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
c7f0: 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  ol2 + ( - col2 )
c800: 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
c810: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
c820: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
c830: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
c840: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
c850: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
c860: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
c870: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 35 0d  wsort label-385.
c880: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
c890: 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29  ol2 + ( - col2 )
c8a0: 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   * CAST ( NULL A
c8b0: 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
c8c0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
c8d0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
c8e0: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
c8f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c900: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
c910: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
c920: 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
c930: 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
c940: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
c950: 69 6e 67 20 74 6f 20 37 66 34 61 39 62 66 32 34  ing to 7f4a9bf24
c960: 64 36 34 38 33 33 37 30 36 64 66 62 64 64 30 62  d64833706dfbdd0b
c970: 61 66 34 39 64 37 39 0d 0a 0d 0a 71 75 65 72 79  af49d79....query
c980: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c990: 43 54 20 2d 20 63 6f 6c 32 20 2a 20 35 38 20 46  CT - col2 * 58 F
c9a0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
c9b0: 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 31 35 36  ---..-1508..-156
c9c0: 36 0d 0a 2d 32 32 30 34 0d 0a 0d 0a 71 75 65 72  6..-2204....quer
c9d0: 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49  y IIIIIIIIIIIIII
c9e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c9f0: 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f  T DISTINCT * FRO
ca00: 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
ca10: 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
ca20: 72 31 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41  r1, tab0, tab0 A
ca30: 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor2..----..36
ca40: 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
ca50: 67 20 74 6f 20 38 61 37 39 30 35 62 61 62 30 32  g to 8a7905bab02
ca60: 37 61 30 36 37 33 31 62 61 35 37 36 35 39 64 38  7a06731ba57659d8
ca70: 33 39 38 31 64 0d 0a 0d 0a 71 75 65 72 79 20 49  3981d....query I
ca80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ca90: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2a   col2 * + col1 *
caa0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
cab0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
cac0: 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35  .----..10982..25
cad0: 39 34 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 71 75  947..90506....qu
cae0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
caf0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 31  ELECT ALL - cor1
cb00: 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 31 2e 63  .col0 * + cor1.c
cb10: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
cb20: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
cb30: 6f 72 30 2c 20 74 61 62 31 2c 20 74 61 62 30 20  or0, tab1, tab0 
cb40: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor1..----..8
cb50: 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
cb60: 20 74 6f 20 63 65 65 39 39 64 63 34 38 39 63 37   to cee99dc489c7
cb70: 64 61 62 34 39 65 62 33 32 62 36 62 65 62 32 65  dab49eb32b6beb2e
cb80: 63 38 63 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  c8c0....skipif p
cb90: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
cba0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
cbb0: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
cbc0: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
cbd0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
cbe0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 37 30 20  ..SELECT - - 70 
cbf0: 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  * + col1 + col0 
cc00: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
cc10: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
cc20: 36 39 0d 0a 32 31 37 37 0d 0a 34 32 30 38 0d 0a  69..2177..4208..
cc30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cc40: 74 0d 0a 53 45 4c 45 43 54 20 37 30 20 46 52 4f  t..SELECT 70 FRO
cc50: 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
cc60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
cc70: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
cc80: 39 37 35 38 64 61 36 35 61 65 34 37 31 31 65 33  9758da65ae4711e3
cc90: 65 38 63 38 64 65 66 32 66 65 30 32 36 39 31 31  e8c8def2fe026911
cca0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ccb0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
ccc0: 37 33 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  73 + + col1 FROM
ccd0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
cce0: 2d 2d 2d 0d 0a 38 33 0d 0a 38 36 0d 0a 39 39 0d  ---..83..86..99.
ccf0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
cd00: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
cd10: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
cd20: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
cd30: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
cd40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
cd50: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
cd60: 20 2d 20 63 6f 6c 30 20 29 20 63 6f 6c 31 20 46   - col0 ) col1 F
cd70: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
cd80: 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d  ---..-24..-35..-
cd90: 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  89....query I ro
cda0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
cdb0: 32 39 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  29 * - col2 FROM
cdc0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
cdd0: 2d 2d 2d 0d 0a 31 31 30 32 0d 0a 37 35 34 0d 0a  ---..1102..754..
cde0: 37 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  783....query I r
cdf0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
ce00: 4c 4c 20 2b 20 32 35 20 2a 20 63 6f 6c 31 20 46  LL + 25 * col1 F
ce10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
ce20: 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 30 0d 0a 32 32  ..----..2150..22
ce30: 37 35 0d 0a 32 34 32 35 0d 0a 0d 0a 6f 6e 6c 79  75..2425....only
ce40: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
ce50: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
ce60: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
ce70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ce80: 74 20 6c 61 62 65 6c 2d 33 39 37 0d 0a 53 45 4c  t label-397..SEL
ce90: 45 43 54 20 28 20 63 6f 6c 31 20 29 20 2d 20 2d  ECT ( col1 ) - -
cea0: 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 46   col1 DIV col1 F
ceb0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
cec0: 31 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 73 6b  11..14..27....sk
ced0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
cee0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
cef0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
cf00: 65 6c 2d 33 39 37 0d 0a 53 45 4c 45 43 54 20 28  el-397..SELECT (
cf10: 20 63 6f 6c 31 20 29 20 2d 20 2d 20 63 6f 6c 31   col1 ) - - col1
cf20: 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   / col1 FROM tab
cf30: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d  1..----..11..14.
cf40: 0a 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .27....query I r
cf50: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
cf60: 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  3 AS col0 FROM t
cf70: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33  ab0..----..33..3
cf80: 33 0d 0a 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49  3..33....query I
cf90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
cfa0: 20 2b 20 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f   + cor1.col2 FRO
cfb0: 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
cfc0: 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
cfd0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
cfe0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
cff0: 30 66 64 38 63 63 30 64 65 39 32 65 61 36 38 64  0fd8cc0de92ea68d
d000: 37 33 36 33 34 63 32 64 38 66 37 35 62 66 35 0d  73634c2d8f75bf5.
d010: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
d020: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
d030: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
d040: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
d050: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
d060: 30 30 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e  00..SELECT tab1.
d070: 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20  col2 DIV + col0 
d080: 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  + - col1 + col2 
d090: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
d0a0: 31 0d 0a 2d 2d 2d 2d 0d 0a 34 36 0d 0a 34 37 0d  1..----..46..47.
d0b0: 0a 38 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .84....skipif my
d0c0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
d0d0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
d0e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 30 0d  wsort label-400.
d0f0: 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c  .SELECT tab1.col
d100: 32 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  2 / + col0 + - c
d110: 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 + col2 AS co
d120: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
d130: 2d 2d 0d 0a 34 36 0d 0a 34 37 0d 0a 38 34 0d 0a  --..46..47..84..
d140: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d150: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
d160: 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 28 20  l1 * col0 + - ( 
d170: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
d180: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
d190: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31  ..----..-104..-1
d1a0: 30 35 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65  053..-650....que
d1b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d1c0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
d1d0: 36 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  61 AS col1 FROM 
d1e0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a  tab0..----..61..
d1f0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
d200: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
d210: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
d220: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
d230: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30  rowsort label-40
d240: 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  3..SELECT ALL + 
d250: 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 33 38  tab0.col1 + - 38
d260: 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 41   DIV cor0.col1 A
d270: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
d280: 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
d290: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
d2a0: 69 6e 67 20 74 6f 20 64 65 30 65 35 35 66 38 63  ing to de0e55f8c
d2b0: 36 35 32 33 65 65 31 30 61 38 30 38 31 31 63 62  6523ee10a80811cb
d2c0: 64 61 66 37 61 37 66 0d 0a 0d 0a 73 6b 69 70 69  daf7a7f....skipi
d2d0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
d2e0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
d2f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d300: 34 30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  403..SELECT ALL 
d310: 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20  + tab0.col1 + - 
d320: 33 38 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 41  38 / cor0.col1 A
d330: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
d340: 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
d350: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
d360: 69 6e 67 20 74 6f 20 64 65 30 65 35 35 66 38 63  ing to de0e55f8c
d370: 36 35 32 33 65 65 31 30 61 38 30 38 31 31 63 62  6523ee10a80811cb
d380: 64 61 66 37 61 37 66 0d 0a 0d 0a 6f 6e 6c 79 69  daf7a7f....onlyi
d390: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
d3a0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
d3b0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
d3c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d3d0: 20 6c 61 62 65 6c 2d 34 30 34 0d 0a 53 45 4c 45   label-404..SELE
d3e0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
d3f0: 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52  l2 DIV - col1 FR
d400: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
d410: 32 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2..0....skipif m
d420: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
d430: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
d440: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 34  owsort label-404
d450: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d460: 54 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  T + col2 / - col
d470: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
d480: 2d 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -..-2..0....skip
d490: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
d4a0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
d4b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d4c0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
d4d0: 20 2a 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32   * CAST ( + col2
d4e0: 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 52 45 41   * + col2 AS REA
d4f0: 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  L ) FROM tab2..-
d500: 2d 2d 2d 0d 0a 31 31 34 30 37 36 0d 0a 35 31 30  ---..114076..510
d510: 33 0d 0a 35 32 37 32 38 0d 0a 0d 0a 73 6b 69 70  3..52728....skip
d520: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
d530: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
d540: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
d550: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
d560: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
d570: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
d580: 6f 6c 32 20 2a 20 33 34 20 63 6f 6c 30 20 46 52  ol2 * 34 col0 FR
d590: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
d5a0: 31 38 33 36 0d 0a 2d 31 39 33 38 0d 0a 2d 33 32  1836..-1938..-32
d5b0: 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
d5c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
d5d0: 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l2 * col1 + + co
d5e0: 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l2 * cor0.col1 A
d5f0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
d600: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d610: 31 32 39 32 0d 0a 31 36 37 34 0d 0a 33 30 36 38  1292..1674..3068
d620: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
d630: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
d640: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
d650: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
d660: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d670: 34 30 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  408..SELECT - co
d680: 72 30 2e 63 6f 6c 31 20 44 49 56 20 2b 20 37 30  r0.col1 DIV + 70
d690: 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
d6a0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
d6b0: 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36  -..-10..-13..-26
d6c0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
d6d0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
d6e0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
d6f0: 72 74 20 6c 61 62 65 6c 2d 34 30 38 0d 0a 53 45  rt label-408..SE
d700: 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LECT - cor0.col1
d710: 20 2f 20 2b 20 37 30 20 2b 20 2d 20 63 6f 6c 31   / + 70 + - col1
d720: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
d730: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d  r0..----..-10..-
d740: 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79  13..-26....query
d750: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d760: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 39 33  CT + col0 * - 93
d770: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
d780: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 39 0d 0a  r0..----..-279..
d790: 2d 35 39 35 32 0d 0a 2d 37 34 34 30 0d 0a 0d 0a  -5952..-7440....
d7a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d7b0: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63  .SELECT col0 * c
d7c0: 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
d7d0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
d7e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
d7f0: 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a 37 36 0d  .6110..6279..76.
d800: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
d810: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
d820: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
d830: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
d840: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
d850: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 31 0d  wsort label-411.
d860: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
d870: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
d880: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
d890: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
d8a0: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
d8b0: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
d8c0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
d8d0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
d8e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 31 0d  wsort label-411.
d8f0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
d900: 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
d910: 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
d920: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
d930: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
d940: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
d950: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d960: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d   - cor0.col2 - -
d970: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
d980: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
d990: 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36  .----..53..9..96
d9a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d9b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
d9c0: 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  INCT + cor0.col0
d9d0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
d9e0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
d9f0: 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
da00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
da10: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT - col0 * col2
da20: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
da30: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
da40: 2d 2d 2d 2d 0d 0a 2d 32 30 38 37 0d 0a 2d 32 32  ----..-2087..-22
da50: 30 0d 0a 2d 33 30 31 39 0d 0a 0d 0a 71 75 65 72  0..-3019....quer
da60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
da70: 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ECT col0 * - col
da80: 30 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 - + cor0.col1 
da90: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
daa0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 32 0d 0a  0..----..-1322..
dab0: 2d 36 36 32 0d 0a 2d 38 30 31 32 0d 0a 0d 0a 73  -662..-8012....s
dac0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
dad0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
dae0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
daf0: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
db00: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
db10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
db20: 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
db30: 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 57 48   tab1 AS cor0 WH
db40: 45 52 45 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  ERE col2 + + col
db50: 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 + - col1 * col
db60: 31 20 2a 20 2d 20 63 6f 6c 31 20 42 45 54 57 45  1 * - col1 BETWE
db70: 45 4e 20 28 20 4e 55 4c 4c 20 29 20 41 4e 44 20  EN ( NULL ) AND 
db80: 2d 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  - col2..----....
db90: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
dba0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
dbb0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
dbc0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
dbd0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 37 0d  wsort label-417.
dbe0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
dbf0: 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56  ol1 + - col1 DIV
dc00: 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
dc10: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
dc20: 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 32 37 0d 0a  ----..-17..-27..
dc30: 2d 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -59....skipif po
dc40: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
dc50: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
dc60: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
dc70: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
dc80: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
dc90: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
dca0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
dcb0: 61 62 65 6c 2d 34 31 37 0d 0a 53 45 4c 45 43 54  abel-417..SELECT
dcc0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   - cor0.col1 + -
dcd0: 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 63   col1 / - col0 c
dce0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
dcf0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
dd00: 0d 0a 2d 32 37 0d 0a 2d 35 39 0d 0a 0d 0a 71 75  ..-27..-59....qu
dd10: 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
dd20: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
dd30: 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 2d 20  OM tab2 WHERE - 
dd40: 63 6f 6c 30 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d  col0 = NULL..---
dd50: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
dd60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
dd70: 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  1 + - col2 FROM 
dd80: 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 4e  tab0 WHERE NOT N
dd90: 55 4c 4c 20 3e 20 28 20 63 6f 6c 31 20 29 0d 0a  ULL > ( col1 )..
dda0: 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
ddb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ddc0: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col0 * - col0 * 
ddd0: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
dde0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
ddf0: 2d 31 33 32 33 0d 0a 2d 31 35 38 31 38 34 0d 0a  -1323..-158184..
de00: 2d 32 33 37 31 35 38 0d 0a 0d 0a 71 75 65 72 79  -237158....query
de10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
de20: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT + col0 * - co
de30: 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
de40: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36  ab2..----..-1196
de50: 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35  52..-51034..-585
de60: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  9....skipif post
de70: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
de80: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
de90: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
dea0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
deb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
dec0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
ded0: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 63   col0 * - col1 c
dee0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
def0: 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a  ---..1040..640..
df00: 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  78....onlyif mys
df10: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
df20: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
df30: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
df40: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
df50: 6c 2d 34 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20  l-423..SELECT + 
df60: 63 6f 6c 31 20 44 49 56 20 2b 20 74 61 62 30 2e  col1 DIV + tab0.
df70: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
df80: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
df90: 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
dfa0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
dfb0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
dfc0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32  rowsort label-42
dfd0: 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  3..SELECT + col1
dfe0: 20 2f 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 41   / + tab0.col1 A
dff0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
e000: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
e010: 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
e020: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
e030: 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45   * FROM tab2 WHE
e040: 52 45 20 28 20 4e 55 4c 4c 20 29 20 49 4e 20 28  RE ( NULL ) IN (
e050: 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c   tab2.col1 + col
e060: 30 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  0 + col2 )..----
e070: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
e080: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
e090: 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
e0a0: 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20  NOT NULL NOT IN 
e0b0: 28 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  ( - tab0.col2 * 
e0c0: 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a  + col2 )..----..
e0d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e0e0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
e0f0: 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 74 61  l2 * col0 + - ta
e100: 62 30 2e 63 6f 6c 32 20 2d 20 74 61 62 30 2e 63  b0.col2 - tab0.c
e110: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol2 * + col0 FRO
e120: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
e130: 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e  ..-33..-82....on
e140: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
e150: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
e160: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
e170: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
e180: 6f 72 74 20 6c 61 62 65 6c 2d 34 32 37 0d 0a 53  ort label-427..S
e190: 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 31 20  ELECT tab2.col1 
e1a0: 2a 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c  * col1 DIV - col
e1b0: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
e1c0: 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 0d 0a 2d 34 34  -..-137..-3..-44
e1d0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
e1e0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
e1f0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
e200: 72 74 20 6c 61 62 65 6c 2d 34 32 37 0d 0a 53 45  rt label-427..SE
e210: 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 31 20 2a  LECT tab2.col1 *
e220: 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 46   col1 / - col0 F
e230: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
e240: 2d 31 33 37 0d 0a 2d 33 0d 0a 2d 34 34 0d 0a 0d  -137..-3..-44...
e250: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
e260: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
e270: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
e280: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
e290: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
e2a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e2b0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
e2c0: 32 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20  2 * - col2 col2 
e2d0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
e2e0: 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a  .1..1089..6724..
e2f0: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
e300: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
e310: 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
e320: 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20  T col0 + col0 * 
e330: 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  - col2 * - col2 
e340: 3e 3d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32  >= col1 * - col2
e350: 20 2a 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a 0d   * col2..----...
e360: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
e370: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
e380: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
e390: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
e3a0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
e3b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e3c0: 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  T + col0 * col2 
e3d0: 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 63 6f  * col1 - col1 co
e3e0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
e3f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 35  cor0..----..1195
e400: 39 33 0d 0a 35 31 30 31 37 0d 0a 35 38 32 38 0d  93..51017..5828.
e410: 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
e420: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
e430: 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45   * FROM tab2 WHE
e440: 52 45 20 4e 55 4c 4c 20 3c 3e 20 28 20 63 6f 6c  RE NULL <> ( col
e450: 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69  1 )..----....ski
e460: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
e470: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
e480: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
e490: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
e4a0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
e4b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
e4c0: 4c 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  L col2 * - col0 
e4d0: 2a 20 74 61 62 31 2e 63 6f 6c 31 20 63 6f 6c 30  * tab1.col1 col0
e4e0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
e4f0: 0d 0a 2d 33 36 34 38 30 0d 0a 2d 34 32 31 32 0d  ..-36480..-4212.
e500: 0a 2d 39 39 38 34 30 0d 0a 0d 0a 71 75 65 72 79  .-99840....query
e510: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e520: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  CT - col0 * col1
e530: 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   * col0 + + col2
e540: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   + + col1 * col2
e550: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
e560: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
e570: 0a 2d 32 33 39 32 37 38 0d 0a 2d 35 35 30 32 35  .-239278..-55025
e580: 0d 0a 34 33 36 37 0d 0a 0d 0a 71 75 65 72 79 20  ..4367....query 
e590: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e5a0: 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 30 20  T ALL tab1.col0 
e5b0: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
e5c0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
e5d0: 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
e5e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e5f0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
e600: 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 63 6f  + tab2.col2 * co
e610: 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 * col0 AS col
e620: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
e630: 2d 0d 0a 31 33 35 34 0d 0a 31 35 38 32 34 33 0d  -..1354..158243.
e640: 0a 32 33 37 31 37 35 0d 0a 0d 0a 6f 6e 6c 79 69  .237175....onlyi
e650: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
e660: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
e670: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
e680: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e690: 20 6c 61 62 65 6c 2d 34 33 36 0d 0a 53 45 4c 45   label-436..SELE
e6a0: 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20  CT ALL col0 * - 
e6b0: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41 53  col1 DIV col1 AS
e6c0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
e6d0: 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a  .----..-7..-78..
e6e0: 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -79....skipif my
e6f0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
e700: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
e710: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 36 0d  wsort label-436.
e720: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
e730: 20 2a 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 31   * - col1 / col1
e740: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
e750: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  b2..----..-7..-7
e760: 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20  8..-79....query 
e770: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e780: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
e790: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63  ol1 * + col1 * c
e7a0: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
e7b0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
e7c0: 2d 2d 2d 0d 0a 31 36 32 32 34 0d 0a 33 36 35 30  ---..16224..3650
e7d0: 34 0d 0a 35 37 30 30 0d 0a 0d 0a 71 75 65 72 79  4..5700....query
e7e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e7f0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
e800: 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  l1 * cor0.col1 +
e810: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
e820: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
e830: 2d 2d 0d 0a 2d 32 37 32 0d 0a 2d 33 34 32 32 0d  --..-272..-3422.
e840: 0a 2d 39 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-930....skipif 
e850: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
e860: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
e870: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
e880: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
e890: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e8a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
e8b0: 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
e8c0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  0 cor0..----..24
e8d0: 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72  ..35..89....quer
e8e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e8f0: 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ECT col2 * - col
e900: 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  1 + col2 AS col1
e910: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
e920: 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d  ..-1508..-608..-
e930: 38 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  810....onlyif my
e940: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
e950: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
e960: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
e970: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e980: 65 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54 20 2d  el-441..SELECT -
e990: 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 6c   tab1.col0 + col
e9a0: 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f  2 DIV + col2 FRO
e9b0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
e9c0: 0d 0a 2d 36 33 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b  ..-63..-79....sk
e9d0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
e9e0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
e9f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
ea00: 65 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54 20 2d  el-441..SELECT -
ea10: 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 6c   tab1.col0 + col
ea20: 32 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 / + col2 FROM 
ea30: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  tab1..----..-2..
ea40: 2d 36 33 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72  -63..-79....quer
ea50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ea60: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
ea70: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d   col2 + col1 * -
ea80: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
ea90: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
eaa0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
eab0: 31 39 0d 0a 2d 32 37 31 0d 0a 2d 34 36 35 34 0d  19..-271..-4654.
eac0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ead0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
eae0: 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  NCT col0 + + col
eaf0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
eb00: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
eb10: 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a  -..128..160..6..
eb20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb30: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
eb40: 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  CT - + col0 + - 
eb50: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
eb60: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
eb70: 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a  ----..-29..-74..
eb80: 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -93....query I r
eb90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
eba0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
ebb0: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63   col1 + - cor0.c
ebc0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
ebd0: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
ebe0: 0d 0a 2d 33 30 36 0d 0a 2d 33 35 34 30 0d 0a 2d  ..-306..-3540..-
ebf0: 39 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  992....skipif po
ec00: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
ec10: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
ec20: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
ec30: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
ec40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ec50: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
ec60: 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 32  l1 * + col1 col2
ec70: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
ec80: 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d 33 34  .----..-289..-34
ec90: 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 6f 6e 6c 79  81..-961....only
eca0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
ecb0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
ecc0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
ecd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ece0: 74 20 6c 61 62 65 6c 2d 34 34 37 0d 0a 53 45 4c  t label-447..SEL
ecf0: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  ECT cor0.col2 DI
ed00: 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V + col0 FROM ta
ed10: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b2 cor0..----..0
ed20: 0d 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..3....skipif
ed30: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
ed40: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
ed50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
ed60: 34 37 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  47..SELECT cor0.
ed70: 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 46 52  col2 / + col0 FR
ed80: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
ed90: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 71  --..0..0..3....q
eda0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
edb0: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
edc0: 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e  * col1 + + cor0.
edd0: 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
ede0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
edf0: 2d 0d 0a 31 31 33 36 0d 0a 31 33 32 0d 0a 36 39  -..1136..132..69
ee00: 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
ee10: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
ee20: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
ee30: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
ee40: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ee50: 2d 34 34 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -449..SELECT col
ee60: 31 20 44 49 56 20 63 6f 6c 31 20 2b 20 2d 20 63  1 DIV col1 + - c
ee70: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
ee80: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   tab1..----..-53
ee90: 0d 0a 2d 35 36 0d 0a 2d 39 35 0d 0a 0d 0a 73 6b  ..-56..-95....sk
eea0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
eeb0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
eec0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
eed0: 65 6c 2d 34 34 39 0d 0a 53 45 4c 45 43 54 20 63  el-449..SELECT c
eee0: 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63  ol1 / col1 + - c
eef0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
ef00: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   tab1..----..-53
ef10: 0d 0a 2d 35 36 0d 0a 2d 39 35 0d 0a 0d 0a 71 75  ..-56..-95....qu
ef20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ef30: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  ELECT + col1 + c
ef40: 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 30  ol1 * + ( + col0
ef50: 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
ef60: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35 30  tab0..----..2150
ef70: 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d 0a  ..3492..8190....
ef80: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
ef90: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
efa0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
efb0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
efc0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
efd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
efe0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   - cor0.col0 col
eff0: 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
f000: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  0 cor0..----..9 
f010: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
f020: 6f 20 30 39 64 38 61 39 31 32 64 65 31 62 38 61  o 09d8a912de1b8a
f030: 62 37 36 32 65 35 66 66 62 65 30 32 38 63 65 39  b762e5ffbe028ce9
f040: 39 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  9e....onlyif mys
f050: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
f060: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
f070: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
f080: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f090: 6c 2d 34 35 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-452..SELECT DI
f0a0: 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f  STINCT + cor0.co
f0b0: 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44  l0 + cor0.col1 D
f0c0: 49 56 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20  IV + CAST( col2 
f0d0: 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
f0e0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
f0f0: 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
f100: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
f110: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
f120: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f130: 20 6c 61 62 65 6c 2d 34 35 32 0d 0a 53 45 4c 45   label-452..SELE
f140: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
f150: 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63  r0.col0 + cor0.c
f160: 6f 6c 31 20 2f 20 2b 20 43 41 53 54 20 28 20 63  ol1 / + CAST ( c
f170: 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
f180: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
f190: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  r0..----..3..64.
f1a0: 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
f1b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
f1c0: 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  LL + col2 + + co
f1d0: 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
f1e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
f1f0: 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 71  .52..54..76....q
f200: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f210: 53 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c 30  SELECT cor1.col0
f220: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
f230: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
f240: 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20  S cor1, tab0 AS 
f250: 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
f260: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
f270: 20 30 35 38 33 35 66 32 39 64 64 39 63 64 34 66   05835f29dd9cd4f
f280: 61 31 36 38 38 39 64 65 35 34 64 65 63 33 63 62  a16889de54dec3cb
f290: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
f2a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 34 20  sort..SELECT 14 
f2b0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
f2c0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  1 cor0..----..14
f2d0: 0d 0a 31 34 0d 0a 31 34 0d 0a 0d 0a 71 75 65 72  ..14..14....quer
f2e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f2f0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
f300: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 + - col1 AS 
f310: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
f320: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d  or0..----..-119.
f330: 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75  .-173..-98....qu
f340: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f350: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
f360: 20 2b 20 35 34 20 2a 20 2d 20 63 6f 6c 30 20 41   + 54 * - col0 A
f370: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
f380: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f390: 2d 33 38 35 0d 0a 2d 34 32 39 30 0d 0a 2d 34 33  -385..-4290..-43
f3a0: 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  45....query I ro
f3b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
f3c0: 6c 31 20 2a 20 2b 20 39 20 46 52 4f 4d 20 74 61  l1 * + 9 FROM ta
f3d0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
f3e0: 0d 0a 31 31 37 0d 0a 32 33 34 0d 0a 39 30 0d 0a  ..117..234..90..
f3f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f400: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
f410: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  CT + - col0 * + 
f420: 32 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  21 FROM tab1 AS 
f430: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  cor0..----..-134
f440: 34 0d 0a 2d 31 36 38 30 0d 0a 2d 36 33 0d 0a 0d  4..-1680..-63...
f450: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f460: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
f470: 2b 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 46  + - ( - col1 ) F
f480: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
f490: 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a  ..----..29..74..
f4a0: 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
f4b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
f4c0: 4c 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  L + col1 + col0 
f4d0: 2a 20 2b 20 35 31 20 41 53 20 63 6f 6c 32 20 46  * + 51 AS col2 F
f4e0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
f4f0: 2d 2d 2d 0d 0a 33 38 38 0d 0a 34 30 33 37 0d 0a  ---..388..4037..
f500: 34 30 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4046....onlyif m
f510: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
f520: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
f530: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
f540: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f550: 62 65 6c 2d 34 36 32 0d 0a 53 45 4c 45 43 54 20  bel-462..SELECT 
f560: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 33  ALL - + col1 * 3
f570: 33 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20  3 DIV col2 FROM 
f580: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
f590: 2d 2d 0d 0a 2d 33 32 30 31 0d 0a 2d 33 36 0d 0a  --..-3201..-36..
f5a0: 2d 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -86....skipif my
f5b0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
f5c0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
f5d0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 32 0d  wsort label-462.
f5e0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
f5f0: 63 6f 6c 31 20 2a 20 33 33 20 2f 20 63 6f 6c 32  col1 * 33 / col2
f600: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
f610: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 30 31 0d  r0..----..-3201.
f620: 0a 2d 33 36 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65  .-36..-86....que
f630: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f640: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  LECT - col2 * - 
f650: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
f660: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f670: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
f680: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
f690: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
f6a0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
f6b0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
f6c0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
f6d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
f6e0: 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LL + - col0 * co
f6f0: 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 30  l1 * + col0 col0
f700: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
f710: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d 0a  r0..----..-234..
f720: 2d 34 30 39 36 30 0d 0a 2d 38 33 32 30 30 0d 0a  -40960..-83200..
f730: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f740: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
f750: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   + cor0.col2 FRO
f760: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
f770: 2d 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39  -..2916..3249..9
f780: 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  216....query I r
f790: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
f7a0: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 74  ISTINCT col0 * t
f7b0: 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  ab1.col0 + col1 
f7c0: 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
f7d0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36 37 0d 0a  b1..----..-667..
f7e0: 33 39 39 36 0d 0a 36 32 33 31 0d 0a 0d 0a 71 75  3996..6231....qu
f7f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f800: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
f810: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol1 FROM tab0 WH
f820: 45 52 45 20 4e 4f 54 20 63 6f 6c 30 20 4e 4f 54  ERE NOT col0 NOT
f830: 20 49 4e 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2d   IN ( - col1 * -
f840: 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d   col2 )..----...
f850: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f860: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
f870: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col2 * col1 + co
f880: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
f890: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 33  tab2..----..2263
f8a0: 30 0d 0a 32 34 35 36 35 0d 0a 33 39 39 34 33 0d  0..24565..39943.
f8b0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f8c0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
f8d0: 4e 43 54 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  NCT col0 FROM ta
f8e0: 62 32 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c  b2 WHERE NOT NUL
f8f0: 4c 20 4e 4f 54 20 49 4e 20 28 20 2d 20 63 6f 6c  L NOT IN ( - col
f900: 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  2 )..----....que
f910: 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  ry III rowsort..
f920: 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
f930: 62 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e  b0 WHERE NULL IN
f940: 20 28 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   ( + col2 * col2
f950: 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2b   + tab0.col0 * +
f960: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 29   col2 + + col2 )
f970: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
f980: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f990: 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f 6c  T ALL + tab0.col
f9a0: 30 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  0 - - col0 * col
f9b0: 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
f9c0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d  ab0..----..1260.
f9d0: 0a 36 30 30 0d 0a 38 30 31 30 0d 0a 0d 0a 71 75  .600..8010....qu
f9e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f9f0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
fa00: 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20   - tab0.col1 AS 
fa10: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
fa20: 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d  ----..-2..-62..-
fa30: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
fa40: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
fa50: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col1 + - col1 * 
fa60: 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  + tab1.col1 AS c
fa70: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
fa80: 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a 2d 36 35 30 0d  ---..-156..-650.
fa90: 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-90....query I 
faa0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fab0: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52  + col1 + col2 FR
fac0: 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f  OM tab1 WHERE NO
fad0: 54 20 4e 55 4c 4c 20 4e 4f 54 20 42 45 54 57 45  T NULL NOT BETWE
fae0: 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 28 20 4e 55  EN NULL AND ( NU
faf0: 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  LL )..----....qu
fb00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fb10: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  ELECT - col0 * c
fb20: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol1 * col1 + + c
fb30: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
fb40: 2d 2d 2d 0d 0a 2d 32 32 37 39 33 0d 0a 2d 32 37  ---..-22793..-27
fb50: 31 34 39 32 0d 0a 2d 36 37 30 30 0d 0a 0d 0a 71  1492..-6700....q
fb60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
fb70: 53 45 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f  SELECT - tab1.co
fb80: 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l1 * + col0 * co
fb90: 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 41  l1 + tab1.col0 A
fba0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
fbb0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 34 30 0d 0a  ..----..-13440..
fbc0: 2d 32 30 32 35 0d 0a 2d 36 33 33 36 0d 0a 0d 0a  -2025..-6336....
fbd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fbe0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
fbf0: 63 6f 6c 31 20 29 20 2b 20 2b 20 35 33 20 46 52  col1 ) + + 53 FR
fc00: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
fc10: 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 34 30 0d 0a 34  .----..27..40..4
fc20: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
fc30: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
fc40: 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d  TINCT - col0 * -
fc50: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 28   cor0.col0 + + (
fc60: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 29   col1 * + col1 )
fc70: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
fc80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 39 36 0d 0a  r0..----..4196..
fc90: 36 35 36 39 0d 0a 36 38 35 0d 0a 0d 0a 71 75 65  6569..685....que
fca0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fcb0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
fcc0: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20  col0 * + col0 * 
fcd0: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
fce0: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
fcf0: 2d 32 33 33 34 37 32 0d 0a 2d 34 38 36 0d 0a 2d  -233472..-486..-
fd00: 36 31 34 34 30 30 0d 0a 0d 0a 73 6b 69 70 69 66  614400....skipif
fd10: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
fd20: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
fd30: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
fd40: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
fd50: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
fd60: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
fd70: 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol1 + - col0 col
fd80: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
fd90: 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d 0a  -..2..62..62....
fda0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
fdb0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
fdc0: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20   col2 + col0 AS 
fdd0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
fde0: 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35  ----..171..36..5
fdf0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  7....query III r
fe00: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
fe10: 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
fe20: 61 62 32 20 57 48 45 52 45 20 4e 55 4c 4c 20 49  ab2 WHERE NULL I
fe30: 4e 20 28 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d  N ( - col2 )..--
fe40: 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
fe50: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
fe60: 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  l1 + + col0 + co
fe70: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
fe80: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 0d  tab0..----..134.
fe90: 0a 31 36 37 0d 0a 32 36 39 0d 0a 0d 0a 6f 6e 6c  .167..269....onl
fea0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
feb0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
fec0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
fed0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
fee0: 72 74 20 6c 61 62 65 6c 2d 34 38 34 0d 0a 53 45  rt label-484..SE
fef0: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
ff00: 44 49 56 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63  DIV - col2 - + c
ff10: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
ff20: 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 38 0d 0a 2d  ---..-54..-58..-
ff30: 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
ff40: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
ff50: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
ff60: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38 34 0d 0a  sort label-484..
ff70: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
ff80: 30 20 2f 20 2d 20 63 6f 6c 32 20 2d 20 2b 20 63  0 / - col2 - + c
ff90: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
ffa0: 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 38 0d 0a 2d  ---..-54..-58..-
ffb0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
ffc0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
ffd0: 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  L col1 * col2 + 
ffe0: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
fff0: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35  ..----..2871..75
10000 34 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  44..98....query 
10010 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10020 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 31  T + - col1 + + 1
10030 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
10040 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10050 0d 0a 32 32 37 0d 0a 32 36 36 0d 0a 34 30 31 0d  ..227..266..401.
10060 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
10070 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
10080 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
10090 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
100a0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
100b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
100c0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ECT cor0.col1 * 
100d0 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
100e0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
100f0 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36  -..1343..217..46
10100 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
10110 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
10120 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f 6c  STINCT - ( + col
10130 30 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20  0 + + tab1.col2 
10140 29 20 2a 20 34 36 20 41 53 20 63 6f 6c 31 20 46  ) * 46 AS col1 F
10150 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
10160 2d 32 36 32 32 0d 0a 2d 35 35 36 36 0d 0a 2d 38  -2622..-5566..-8
10170 30 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  096....query I r
10180 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
10190 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d  ol0 * - col1 * -
101a0 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
101b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
101c0 2d 0d 0a 31 30 36 30 39 37 0d 0a 31 35 31 39 0d  -..106097..1519.
101d0 0a 33 35 38 39 35 36 0d 0a 0d 0a 73 6b 69 70 69  .358956....skipi
101e0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
101f0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
10200 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
10210 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
10220 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
10230 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
10240 2d 20 32 39 20 63 6f 6c 30 20 46 52 4f 4d 20 74  - 29 col0 FROM t
10250 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a  ab1..----..-29..
10260 2d 32 39 0d 0a 2d 32 39 0d 0a 0d 0a 73 6b 69 70  -29..-29....skip
10270 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
10280 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
10290 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
102a0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
102b0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
102c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 38 20  sort..SELECT 48 
102d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
102e0 2d 2d 2d 2d 0d 0a 34 38 0d 0a 34 38 0d 0a 34 38  ----..48..48..48
102f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10300 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
10310 49 4e 43 54 20 2b 20 35 35 20 2a 20 2d 20 63 6f  INCT + 55 * - co
10320 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
10330 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 33  tab2..----..-143
10340 30 0d 0a 2d 31 34 38 35 0d 0a 2d 32 30 39 30 0d  0..-1485..-2090.
10350 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10360 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 33 20  rt..SELECT + 63 
10370 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
10380 0a 36 33 0d 0a 36 33 0d 0a 36 33 0d 0a 0d 0a 71  .63..63..63....q
10390 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
103a0 53 45 4c 45 43 54 20 2b 20 34 31 20 46 52 4f 4d  SELECT + 41 FROM
103b0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
103c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
103d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
103e0 62 31 38 39 38 36 62 62 32 39 34 34 31 32 62 33  b18986bb294412b3
103f0 64 39 66 30 37 62 37 65 36 66 63 38 32 31 65 0d  d9f07b7e6fc821e.
10400 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
10410 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
10420 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
10430 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
10440 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61  SS JOIN tab2, ta
10450 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30  b2 AS cor1, tab0
10460 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a  , tab2 AS cor2..
10470 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65  ----..3645 value
10480 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 39 63  s hashing to 59c
10490 61 37 63 39 36 66 33 39 35 35 65 30 31 34 62 65  a7c96f3955e014be
104a0 62 64 30 38 62 35 34 34 32 65 64 66 66 0d 0a 0d  bd08b5442edff...
104b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
104c0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
104d0 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b 20  - tab2.col0 * + 
104e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
104f0 2d 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 32 31  ----..-1264..-21
10500 30 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 71 75 65 72  0..-4524....quer
10510 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10520 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 63  ECT - + col2 + c
10530 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
10540 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10550 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a  ..-21..33..4....
10560 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10570 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d  .SELECT col0 * -
10580 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f   col1 * col1 FRO
10590 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
105a0 2d 0d 0a 2d 31 37 37 35 30 34 0d 0a 2d 33 32 39  -..-177504..-329
105b0 33 31 35 0d 0a 2d 37 33 37 30 30 39 0d 0a 0d 0a  315..-737009....
105c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
105d0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
105e0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
105f0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
10600 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
10610 72 74 20 6c 61 62 65 6c 2d 34 39 39 0d 0a 53 45  rt label-499..SE
10620 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  LECT + - col0 * 
10630 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
10640 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
10650 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
10660 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
10670 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
10680 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
10690 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
106a0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 39 0d 0a  sort label-499..
106b0 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20  SELECT + - col0 
106c0 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * + CAST ( NULL 
106d0 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
106e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
106f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
10700 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
10710 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10720 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
10730 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  + + tab0.col2 * 
10740 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab0.col1 AS col
10750 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
10760 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a 39  -..2871..7544..9
10770 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
10780 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
10790 34 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  4 + col0 FROM ta
107a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
107b0 0d 0a 31 36 32 0d 0a 31 36 33 0d 0a 39 31 0d 0a  ..162..163..91..
107c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
107d0 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 28 20  t..SELECT ( + ( 
107e0 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 39 33 20  + col1 ) * + 93 
107f0 29 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ) + + col2 FROM 
10800 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 30 33 31  tab0..----..8031
10810 0d 0a 38 35 34 35 0d 0a 39 30 32 32 0d 0a 0d 0a  ..8545..9022....
10820 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10830 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
10840 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
10850 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
10860 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a  .-24..19..62....
10870 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10880 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
10890 20 2d 20 32 31 20 2b 20 2b 20 28 20 63 6f 6c 30   - 21 + + ( col0
108a0 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
108b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d  cor0..----..-18.
108c0 0a 34 33 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79  .43..59....query
108d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
108e0 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  CT + + col1 + co
108f0 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46  l2 * cor0.col2 F
10900 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
10910 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36 38  ..----..1175..68
10920 31 35 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  15..98....query 
10930 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10940 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
10950 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 * + cor0.col
10960 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  2 + cor0.col0 FR
10970 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
10980 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d 31 39  .----..-182..-19
10990 35 30 0d 0a 2d 32 39 32 33 0d 0a 0d 0a 71 75 65  50..-2923....que
109a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
109b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
109c0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  col2 * col0 + + 
109d0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
109e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
109f0 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a 33 36 35 38 0d  ----..188..3658.
10a00 0a 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .7693....query I
10a10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10a20 20 44 49 53 54 49 4e 43 54 20 2b 20 37 32 20 41   DISTINCT + 72 A
10a30 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
10a40 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  , tab0 AS cor0 C
10a50 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a  ROSS JOIN tab0..
10a60 2d 2d 2d 2d 0d 0a 37 32 0d 0a 0d 0a 71 75 65 72  ----..72....quer
10a70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10a80 45 43 54 20 37 30 20 2a 20 63 6f 6c 31 20 2a 20  ECT 70 * col1 * 
10a90 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
10aa0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
10ab0 2d 2d 2d 2d 0d 0a 33 39 39 30 30 0d 0a 38 37 33  ----..39900..873
10ac0 36 30 0d 0a 39 38 32 38 30 0d 0a 0d 0a 71 75 65  60..98280....que
10ad0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10ae0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
10af0 2d 20 34 37 20 46 52 4f 4d 20 74 61 62 32 20 41  - 47 FROM tab2 A
10b00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37  S cor0..----..47
10b10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10b20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
10b30 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  INCT cor0.col2 *
10b40 20 2b 20 38 20 46 52 4f 4d 20 74 61 62 32 2c 20   + 8 FROM tab2, 
10b50 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
10b60 0a 32 36 34 0d 0a 36 35 36 0d 0a 38 0d 0a 0d 0a  .264..656..8....
10b70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10b80 0a 53 45 4c 45 43 54 20 2b 20 34 20 41 53 20 63  .SELECT + 4 AS c
10b90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
10ba0 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
10bb0 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  1 cor1..----..27
10bc0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
10bd0 74 6f 20 37 33 30 64 66 66 37 38 65 38 33 31 31  to 730dff78e8311
10be0 32 33 37 34 39 36 31 65 61 37 31 31 66 39 38 65  2374961ea711f98e
10bf0 62 61 61 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  baa....skipif po
10c00 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
10c10 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
10c20 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
10c30 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
10c40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10c50 0a 53 45 4c 45 43 54 20 2d 20 2d 20 32 32 20 2b  .SELECT - - 22 +
10c60 20 2b 20 63 6f 6c 32 20 2a 20 36 30 20 63 6f 6c   + col2 * 60 col
10c70 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
10c80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 32 0d  or0..----..1582.
10c90 0a 31 36 34 32 0d 0a 32 33 30 32 0d 0a 0d 0a 71  .1642..2302....q
10ca0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10cb0 53 45 4c 45 43 54 20 2d 20 38 35 20 2b 20 2b 20  SELECT - 85 + + 
10cc0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
10cd0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
10ce0 2d 2d 2d 0d 0a 31 31 36 33 0d 0a 31 33 31 39 0d  ---..1163..1319.
10cf0 0a 34 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .485....query I 
10d00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10d10 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
10d20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col1 * + col0 + 
10d30 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63  col2 + col2 AS c
10d40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
10d50 2d 2d 2d 0d 0a 31 37 37 35 37 30 0d 0a 33 32 39  ---..177570..329
10d60 33 31 37 0d 0a 37 33 37 31 37 33 0d 0a 0d 0a 71  317..737173....q
10d70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10d80 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
10d90 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
10da0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab2..----..0.
10db0 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
10dc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10dd0 20 41 4c 4c 20 31 39 20 46 52 4f 4d 20 74 61 62   ALL 19 FROM tab
10de0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 31 39 0d  1..----..19..19.
10df0 0a 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .19....query I r
10e00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
10e10 20 34 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d   41 + + col2 * -
10e20 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
10e30 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
10e40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 35  cor0..----..-725
10e50 37 0d 0a 2d 37 35 31 0d 0a 36 0d 0a 0d 0a 71 75  7..-751..6....qu
10e60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10e70 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  ELECT cor0.col2 
10e80 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  * col1 * - col0 
10e90 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + - col0 AS col1
10ea0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
10eb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 33 30 0d  r0..----..-3430.
10ec0 0a 2d 36 36 34 32 30 37 0d 0a 2d 36 38 31 33 36  .-664207..-68136
10ed0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10ee0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 20  ort..SELECT + 7 
10ef0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
10f00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
10f10 0a 37 0d 0a 37 0d 0a 37 0d 0a 0d 0a 71 75 65 72  .7..7..7....quer
10f20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10f30 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  ECT col2 * col2 
10f40 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  * + col2 + col1 
10f50 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * - col2 AS col2
10f60 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
10f70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 36 30  r0..----..156060
10f80 0d 0a 31 38 34 36 32 33 0d 0a 38 38 33 34 38 38  ..184623..883488
10f90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10fa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
10fb0 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  INCT + col1 + + 
10fc0 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col0 * col2 FROM
10fd0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
10fe0 0d 0a 31 33 32 0d 0a 37 33 38 39 0d 0a 38 37 38  ..132..7389..878
10ff0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
11000 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
11010 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
11020 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
11030 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
11040 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11050 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 63 6f  LECT - - col2 co
11060 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
11070 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d  0..----..54..57.
11080 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
11090 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
110a0 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LL + col2 + - co
110b0 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  l1 * + col2 + co
110c0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
110d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
110e0 2d 2d 0d 0a 2d 31 30 37 32 0d 0a 2d 31 33 34 37  --..-1072..-1347
110f0 0d 0a 2d 34 34 39 0d 0a 0d 0a 71 75 65 72 79 20  ..-449....query 
11100 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11110 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d  T ALL + col0 + -
11120 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
11130 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
11140 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d  --..-24..19..62.
11150 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11160 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
11170 6f 6c 30 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ol0 - col1 FROM 
11180 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
11190 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32  --..-2..-62..-62
111a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
111b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
111c0 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  col0 - col1 * co
111d0 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l2 * - col1 AS c
111e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
111f0 2d 2d 2d 0d 0a 31 36 33 30 34 0d 0a 33 36 35 30  ---..16304..3650
11200 37 0d 0a 35 37 36 34 0d 0a 0d 0a 71 75 65 72 79  7..5764....query
11210 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11220 43 54 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20  CT + ( - col2 ) 
11230 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  - + col1 FROM ta
11240 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 0d 0a  b1..----..-109..
11250 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79  -67..-80....only
11260 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
11270 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
11280 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
11290 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
112a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
112b0 61 62 65 6c 2d 35 32 39 0d 0a 53 45 4c 45 43 54  abel-529..SELECT
112c0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
112d0 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 2b  IGNED ) * col1 +
112e0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
112f0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
11300 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
11310 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11320 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11330 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11340 6c 2d 35 32 39 0d 0a 53 45 4c 45 43 54 20 43 41  l-529..SELECT CA
11350 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
11360 45 47 45 52 20 29 20 2a 20 63 6f 6c 31 20 2b 20  EGER ) * col1 + 
11370 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
11380 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
11390 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
113a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
113b0 45 43 54 20 37 34 20 2a 20 2b 20 63 6f 6c 31 20  ECT 74 * + col1 
113c0 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  * - col1 + - col
113d0 31 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  1 + + col1 AS co
113e0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
113f0 2d 2d 0d 0a 2d 31 32 35 30 36 0d 0a 2d 35 30 30  --..-12506..-500
11400 32 34 0d 0a 2d 37 34 30 30 0d 0a 0d 0a 71 75 65  24..-7400....que
11410 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11420 4c 45 43 54 20 2b 20 2b 20 33 35 20 2b 20 38 38  LECT + + 35 + 88
11430 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
11440 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
11450 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 31 0d 0a 32  0..----..1531..2
11460 37 36 33 0d 0a 35 32 32 37 0d 0a 0d 0a 71 75 65  763..5227....que
11470 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11480 4c 45 43 54 20 41 4c 4c 20 37 35 20 41 53 20 63  LECT ALL 75 AS c
11490 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
114a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 35 0d   cor0..----..75.
114b0 0a 37 35 0d 0a 37 35 0d 0a 0d 0a 71 75 65 72 79  .75..75....query
114c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
114d0 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 72 30  CT - col1 * cor0
114e0 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col1 * cor0.col
114f0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
11500 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 33 37 39 0d  ..----..-205379.
11510 0a 2d 32 39 37 39 31 0d 0a 2d 34 39 31 33 0d 0a  .-29791..-4913..
11520 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
11530 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
11540 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
11550 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
11560 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33  rowsort label-53
11570 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 33  4..SELECT ALL 43
11580 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20   + - col1 DIV + 
11590 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
115a0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
115b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  or0..----..-54..
115c0 34 31 0d 0a 34 32 0d 0a 0d 0a 73 6b 69 70 69 66  41..42....skipif
115d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
115e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
115f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
11600 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  34..SELECT ALL 4
11610 33 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63  3 + - col1 / + c
11620 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
11630 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
11640 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 34  r0..----..-54..4
11650 31 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..42....query I
11660 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11670 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 2a   col0 - + col2 *
11680 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
11690 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
116a0 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38  ----..-159..-358
116b0 34 0d 0a 2d 37 36 30 30 0d 0a 0d 0a 71 75 65 72  4..-7600....quer
116c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
116d0 45 43 54 20 34 33 20 2a 20 63 6f 6c 31 20 41 53  ECT 43 * col1 AS
116e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
116f0 0a 2d 2d 2d 2d 0d 0a 31 31 31 38 0d 0a 34 33 30  .----..1118..430
11700 0d 0a 35 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..559....query I
11710 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11720 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b   - cor0.col0 + +
11730 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
11740 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
11750 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
11760 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
11770 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
11780 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
11790 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
117a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33  rowsort label-53
117b0 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  8..SELECT - - co
117c0 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  l0 * - col0 + + 
117d0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col2 * - col2 + 
117e0 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c  - col0 DIV - col
117f0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
11800 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
11810 2d 0d 0a 2d 31 35 36 31 36 0d 0a 2d 32 39 32 35  -..-15616..-2925
11820 0d 0a 2d 37 33 34 34 0d 0a 0d 0a 73 6b 69 70 69  ..-7344....skipi
11830 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
11840 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
11850 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
11860 35 33 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  538..SELECT - - 
11870 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col0 * - col0 + 
11880 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  + col2 * - col2 
11890 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  + - col0 / - col
118a0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
118b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
118c0 2d 0d 0a 2d 31 35 36 31 36 0d 0a 2d 32 39 32 35  -..-15616..-2925
118d0 0d 0a 2d 37 33 34 34 0d 0a 0d 0a 71 75 65 72 79  ..-7344....query
118e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
118f0 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e  CT ALL - - cor0.
11900 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col0 * - col0 + 
11910 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
11920 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11930 2d 31 32 32 36 0d 0a 2d 36 30 39 0d 0a 2d 38 30  -1226..-609..-80
11940 30 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  03....onlyif mys
11950 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
11960 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
11970 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
11980 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11990 6c 2d 35 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20  l-540..SELECT + 
119a0 28 20 2d 20 35 36 20 29 20 44 49 56 20 2d 20 63  ( - 56 ) DIV - c
119b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
119c0 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 35 36 0d 0a 0d  ---..0..1..56...
119d0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
119e0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
119f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11a00 6c 61 62 65 6c 2d 35 34 30 0d 0a 53 45 4c 45 43  label-540..SELEC
11a10 54 20 2b 20 28 20 2d 20 35 36 20 29 20 2f 20 2d  T + ( - 56 ) / -
11a20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
11a30 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 35 36 0d  .----..0..1..56.
11a40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11a50 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 33 20  rt..SELECT + 83 
11a60 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
11a70 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 38 33 0d  0..----..83..83.
11a80 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .83....query I r
11a90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
11aa0 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   ( col2 ) AS col
11ab0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
11ac0 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
11ad0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11ae0 0d 0a 53 45 4c 45 43 54 20 2b 20 39 20 46 52 4f  ..SELECT + 9 FRO
11af0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 39 0d  M tab1..----..9.
11b00 0a 39 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .9..9....query I
11b10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11b20 20 41 4c 4c 20 2b 20 28 20 38 34 20 29 20 2b 20   ALL + ( 84 ) + 
11b30 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
11b40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11b50 32 30 0d 0a 34 0d 0a 38 31 0d 0a 0d 0a 71 75 65  20..4..81....que
11b60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11b70 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  LECT - col2 * + 
11b80 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col2 + - col0 * 
11b90 37 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  71 FROM tab1..--
11ba0 2d 2d 0d 0a 2d 31 34 38 39 36 0d 0a 2d 33 31 32  --..-14896..-312
11bb0 39 0d 0a 2d 37 37 39 33 0d 0a 0d 0a 71 75 65 72  9..-7793....quer
11bc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11bd0 45 43 54 20 2d 20 38 35 20 2a 20 63 6f 6c 31 20  ECT - 85 * col1 
11be0 2a 20 2d 20 63 6f 6c 30 20 2b 20 74 61 62 30 2e  * - col0 + tab0.
11bf0 63 6f 6c 32 20 2a 20 74 61 62 30 2e 63 6f 6c 30  col2 * tab0.col0
11c00 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
11c10 0d 0a 31 37 36 32 33 32 0d 0a 32 38 38 36 31 30  ..176232..288610
11c20 0d 0a 36 39 35 37 31 33 0d 0a 0d 0a 71 75 65 72  ..695713....quer
11c30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11c40 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 38  ECT DISTINCT ( 8
11c50 39 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  9 ) * + cor0.col
11c60 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 + col0 FROM ta
11c70 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
11c80 0d 0a 37 36 37 38 0d 0a 38 31 38 38 0d 0a 38 36  ..7678..8188..86
11c90 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  68....query I ro
11ca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
11cb0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f  cor0.col2 + + co
11cc0 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l2 * - col2 FROM
11cd0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
11ce0 2d 2d 2d 0d 0a 2d 32 38 36 32 0d 0a 2d 33 31 39  ---..-2862..-319
11cf0 32 0d 0a 2d 39 31 32 30 0d 0a 0d 0a 71 75 65 72  2..-9120....quer
11d00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11d10 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
11d20 20 39 35 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d   95 * - col2 + -
11d30 20 38 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   89 AS col1 FROM
11d40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
11d50 2d 2d 2d 0d 0a 2d 31 35 34 37 39 0d 0a 2d 33 34  ---..-15479..-34
11d60 36 36 34 39 0d 0a 2d 37 32 39 36 38 39 0d 0a 0d  6649..-729689...
11d70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11d80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 39 20  ..SELECT ALL 49 
11d90 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11da0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
11db0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
11dc0 68 61 73 68 69 6e 67 20 74 6f 20 63 62 34 30 37  hashing to cb407
11dd0 38 33 63 30 66 66 66 37 32 65 38 38 30 32 63 64  83c0fff72e8802cd
11de0 66 30 36 38 32 65 37 63 62 35 35 0d 0a 0d 0a 71  f0682e7cb55....q
11df0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11e00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11e10 2d 20 2b 20 28 20 2d 20 28 20 2d 20 63 6f 6c 31  - + ( - ( - col1
11e20 20 29 20 29 20 2d 20 2b 20 35 39 20 41 53 20 63   ) ) - + 59 AS c
11e30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
11e40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
11e50 38 0d 0a 2d 37 36 0d 0a 2d 39 30 0d 0a 0d 0a 71  8..-76..-90....q
11e60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11e70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11e80 2d 20 38 34 20 2a 20 63 6f 6c 30 20 41 53 20 63  - 84 * col0 AS c
11e90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
11ea0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
11eb0 31 36 0d 0a 2d 32 39 34 30 0d 0a 2d 37 34 37 36  16..-2940..-7476
11ec0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
11ed0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
11ee0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
11ef0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
11f00 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
11f10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 33  owsort label-553
11f20 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28  ..SELECT + CAST(
11f30 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
11f40 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ) * col0 AS col0
11f50 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
11f60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
11f70 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
11f80 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
11f90 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
11fa0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11fb0 65 6c 2d 35 35 33 0d 0a 53 45 4c 45 43 54 20 2b  el-553..SELECT +
11fc0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
11fd0 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30  INTEGER ) * col0
11fe0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
11ff0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
12000 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
12010 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
12020 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
12030 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
12040 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
12050 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12060 6c 2d 35 35 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-554..SELECT DI
12070 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 44 49  STINCT + col0 DI
12080 56 20 39 30 20 46 52 4f 4d 20 74 61 62 32 20 41  V 90 FROM tab2 A
12090 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
120a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
120b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
120c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
120d0 74 20 6c 61 62 65 6c 2d 35 35 34 0d 0a 53 45 4c  t label-554..SEL
120e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
120f0 6f 6c 30 20 2f 20 39 30 20 46 52 4f 4d 20 74 61  ol0 / 90 FROM ta
12100 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
12110 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
12120 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
12130 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
12140 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
12150 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12160 65 6c 2d 35 35 35 0d 0a 53 45 4c 45 43 54 20 44  el-555..SELECT D
12170 49 53 54 49 4e 43 54 20 36 32 20 2b 20 2b 20 63  ISTINCT 62 + + c
12180 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol0 DIV cor0.col
12190 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
121a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
121b0 2d 0d 0a 36 32 0d 0a 36 33 0d 0a 0d 0a 73 6b 69  -..62..63....ski
121c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
121d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
121e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
121f0 6c 2d 35 35 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-555..SELECT DI
12200 53 54 49 4e 43 54 20 36 32 20 2b 20 2b 20 63 6f  STINCT 62 + + co
12210 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l0 / cor0.col2 A
12220 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
12230 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12240 36 32 0d 0a 36 33 0d 0a 0d 0a 71 75 65 72 79 20  62..63....query 
12250 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12260 54 20 36 32 20 2d 20 2d 20 63 6f 6c 31 20 41 53  T 62 - - col1 AS
12270 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
12280 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
12290 34 38 0d 0a 31 35 33 0d 0a 31 35 39 0d 0a 0d 0a  48..153..159....
122a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
122b0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
122c0 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 32   col2 + - ( col2
122d0 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
122e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32  cor0..----..1152
122f0 0d 0a 31 33 35 30 0d 0a 35 31 33 0d 0a 0d 0a 71  ..1350..513....q
12300 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12310 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
12320 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f  ol2 - - col2 FRO
12330 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
12340 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
12350 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12360 0d 0a 53 45 4c 45 43 54 20 2b 20 31 20 2b 20 63  ..SELECT + 1 + c
12370 6f 6c 31 20 2a 20 28 20 63 6f 6c 32 20 29 20 46  ol1 * ( col2 ) F
12380 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
12390 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 39 0d 0a 31 34  ..----..1249..14
123a0 30 35 0d 0a 35 37 31 0d 0a 0d 0a 71 75 65 72 79  05..571....query
123b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
123c0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
123d0 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   * cor0.col1 AS 
123e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
123f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  or0..----..2838.
12400 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .7462..97....que
12410 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12420 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
12430 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
12440 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
12450 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38  --..1534..646..8
12460 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
12470 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
12480 53 54 49 4e 43 54 20 28 20 2d 20 74 61 62 32 2e  STINCT ( - tab2.
12490 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
124a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d  ..----..-7..-78.
124b0 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-79....query I 
124c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
124d0 44 49 53 54 49 4e 43 54 20 32 32 20 2a 20 2b 20  DISTINCT 22 * + 
124e0 35 39 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  59 * - col0 AS c
124f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
12500 2d 2d 2d 0d 0a 2d 31 30 31 32 34 34 0d 0a 2d 31  ---..-101244..-1
12510 30 32 35 34 32 0d 0a 2d 39 30 38 36 0d 0a 0d 0a  02542..-9086....
12520 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
12530 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
12540 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
12550 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
12560 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
12570 72 74 20 6c 61 62 65 6c 2d 35 36 34 0d 0a 53 45  rt label-564..SE
12580 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
12590 6c 32 20 2f 20 74 61 62 32 2e 63 6f 6c 31 20 2b  l2 / tab2.col1 +
125a0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
125b0 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
125c0 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  2, tab1 AS cor0.
125d0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
125e0 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
125f0 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
12600 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73  ff0d216fe0b....s
12610 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
12620 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
12630 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
12640 62 65 6c 2d 35 36 34 0d 0a 53 45 4c 45 43 54 20  bel-564..SELECT 
12650 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20  ALL cor0.col2 / 
12660 74 61 62 32 2e 63 6f 6c 31 20 2b 20 43 41 53 54  tab2.col1 + CAST
12670 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
12680 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20  ER ) FROM tab2, 
12690 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
126a0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
126b0 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31  hing to cd7a7901
126c0 65 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30  e47c15155404aff0
126d0 64 32 31 36 66 65 30 62 0d 0a 0d 0a 6f 6e 6c 79  d216fe0b....only
126e0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
126f0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
12700 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
12710 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12720 74 20 6c 61 62 65 6c 2d 35 36 35 0d 0a 53 45 4c  t label-565..SEL
12730 45 43 54 20 33 36 20 44 49 56 20 63 6f 6c 30 20  ECT 36 DIV col0 
12740 2d 20 63 6f 6c 30 20 2a 20 36 20 44 49 56 20 2b  - col0 * 6 DIV +
12750 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
12760 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
12770 31 0d 0a 2d 35 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  1..-5..0....skip
12780 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12790 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
127a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
127b0 2d 35 36 35 0d 0a 53 45 4c 45 43 54 20 33 36 20  -565..SELECT 36 
127c0 2f 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20  / col0 - col0 * 
127d0 36 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  6 / + col1 AS co
127e0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
127f0 2d 2d 0d 0a 2d 31 0d 0a 2d 35 0d 0a 30 0d 0a 0d  --..-1..-5..0...
12800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12810 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62  ..SELECT ALL tab
12820 30 2e 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f  0.col0 * tab0.co
12830 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
12840 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62 30  tab0, tab2, tab0
12850 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12860 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
12870 67 20 74 6f 20 61 66 66 33 31 31 66 61 31 62 33  g to aff311fa1b3
12880 39 34 38 65 31 37 39 37 37 39 63 63 30 33 63 31  948e179779cc03c1
12890 66 61 64 65 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  fade4....skipif 
128a0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
128b0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
128c0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
128d0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
128e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
128f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12900 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20  CT + col0 * - ( 
12910 2b 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c  + col1 ) * - col
12920 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  2 col1 FROM tab2
12930 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12940 31 31 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35  119652..51034..5
12950 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  859....query I r
12960 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12970 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b  ISTINCT + col0 +
12980 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29   - ( cor0.col2 )
12990 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
129a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34  r0..----..-20..4
129b0 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..52....query I
129c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
129d0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 28   - cor0.col2 + (
129e0 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20   col1 ) AS col0 
129f0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
12a00 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34  ----..-21..33..4
12a10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12a20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
12a30 6c 31 20 2a 20 35 36 20 41 53 20 63 6f 6c 31 20  l1 * 56 AS col1 
12a40 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
12a50 2d 2d 2d 2d 0d 0a 31 37 33 36 0d 0a 33 33 30 34  ----..1736..3304
12a60 0d 0a 39 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..952....query I
12a70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12a80 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
12a90 20 2a 20 28 20 2d 20 34 37 20 29 20 2b 20 2b 20   * ( - 47 ) + + 
12aa0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
12ab0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
12ac0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 36 0d 0a  or0..----..356..
12ad0 33 36 39 32 0d 0a 33 37 35 31 0d 0a 0d 0a 71 75  3692..3751....qu
12ae0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12af0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  ELECT + - col0 *
12b00 20 31 39 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f   19 * - col1 FRO
12b10 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
12b20 2d 2d 2d 2d 0d 0a 31 35 33 38 38 31 0d 0a 33 39  ----..153881..39
12b30 32 31 36 0d 0a 36 34 35 30 35 0d 0a 0d 0a 71 75  216..64505....qu
12b40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12b50 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
12b60 6c 31 20 2b 20 28 20 2b 20 39 36 20 29 20 2a 20  l1 + ( + 96 ) * 
12b70 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
12b80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35  S cor0..----..25
12b90 35 35 0d 0a 32 36 32 33 0d 0a 33 36 36 35 0d 0a  55..2623..3665..
12ba0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12bb0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
12bc0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
12bd0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
12be0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
12bf0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 34 0d 0a  sort label-574..
12c00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12c10 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c  col1 * CAST( NUL
12c20 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
12c30 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
12c40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12c50 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
12c60 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
12c70 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
12c80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 34  owsort label-574
12c90 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12ca0 54 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  T col1 * CAST ( 
12cb0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
12cc0 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ) + + col0 FROM 
12cd0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
12ce0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
12cf0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12d00 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28  ECT - col1 + + (
12d10 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   - col2 * + col2
12d20 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
12d30 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
12d40 2d 2d 0d 0a 2d 31 34 36 31 0d 0a 2d 37 33 35 0d  --..-1461..-735.
12d50 0a 2d 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-760....query I
12d60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12d70 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 31   ALL + cor0.col1
12d80 20 2a 20 32 31 20 41 53 20 63 6f 6c 32 20 46 52   * 21 AS col2 FR
12d90 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
12da0 0a 2d 2d 2d 2d 0d 0a 31 38 30 36 0d 0a 31 39 31  .----..1806..191
12db0 31 0d 0a 32 30 33 37 0d 0a 0d 0a 71 75 65 72 79  1..2037....query
12dc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12dd0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
12de0 6c 31 20 2a 20 2b 20 32 35 20 46 52 4f 4d 20 74  l1 * + 25 FROM t
12df0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
12e00 2d 0d 0a 32 35 30 0d 0a 33 32 35 0d 0a 36 35 30  -..250..325..650
12e10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12e20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
12e30 2d 20 63 6f 6c 32 20 2a 20 2b 20 36 35 20 41 53  - col2 * + 65 AS
12e40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
12e50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
12e60 31 36 39 30 0d 0a 2d 31 37 35 35 0d 0a 2d 32 34  1690..-1755..-24
12e70 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  70....skipif pos
12e80 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
12e90 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
12ea0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
12eb0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
12ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12ed0 53 45 4c 45 43 54 20 2b 20 39 37 20 63 6f 6c 32  SELECT + 97 col2
12ee0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
12ef0 0d 0a 39 37 0d 0a 39 37 0d 0a 39 37 0d 0a 0d 0a  ..97..97..97....
12f00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12f10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
12f20 20 2b 20 39 20 46 52 4f 4d 20 74 61 62 31 2c 20   + 9 FROM tab1, 
12f30 74 61 62 32 20 63 6f 72 30 2c 20 74 61 62 31 20  tab2 cor0, tab1 
12f40 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
12f50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12f60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
12f70 49 4e 43 54 20 2b 20 37 33 20 46 52 4f 4d 20 74  INCT + 73 FROM t
12f80 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
12f90 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  0, tab1, tab2 AS
12fa0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d   cor1..----..73.
12fb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12fc0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
12fd0 2a 20 2b 20 39 32 20 46 52 4f 4d 20 74 61 62 30  * + 92 FROM tab0
12fe0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12ff0 32 32 30 38 0d 0a 33 32 32 30 0d 0a 38 31 38 38  2208..3220..8188
13000 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13010 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
13020 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d  + cor1.col1 FROM
13030 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53   tab1 cor0 CROSS
13040 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 30   JOIN tab0, tab0
13050 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
13060 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
13070 6f 20 32 64 36 64 33 30 33 31 64 66 65 39 30 65  o 2d6d3031dfe90e
13080 30 63 30 32 64 62 31 33 61 61 36 33 39 39 33 62  0c02db13aa63993b
13090 66 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  fd....query I ro
130a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
130b0 6c 30 20 2b 20 2d 20 35 34 20 41 53 20 63 6f 6c  l0 + - 54 AS col
130c0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
130d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a  or0..----..-51..
130e0 31 30 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20  10..26....query 
130f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13100 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c  T ALL col0 * col
13110 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 + col2 AS col1
13120 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
13130 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d  ..36..7380..825.
13140 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
13150 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
13160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13170 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 43 41  t..SELECT - - CA
13180 53 54 20 28 20 2d 20 39 39 20 41 53 20 52 45 41  ST ( - 99 AS REA
13190 4c 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  L ) AS col1 FROM
131a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
131b0 2d 2d 2d 0d 0a 2d 39 39 0d 0a 2d 39 39 0d 0a 2d  ---..-99..-99..-
131c0 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
131d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
131e0 53 54 49 4e 43 54 20 34 38 20 2a 20 36 37 20 2a  STINCT 48 * 67 *
131f0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
13200 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
13210 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13220 0d 0a 32 30 35 38 32 34 0d 0a 32 35 37 32 38 30  ..205824..257280
13230 0d 0a 39 36 34 38 0d 0a 0d 0a 71 75 65 72 79 20  ..9648....query 
13240 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13250 54 20 41 4c 4c 20 2d 20 74 61 62 30 2e 63 6f 6c  T ALL - tab0.col
13260 30 20 2d 20 2b 20 36 32 20 46 52 4f 4d 20 74 61  0 - + 62 FROM ta
13270 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
13280 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
13290 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66 66 62   hashing to 9ffb
132a0 35 34 32 36 32 62 34 30 37 62 32 61 31 38 38 31  54262b407b2a1881
132b0 65 31 34 39 38 34 65 38 31 39 37 38 0d 0a 0d 0a  e14984e81978....
132c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
132d0 0a 53 45 4c 45 43 54 20 33 20 2a 20 30 20 46 52  .SELECT 3 * 0 FR
132e0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
132f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
13300 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
13310 20 38 62 37 35 31 33 36 62 32 62 35 31 63 37 37   8b75136b2b51c77
13320 33 34 35 63 30 33 38 30 34 65 63 31 63 64 61 35  345c03804ec1cda5
13330 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  c....query I row
13340 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
13350 54 49 4e 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  TINCT - tab2.col
13360 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  0 + col2 AS col2
13370 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
13380 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a  ..-41..-52..20..
13390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
133a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
133b0 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30  CT col2 * + col0
133c0 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   + col2 + - col1
133d0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
133e0 0d 0a 2d 36 31 0d 0a 37 32 38 39 0d 0a 37 33 39  ..-61..7289..739
133f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13400 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
13410 20 2b 20 37 32 20 41 53 20 63 6f 6c 30 20 46 52   + 72 AS col0 FR
13420 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
13430 33 36 0d 0a 31 35 32 0d 0a 37 35 0d 0a 0d 0a 71  36..152..75....q
13440 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
13450 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13460 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  T * FROM tab1, t
13470 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
13480 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62  S JOIN tab0, tab
13490 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37  1 cor1..----..97
134a0 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
134b0 20 74 6f 20 39 61 66 36 37 64 36 66 39 38 30 31   to 9af67d6f9801
134c0 30 34 36 34 61 66 35 64 35 36 30 62 66 39 34 39  0464af5d560bf949
134d0 64 34 38 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  d487....skipif p
134e0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
134f0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
13500 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
13510 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
13520 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13530 0d 0a 53 45 4c 45 43 54 20 2b 20 33 31 20 63 6f  ..SELECT + 31 co
13540 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
13550 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a  cor0..----..31..
13560 33 31 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79 20  31..31....query 
13570 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13580 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
13590 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  1 * col0 + col2 
135a0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
135b0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
135c0 0d 0a 2d 2d 2d 2d 0d 0a 33 30 30 38 0d 0a 36 36  ..----..3008..66
135d0 34 30 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20  40..84....query 
135e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
135f0 54 20 41 4c 4c 20 2b 20 2d 20 38 32 20 2a 20 2b  T ALL + - 82 * +
13600 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
13610 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
13620 2d 2d 0d 0a 2d 32 34 36 0d 0a 2d 35 32 34 38 0d  --..-246..-5248.
13630 0a 2d 36 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20  .-6560....query 
13640 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13650 54 20 63 6f 6c 31 20 2a 20 2d 20 32 34 20 2b 20  T col1 * - 24 + 
13660 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
13670 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
13680 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 30  or0..----..-1390
13690 0d 0a 2d 33 37 30 0d 0a 2d 37 31 37 0d 0a 0d 0a  ..-370..-717....
136a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
136b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
136c0 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46  r0.col1 * col2 F
136d0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
136e0 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36  ---..-1534..-646
136f0 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-837....query 
13700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13710 54 20 44 49 53 54 49 4e 43 54 20 37 39 20 2b 20  T DISTINCT 79 + 
13720 2d 20 32 31 20 46 52 4f 4d 20 74 61 62 32 20 41  - 21 FROM tab2 A
13730 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 38  S cor0..----..58
13740 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13750 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13760 49 4e 43 54 20 2d 20 2b 20 39 32 20 2b 20 2b 20  INCT - + 92 + + 
13770 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
13780 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
13790 2d 2d 2d 2d 0d 0a 2d 36 36 0d 0a 2d 37 39 0d 0a  ----..-66..-79..
137a0 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -82....onlyif my
137b0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
137c0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
137d0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
137e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
137f0 65 6c 2d 36 30 31 0d 0a 53 45 4c 45 43 54 20 2d  el-601..SELECT -
13800 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 36 32 20   cor0.col2 * 62 
13810 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  DIV col1 + col1 
13820 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
13830 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
13840 0a 2d 31 32 31 0d 0a 2d 32 33 0d 0a 33 32 0d 0a  .-121..-23..32..
13850 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
13860 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
13870 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13880 20 6c 61 62 65 6c 2d 36 30 31 0d 0a 53 45 4c 45   label-601..SELE
13890 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT - cor0.col2 *
138a0 20 36 32 20 2f 20 63 6f 6c 31 20 2b 20 63 6f 6c   62 / col1 + col
138b0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
138c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
138d0 2d 0d 0a 2d 31 32 31 0d 0a 2d 32 33 0d 0a 33 32  -..-121..-23..32
138e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
138f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13900 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  INCT + cor0.col0
13910 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + + col2 * + co
13920 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
13930 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
13940 2d 2d 0d 0a 32 39 31 39 0d 0a 33 33 31 33 0d 0a  --..2919..3313..
13950 39 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9296....query I 
13960 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13970 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 34 35 20  DISTINCT - + 45 
13980 2a 20 2b 20 32 34 20 46 52 4f 4d 20 74 61 62 32  * + 24 FROM tab2
13990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
139a0 2d 31 30 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -1080....onlyif 
139b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
139c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
139d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
139e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
139f0 61 62 65 6c 2d 36 30 34 0d 0a 53 45 4c 45 43 54  abel-604..SELECT
13a00 20 41 4c 4c 20 2b 20 2d 20 36 20 44 49 56 20 2b   ALL + - 6 DIV +
13a10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
13a20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
13a30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
13a40 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
13a50 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
13a60 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
13a70 30 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  04..SELECT ALL +
13a80 20 2d 20 36 20 2f 20 2b 20 63 6f 6c 30 20 46 52   - 6 / + col0 FR
13a90 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
13aa0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
13ab0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
13ac0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
13ad0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
13ae0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
13af0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
13b00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13b10 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
13b20 2b 20 37 39 20 63 6f 6c 32 20 46 52 4f 4d 20 74  + 79 col2 FROM t
13b30 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
13b40 2d 0d 0a 2d 32 33 37 0d 0a 2d 35 30 35 36 0d 0a  -..-237..-5056..
13b50 2d 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -6320....query I
13b60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13b70 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 35 38 20 2a   - - col2 + 58 *
13b80 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
13b90 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
13ba0 2d 2d 0d 0a 34 33 33 0d 0a 34 35 35 30 0d 0a 34  --..433..4550..4
13bb0 36 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  620....query I r
13bc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
13bd0 49 53 54 49 4e 43 54 20 2d 20 31 37 20 2a 20 63  ISTINCT - 17 * c
13be0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f  ol0 + - col0 FRO
13bf0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
13c00 2d 2d 2d 2d 0d 0a 2d 31 32 36 0d 0a 2d 31 34 30  ----..-126..-140
13c10 34 0d 0a 2d 31 34 32 32 0d 0a 0d 0a 71 75 65 72  4..-1422....quer
13c20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13c30 45 43 54 20 33 38 20 2a 20 63 6f 6c 32 20 46 52  ECT 38 * col2 FR
13c40 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
13c50 0a 2d 2d 2d 2d 0d 0a 32 30 35 32 0d 0a 32 31 36  .----..2052..216
13c60 36 0d 0a 33 36 34 38 0d 0a 0d 0a 71 75 65 72 79  6..3648....query
13c70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13c80 43 54 20 41 4c 4c 20 39 20 2a 20 2b 20 33 38 20  CT ALL 9 * + 38 
13c90 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
13ca0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34  2 cor0..----..34
13cb0 32 0d 0a 33 34 32 0d 0a 33 34 32 0d 0a 0d 0a 71  2..342..342....q
13cc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13cd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
13ce0 2d 20 63 6f 6c 30 20 2b 20 2b 20 74 61 62 32 2e  - col0 + + tab2.
13cf0 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
13d00 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36   tab2..----..126
13d10 34 0d 0a 32 31 30 0d 0a 34 35 32 34 0d 0a 0d 0a  4..210..4524....
13d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13d30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
13d40 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63  l2 + + col0 AS c
13d50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
13d60 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33  ---..104..117..3
13d70 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
13d80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39  sort..SELECT + 9
13d90 33 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  3 * col2 FROM ta
13da0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 36 39 0d 0a  b0..----..3069..
13db0 37 36 32 36 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72  7626..93....quer
13dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13dd0 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63  ECT ALL col1 + c
13de0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 * + col1 FRO
13df0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
13e00 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35 33 0d  ----..104..1053.
13e10 0a 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .650....query I 
13e20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13e30 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  col2 - - cor0.co
13e40 6c 32 20 2a 20 2b 20 36 31 20 41 53 20 63 6f 6c  l2 * + 61 AS col
13e50 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
13e60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 36 0d  or0..----..2046.
13e70 0a 35 30 38 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65  .5084..62....que
13e80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13e90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
13ea0 2d 20 36 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  - 62 * - col0 + 
13eb0 36 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  68 FROM tab0 AS 
13ec0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 36  cor0..----..1556
13ed0 0d 0a 32 32 33 38 0d 0a 35 35 38 36 0d 0a 0d 0a  ..2238..5586....
13ee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13ef0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
13f00 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2d 20  col0 * + col2 - 
13f10 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
13f20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13f30 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d 0a  -7209..-768..0..
13f40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13f50 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
13f60 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20  .col2 + col0 AS 
13f70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
13f80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a  or0..----..121..
13f90 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79  176..57....query
13fa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13fb0 43 54 20 41 4c 4c 20 39 36 20 41 53 20 63 6f 6c  CT ALL 96 AS col
13fc0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
13fd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 36 0d 0a 39  or0..----..96..9
13fe0 36 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  6..96....query I
13ff0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14000 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63   - cor0.col2 - c
14010 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
14020 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
14030 34 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75  4..-2..-66....qu
14040 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14050 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31 32 20 2b  ELECT ALL - 12 +
14060 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
14070 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
14080 0a 2d 39 0d 0a 35 32 0d 0a 36 38 0d 0a 0d 0a 6f  .-9..52..68....o
14090 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
140a0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
140b0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
140c0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
140d0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 31 0d 0a  sort label-621..
140e0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f  SELECT col0 * co
140f0 6c 31 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f  l1 + col2 DIV co
14100 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
14110 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  1 cor0..----..10
14120 34 37 0d 0a 36 34 35 0d 0a 38 30 0d 0a 0d 0a 73  47..645..80....s
14130 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
14140 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
14150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
14160 62 65 6c 2d 36 32 31 0d 0a 53 45 4c 45 43 54 20  bel-621..SELECT 
14170 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col0 * col1 + co
14180 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 46  l2 / cor0.col1 F
14190 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
141a0 2d 2d 2d 0d 0a 31 30 34 37 0d 0a 36 34 35 0d 0a  ---..1047..645..
141b0 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
141c0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
141d0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
141e0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
141f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14200 6c 2d 36 32 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-622..SELECT DI
14210 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49  STINCT - col1 DI
14220 56 20 2d 20 33 32 20 46 52 4f 4d 20 74 61 62 32  V - 32 FROM tab2
14230 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14240 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..1....skipif m
14250 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
14260 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
14270 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 32  owsort label-622
14280 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14290 54 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 33 32 20  T - col1 / - 32 
142a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
142b0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d  0..----..0..1...
142c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
142d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
142e0 54 20 2b 20 32 30 20 46 52 4f 4d 20 74 61 62 30  T + 20 FROM tab0
142f0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
14300 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  tab1 cor1..----.
14310 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .20....query I r
14320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
14330 49 53 54 49 4e 43 54 20 35 37 20 46 52 4f 4d 20  ISTINCT 57 FROM 
14340 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
14350 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
14360 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  , tab0, tab0 AS 
14370 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a  cor2..----..57..
14380 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
14390 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
143a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
143b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
143c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32  rowsort label-62
143d0 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  5..SELECT - col2
143e0 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
143f0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
14400 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b  -1..-1..-1....sk
14410 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
14420 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
14430 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
14440 65 6c 2d 36 32 35 0d 0a 53 45 4c 45 43 54 20 2d  el-625..SELECT -
14450 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 46 52 4f   col2 / col2 FRO
14460 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
14470 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
14480 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14490 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
144a0 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63   col0 * col2 + c
144b0 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol2 * col1 AS co
144c0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
144d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 37  cor0..----..-307
144e0 38 0d 0a 2d 36 34 33 32 0d 0a 31 32 34 32 0d 0a  8..-6432..1242..
144f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14500 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
14510 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 39 35  CT - + col0 + 95
14520 20 2a 20 2d 20 35 39 20 46 52 4f 4d 20 74 61 62   * - 59 FROM tab
14530 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14540 0a 2d 35 36 32 39 0d 0a 2d 35 36 34 30 0d 0a 2d  .-5629..-5640..-
14550 35 36 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5694....query I 
14560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14570 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
14580 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  * - cor0.col0 - 
14590 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  - col1 AS col0 F
145a0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
145b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 36 30  ..----..-18..-60
145c0 32 35 0d 0a 2d 36 32 32 34 0d 0a 0d 0a 71 75 65  25..-6224....que
145d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
145e0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
145f0 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 37 36 20 46  r0.col0 * + 76 F
14600 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14610 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 37 37 36 0d 0a  ..----..-43776..
14620 2d 36 30 31 39 39 36 0d 0a 2d 39 33 31 30 30 0d  -601996..-93100.
14630 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
14640 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
14650 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
14660 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
14670 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
14680 33 30 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  30..SELECT + - c
14690 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b  ol2 DIV - col0 +
146a0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   + cor0.col2 * -
146b0 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
146c0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
146d0 0a 2d 31 34 34 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-144..-3648..-7
146e0 36 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  679....skipif my
146f0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14700 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14710 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 30 0d  wsort label-630.
14720 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32  .SELECT + - col2
14730 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   / - col0 + + co
14740 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30  r0.col2 * - cor0
14750 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
14760 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34  cor0..----..-144
14770 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 37 39 0d 0a  ..-3648..-7679..
14780 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14790 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
147a0 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
147b0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
147c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
147d0 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
147e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
147f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14800 54 20 2b 20 2b 20 39 34 20 41 53 20 63 6f 6c 30  T + + 94 AS col0
14810 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
14820 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34 0d 0a 0d 0a  r0..----..94....
14830 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14840 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31  .SELECT - + col1
14850 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30   * col0 * - cor0
14860 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
14870 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30  cor0..----..1060
14880 39 37 0d 0a 31 35 31 39 0d 0a 33 35 38 39 35 36  97..1519..358956
14890 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
148a0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
148b0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
148c0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
148d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
148e0 36 33 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  634..SELECT + - 
148f0 35 30 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d  50 DIV col0 FROM
14900 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
14910 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 73  ..-1..-2..0....s
14920 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
14930 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
14940 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
14950 62 65 6c 2d 36 33 34 0d 0a 53 45 4c 45 43 54 20  bel-634..SELECT 
14960 2b 20 2d 20 35 30 20 2f 20 63 6f 6c 30 20 46 52  + - 50 / col0 FR
14970 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
14980 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d  --..-1..-2..0...
14990 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
149a0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
149b0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
149c0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
149d0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
149e0 6f 72 74 20 6c 61 62 65 6c 2d 36 33 35 0d 0a 53  ort label-635..S
149f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
14a00 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a   col0 + + col2 *
14a10 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20   + CAST( - col2 
14a20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 32  AS SIGNED ) col2
14a30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
14a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35 0d  r0..----..-1365.
14a50 0a 2d 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d 0a 73  .-598..-722....s
14a60 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
14a70 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
14a80 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
14a90 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
14aa0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
14ab0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
14ac0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
14ad0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 35  owsort label-635
14ae0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14af0 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  T + col0 + + col
14b00 32 20 2a 20 2b 20 43 41 53 54 20 28 20 2d 20 63  2 * + CAST ( - c
14b10 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
14b20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
14b30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14b40 31 33 36 35 0d 0a 2d 35 39 38 0d 0a 2d 37 32 32  1365..-598..-722
14b50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14b60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
14b70 49 4e 43 54 20 2d 20 30 20 2a 20 63 6f 6c 32 20  INCT - 0 * col2 
14b80 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
14b90 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
14ba0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14bb0 45 4c 45 43 54 20 2d 20 34 30 20 2b 20 2b 20 63  ELECT - 40 + + c
14bc0 6f 6c 31 20 2b 20 28 20 63 6f 6c 32 20 29 20 46  ol1 + ( col2 ) F
14bd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
14be0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 31 38 0d 0a  ..----..15..18..
14bf0 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  45....skipif pos
14c00 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
14c10 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
14c20 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
14c30 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
14c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14c50 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
14c60 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
14c70 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  ab0..----..-35..
14c80 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71  -7298..-792....q
14c90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14ca0 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32  SELECT tab2.col2
14cb0 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * - col2 + - co
14cc0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
14cd0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 36  tab2..----..-146
14ce0 31 0d 0a 2d 37 33 35 0d 0a 2d 37 36 30 0d 0a 0d  1..-735..-760...
14cf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14d00 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 2b  ..SELECT + - ( +
14d10 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 30   col2 ) + - col0
14d20 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31   * - col1 * col1
14d30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
14d40 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
14d50 0d 0a 31 37 37 34 37 31 0d 0a 33 32 39 33 31 34  ..177471..329314
14d60 0d 0a 37 33 36 39 32 37 0d 0a 0d 0a 71 75 65 72  ..736927....quer
14d70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14d80 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
14d90 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f   tab1.col2 AS co
14da0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
14db0 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d  --..-162..-3648.
14dc0 0a 2d 37 36 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-7680....skipif
14dd0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
14de0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
14df0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
14e00 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
14e10 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
14e20 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
14e30 4e 43 54 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20  NCT ( cor0.col2 
14e40 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  ) col2 FROM tab0
14e50 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
14e60 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
14e70 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
14e80 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
14e90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
14ea0 61 62 32 2e 63 6f 6c 31 20 2a 20 74 61 62 32 2e  ab2.col1 * tab2.
14eb0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
14ec0 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72  M tab2, tab1 cor
14ed0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
14ee0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 39 65  s hashing to 79e
14ef0 61 36 36 33 63 35 66 34 36 38 63 63 35 37 61 38  a663c5f468cc57a8
14f00 36 39 66 63 38 32 36 63 66 30 34 61 35 0d 0a 0d  69fc826cf04a5...
14f10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14f20 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
14f30 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  * - tab0.col2 * 
14f40 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
14f50 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 35 39 33 37  ..----..1..35937
14f60 0d 0a 35 35 31 33 36 38 0d 0a 0d 0a 71 75 65 72  ..551368....quer
14f70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14f80 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  ECT + ( + col0 )
14f90 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
14fa0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  b0..----..24..35
14fb0 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
14fc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14fd0 2d 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 72  - + col2 - + cor
14fe0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
14ff0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15000 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31  ..----..-108..-1
15010 31 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 71 75 65 72  14..-192....quer
15020 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72  y IIIIIIIIIIII r
15030 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
15040 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
15050 20 63 6f 72 30 2c 20 74 61 62 30 2c 20 74 61 62   cor0, tab0, tab
15060 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
15070 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
15080 69 6e 67 20 74 6f 20 30 39 62 31 32 30 61 38 66  ing to 09b120a8f
15090 66 31 33 65 62 61 66 65 61 37 61 66 31 30 63 32  f13ebafea7af10c2
150a0 31 35 32 32 34 31 62 0d 0a 0d 0a 71 75 65 72 79  152241b....query
150b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
150c0 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 28 20  CT - col1 * + ( 
150d0 74 61 62 31 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  tab1.col1 ) FROM
150e0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab1..----..-10
150f0 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d  0..-169..-676...
15100 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15110 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
15120 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53  + - tab2.col1 AS
15130 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
15140 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d 33 38  .----..-137..-38
15150 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-96....query I
15160 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15170 20 44 49 53 54 49 4e 43 54 20 33 20 46 52 4f 4d   DISTINCT 3 FROM
15180 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
15190 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 0d 0a  or0..----..3....
151a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
151b0 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 72 30  .SELECT - ( cor0
151c0 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62  .col2 ) FROM tab
151d0 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
151e0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
151f0 68 61 73 68 69 6e 67 20 74 6f 20 37 62 35 39 33  hashing to 7b593
15200 38 31 32 34 32 35 33 37 39 38 34 32 36 66 62 66  8124253798426fbf
15210 30 39 63 31 38 65 31 66 64 37 35 0d 0a 0d 0a 71  09c18e1fd75....q
15220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15230 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15240 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 30  col0 * tab0.col0
15250 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
15260 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
15270 0a 31 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36 34  .1225..19008..64
15280 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9522....query I 
15290 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
152a0 31 37 20 2a 20 2d 20 35 39 20 46 52 4f 4d 20 74  17 * - 59 FROM t
152b0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 33  ab2..----..-1003
152c0 0d 0a 2d 31 30 30 33 0d 0a 2d 31 30 30 33 0d 0a  ..-1003..-1003..
152d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
152e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
152f0 43 54 20 2b 20 39 38 20 2a 20 2d 20 63 6f 6c 31  CT + 98 * - col1
15300 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
15310 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 32 38 0d  b0..----..-8428.
15320 0a 2d 38 39 31 38 0d 0a 2d 39 35 30 36 0d 0a 0d  .-8918..-9506...
15330 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
15340 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
15350 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
15360 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
15370 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 35  owsort label-655
15380 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63  ..SELECT ALL ( c
15390 6f 6c 31 20 29 20 44 49 56 20 63 6f 6c 30 20 41  ol1 ) DIV col0 A
153a0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
153b0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d  ..----..1..2..3.
153c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
153d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
153e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
153f0 74 20 6c 61 62 65 6c 2d 36 35 35 0d 0a 53 45 4c  t label-655..SEL
15400 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29  ECT ALL ( col1 )
15410 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   / col0 AS col2 
15420 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
15430 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 6f 6e 6c 79  .1..2..3....only
15440 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15450 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15460 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15470 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15480 74 20 6c 61 62 65 6c 2d 36 35 36 0d 0a 53 45 4c  t label-656..SEL
15490 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 35 20  ECT DISTINCT 45 
154a0 44 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  DIV - col2 FROM 
154b0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab1..----..0...
154c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
154d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
154e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
154f0 6c 61 62 65 6c 2d 36 35 36 0d 0a 53 45 4c 45 43  label-656..SELEC
15500 54 20 44 49 53 54 49 4e 43 54 20 34 35 20 2f 20  T DISTINCT 45 / 
15510 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
15520 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
15530 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15540 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 30 2e  LECT ALL - tab0.
15550 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
15560 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
15570 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
15580 67 20 74 6f 20 62 35 61 34 31 30 32 31 30 37 65  g to b5a4102107e
15590 35 65 62 64 32 36 65 33 34 31 35 33 38 66 34 66  5ebd26e341538f4f
155a0 65 64 65 31 65 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ede1e....onlyif 
155b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
155c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
155d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
155e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
155f0 61 62 65 6c 2d 36 35 38 0d 0a 53 45 4c 45 43 54  abel-658..SELECT
15600 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 37 30   DISTINCT + - 70
15610 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74   DIV col0 FROM t
15620 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15630 2d 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -..-2..0....skip
15640 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
15650 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
15660 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15670 2d 36 35 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -658..SELECT DIS
15680 54 49 4e 43 54 20 2b 20 2d 20 37 30 20 2f 20 63  TINCT + - 70 / c
15690 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
156a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
156b0 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
156c0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
156d0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
156e0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
156f0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
15700 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
15710 35 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  59..SELECT ALL +
15720 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53   CAST( col1 AS S
15730 49 47 4e 45 44 20 29 20 2a 20 63 6f 72 30 2e 63  IGNED ) * cor0.c
15740 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
15750 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   cor0..----..124
15760 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
15770 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
15780 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
15790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
157a0 61 62 65 6c 2d 36 35 39 0d 0a 53 45 4c 45 43 54  abel-659..SELECT
157b0 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 63 6f   ALL + CAST ( co
157c0 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
157d0 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
157e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
157f0 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d  ---..1248..1404.
15800 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .570....query I 
15810 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15820 2d 20 37 35 20 2a 20 63 6f 6c 32 20 41 53 20 63  - 75 * col2 AS c
15830 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
15840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 37 35 0d  r0..----..-2475.
15850 0a 2d 36 31 35 30 0d 0a 2d 37 35 0d 0a 0d 0a 71  .-6150..-75....q
15860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15870 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20  SELECT col2 * + 
15880 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
15890 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37 0d 0a  ab0..----..297..
158a0 37 33 38 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66  738..9....skipif
158b0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
158c0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
158d0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
158e0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
158f0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
15900 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 30 20  rt..SELECT - 30 
15910 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
15920 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15930 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
15940 68 69 6e 67 20 74 6f 20 35 36 66 61 32 35 66 39  hing to 56fa25f9
15950 66 62 38 30 34 30 34 36 30 66 65 33 63 38 39 34  fb8040460fe3c894
15960 30 30 30 65 61 38 66 62 0d 0a 0d 0a 71 75 65 72  000ea8fb....quer
15970 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15980 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34  ECT DISTINCT + 4
15990 37 20 2a 20 36 37 20 46 52 4f 4d 20 74 61 62 31  7 * 67 FROM tab1
159a0 0d 0a 2d 2d 2d 2d 0d 0a 33 31 34 39 0d 0a 0d 0a  ..----..3149....
159b0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
159c0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
159d0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
159e0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
159f0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
15a00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15a10 20 44 49 53 54 49 4e 43 54 20 63 6f 72 31 2e 63   DISTINCT cor1.c
15a20 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
15a30 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b2 AS cor0 CROSS
15a40 20 4a 4f 49 4e 20 74 61 62 30 20 63 6f 72 31 0d   JOIN tab0 cor1.
15a50 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32  .----..1..33..82
15a60 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
15a70 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
15a80 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
15a90 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
15aa0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
15ab0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15ac0 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2b  LECT tab0.col2 +
15ad0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b   col1 * - col1 +
15ae0 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
15af0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 37  tab0..----..-727
15b00 37 0d 0a 2d 38 31 30 38 0d 0a 2d 39 33 31 31 0d  7..-8108..-9311.
15b10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
15b20 72 74 0d 0a 53 45 4c 45 43 54 20 37 34 20 2a 20  rt..SELECT 74 * 
15b30 2b 20 38 34 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  + 84 + col2 - - 
15b40 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
15b50 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 32  M tab0..----..62
15b60 31 38 0d 0a 36 32 38 32 0d 0a 36 33 38 30 0d 0a  18..6282..6380..
15b70 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
15b80 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
15b90 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
15ba0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
15bb0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
15bc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15bd0 43 54 20 2d 20 31 30 20 63 6f 6c 30 20 46 52 4f  CT - 10 col0 FRO
15be0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
15bf0 2d 0d 0a 2d 31 30 0d 0a 2d 31 30 0d 0a 2d 31 30  -..-10..-10..-10
15c00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15c10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
15c20 63 6f 6c 32 20 29 20 2b 20 38 36 20 41 53 20 63  col2 ) + 86 AS c
15c30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
15c40 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 36 38 0d 0a 38  ---..119..168..8
15c50 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  7....query IIIII
15c60 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
15c70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15c80 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61   * FROM tab1, ta
15c90 62 30 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  b0 cor0, tab2 AS
15ca0 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63   cor1, tab1 AS c
15cb0 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76  or2..----..972 v
15cc0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
15cd0 20 39 33 36 34 65 66 37 35 34 35 62 30 37 63 36   9364ef7545b07c6
15ce0 37 37 36 37 64 63 65 62 37 30 66 30 32 63 36 34  7767dceb70f02c64
15cf0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
15d00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15d10 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  TINCT + col2 * c
15d20 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 + col0 AS co
15d30 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
15d40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d  cor0..----..165.
15d50 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71  .3712..7760....q
15d60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15d70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15d80 36 34 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  64 + col0 * col2
15d90 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
15da0 0a 2d 2d 2d 2d 0d 0a 32 30 39 32 0d 0a 32 35 33  .----..2092..253
15db0 0d 0a 33 30 36 36 0d 0a 0d 0a 71 75 65 72 79 20  ..3066....query 
15dc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15dd0 54 20 38 38 20 2b 20 63 6f 6c 31 20 2d 20 63 6f  T 88 + col1 - co
15de0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
15df0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15e00 2d 2d 0d 0a 31 31 32 0d 0a 32 36 0d 0a 36 39 0d  --..112..26..69.
15e10 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
15e20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
15e30 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
15e40 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
15e50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
15e60 37 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  73..SELECT + col
15e70 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  0 + - col2 * + c
15e80 6f 6c 30 20 44 49 56 20 31 20 41 53 20 63 6f 6c  ol0 DIV 1 AS col
15e90 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
15ea0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d  or0..----..-159.
15eb0 0a 2d 33 35 38 34 0d 0a 2d 37 36 30 30 0d 0a 0d  .-3584..-7600...
15ec0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
15ed0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
15ee0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
15ef0 6c 61 62 65 6c 2d 36 37 33 0d 0a 53 45 4c 45 43  label-673..SELEC
15f00 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T + col0 + - col
15f10 32 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 31 20 41  2 * + col0 / 1 A
15f20 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
15f30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15f40 2d 31 35 39 0d 0a 2d 33 35 38 34 0d 0a 2d 37 36  -159..-3584..-76
15f50 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
15f60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
15f70 63 6f 6c 31 20 2b 20 2d 20 38 37 20 2a 20 63 6f  col1 + - 87 * co
15f80 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
15f90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 37  cor0..----..-467
15fa0 32 0d 0a 2d 34 39 34 39 0d 0a 2d 38 33 33 39 0d  2..-4949..-8339.
15fb0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
15fc0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
15fd0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
15fe0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
15ff0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16000 37 35 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  75..SELECT cor0.
16010 63 6f 6c 32 20 44 49 56 20 2d 20 31 33 20 46 52  col2 DIV - 13 FR
16020 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
16030 2d 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 2d 32 0d 0a  --..-2..-2..-2..
16040 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
16050 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
16060 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16070 20 6c 61 62 65 6c 2d 36 37 35 0d 0a 53 45 4c 45   label-675..SELE
16080 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d  CT cor0.col2 / -
16090 20 31 33 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   13 FROM tab2 co
160a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 32  r0..----..-2..-2
160b0 0d 0a 2d 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-2....query I 
160c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
160d0 2b 20 32 38 20 46 52 4f 4d 20 74 61 62 31 20 63  + 28 FROM tab1 c
160e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 32  or0..----..28..2
160f0 38 0d 0a 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  8..28....query I
16100 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16110 20 2d 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20   - + ( + col0 ) 
16120 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
16130 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16140 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a  .-24..-35..-89..
16150 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16160 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
16170 20 2d 20 37 31 20 2a 20 63 6f 6c 32 20 41 53 20   - 71 * col2 AS 
16180 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
16190 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
161a0 33 31 39 0d 0a 2d 33 36 0d 0a 2d 35 37 33 33 0d  319..-36..-5733.
161b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
161c0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
161d0 6f 6c 30 20 2a 20 2b 20 39 34 20 41 53 20 63 6f  ol0 * + 94 AS co
161e0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
161f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 32 0d  cor0..----..282.
16200 0a 36 30 31 36 0d 0a 37 35 32 30 0d 0a 0d 0a 73  .6016..7520....s
16210 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
16220 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
16230 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
16240 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
16250 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
16260 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16270 41 4c 4c 20 2d 20 28 20 63 6f 6c 30 20 29 20 63  ALL - ( col0 ) c
16280 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
16290 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  r0..----..-7..-7
162a0 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20  8..-79....query 
162b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
162c0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
162d0 63 6f 6c 32 20 2a 20 2d 20 33 35 20 2d 20 63 6f  col2 * - 35 - co
162e0 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
162f0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
16300 39 31 36 0d 0a 2d 32 30 30 35 0d 0a 2d 33 33 37  916..-2005..-337
16310 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
16320 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16330 54 49 4e 43 54 20 35 37 20 2b 20 63 6f 6c 32 20  TINCT 57 + col2 
16340 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
16350 0a 31 31 31 0d 0a 31 31 34 0d 0a 31 35 33 0d 0a  .111..114..153..
16360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16370 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
16380 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 + - col1 AS 
16390 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
163a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
163b0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
163c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
163d0 36 34 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  64 FROM tab0 cor
163e0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 34 0d 0a 36 34 0d  0..----..64..64.
163f0 0a 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .64....query I r
16400 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
16410 49 53 54 49 4e 43 54 20 2d 20 31 33 20 2b 20 2d  ISTINCT - 13 + -
16420 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
16430 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
16440 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32  cor0..----..-102
16450 0d 0a 2d 33 37 0d 0a 2d 34 38 0d 0a 0d 0a 71 75  ..-37..-48....qu
16460 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16470 45 4c 45 43 54 20 2b 20 37 33 20 2b 20 63 6f 6c  ELECT + 73 + col
16480 30 20 2a 20 33 36 20 46 52 4f 4d 20 74 61 62 32  0 * 36 FROM tab2
16490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 38   cor0..----..288
164a0 31 0d 0a 32 39 31 37 0d 0a 33 32 35 0d 0a 0d 0a  1..2917..325....
164b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
164c0 0a 53 45 4c 45 43 54 20 2d 20 37 37 20 2a 20 2d  .SELECT - 77 * -
164d0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
164e0 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
164f0 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
16500 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
16510 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
16520 38 34 63 36 37 62 66 63 66 36 66 66 63 31 61 61  84c67bfcf6ffc1aa
16530 36 33 32 39 62 39 32 61 38 39 35 36 30 30 32 33  6329b92a89560023
16540 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16550 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
16560 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
16570 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
16580 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16590 36 38 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  688..SELECT DIST
165a0 49 4e 43 54 20 63 6f 6c 30 20 2a 20 28 20 2d 20  INCT col0 * ( - 
165b0 74 61 62 32 2e 63 6f 6c 30 20 29 20 44 49 56 20  tab2.col0 ) DIV 
165c0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
165d0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
165e0 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69  7..78..79....ski
165f0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
16600 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
16610 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16620 6c 2d 36 38 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-688..SELECT DI
16630 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 28 20  STINCT col0 * ( 
16640 2d 20 74 61 62 32 2e 63 6f 6c 30 20 29 20 2f 20  - tab2.col0 ) / 
16650 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
16660 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
16670 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65  7..78..79....que
16680 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16690 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
166a0 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l1 * col1 + + co
166b0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
166c0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
166d0 2d 2d 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39  --..327..3507..9
166e0 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
166f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
16700 53 54 49 4e 43 54 20 2b 20 37 37 20 46 52 4f 4d  STINCT + 77 FROM
16710 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
16720 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 0d  or0..----..77...
16730 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
16740 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
16750 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
16760 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
16770 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 31  owsort label-691
16780 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49  ..SELECT col2 DI
16790 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V - col0 FROM ta
167a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
167b0 0d 0a 2d 31 0d 0a 2d 31 38 0d 0a 30 0d 0a 0d 0a  ..-1..-18..0....
167c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
167d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
167e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
167f0 61 62 65 6c 2d 36 39 31 0d 0a 53 45 4c 45 43 54  abel-691..SELECT
16800 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 46   col2 / - col0 F
16810 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
16820 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 38 0d  ..----..-1..-18.
16830 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
16840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
16850 63 6f 6c 32 20 2b 20 2d 20 36 31 20 46 52 4f 4d  col2 + - 61 FROM
16860 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16870 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33 34 0d 0a 2d  ---..-23..-34..-
16880 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
16890 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
168a0 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e  STINCT - + cor0.
168b0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63  col1 * col1 AS c
168c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
168d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
168e0 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d  0..-169..-676...
168f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16900 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
16910 63 6f 6c 30 20 2b 20 2d 20 36 39 20 2a 20 63 6f  col0 + - 69 * co
16920 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l2 * - col1 FROM
16930 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16940 2d 2d 2d 0d 0a 31 30 35 39 32 34 0d 0a 34 34 36  ---..105924..446
16950 35 33 0d 0a 35 37 37 36 30 0d 0a 0d 0a 71 75 65  53..57760....que
16960 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16970 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
16980 35 33 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  53 FROM tab1 cor
16990 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 38 0d 0a 35  0..----..1378..5
169a0 33 30 0d 0a 36 38 39 0d 0a 0d 0a 71 75 65 72 79  30..689....query
169b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
169c0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
169d0 62 32 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30  b2.col0 + + cor0
169e0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
169f0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
16a00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
16a10 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
16a20 20 30 38 32 65 36 36 30 66 64 62 34 33 62 34 35   082e660fdb43b45
16a30 35 39 65 65 34 63 37 38 66 31 39 37 37 32 33 61  59ee4c78f197723a
16a40 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
16a50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
16a60 20 63 6f 6c 32 20 2b 20 2b 20 31 33 20 2a 20 74   col2 + + 13 * t
16a70 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab2.col1 FROM ta
16a80 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 35 39 0d 0a 34  b2..----..259..4
16a90 33 30 0d 0a 37 39 33 0d 0a 0d 0a 71 75 65 72 79  30..793....query
16aa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16ab0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
16ac0 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  - col2 * + col0 
16ad0 2b 20 37 35 20 46 52 4f 4d 20 74 61 62 32 0d 0a  + 75 FROM tab2..
16ae0 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 35  ----..-1248..-15
16af0 38 31 30 39 0d 0a 2d 32 33 37 30 38 33 0d 0a 0d  8109..-237083...
16b00 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
16b10 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
16b20 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
16b30 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
16b40 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
16b50 6f 72 74 20 6c 61 62 65 6c 2d 36 39 39 0d 0a 53  ort label-699..S
16b60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
16b70 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
16b80 20 53 49 47 4e 45 44 20 29 20 2a 20 33 35 20 46   SIGNED ) * 35 F
16b90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
16ba0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
16bb0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
16bc0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
16bd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16be0 61 62 65 6c 2d 36 39 39 0d 0a 53 45 4c 45 43 54  abel-699..SELECT
16bf0 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 43 41   DISTINCT - + CA
16c00 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
16c10 45 47 45 52 20 29 20 2a 20 33 35 20 46 52 4f 4d  EGER ) * 35 FROM
16c20 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16c30 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
16c40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16c50 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
16c60 32 20 2a 20 35 33 20 2a 20 2d 20 63 6f 6c 32 20  2 * 53 * - col2 
16c70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
16c80 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 35 34 38 0d  0..----..154548.
16c90 0a 31 37 32 31 39 37 0d 0a 34 38 38 34 34 38 0d  .172197..488448.
16ca0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16cb0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
16cc0 20 38 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   84 AS col0 FROM
16cd0 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30   tab1, tab1 cor0
16ce0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
16cf0 20 68 61 73 68 69 6e 67 20 74 6f 20 63 61 64 64   hashing to cadd
16d00 38 37 36 63 32 36 33 33 38 66 63 35 38 62 39 32  876c26338fc58b92
16d10 39 37 65 37 34 66 63 33 32 34 64 38 0d 0a 0d 0a  97e74fc324d8....
16d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16d30 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16d40 20 31 35 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63   15 + col0 - + c
16d50 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
16d60 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
16d70 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 37 0d 0a 0d 0a  ..-9..34..77....
16d80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
16d90 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
16da0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
16db0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
16dc0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
16dd0 72 74 20 6c 61 62 65 6c 2d 37 30 33 0d 0a 53 45  rt label-703..SE
16de0 4c 45 43 54 20 2b 20 43 41 53 54 28 20 35 32 20  LECT + CAST( 52 
16df0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
16e00 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
16e10 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
16e20 31 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20  1 cor1, tab1 AS 
16e30 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
16e40 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
16e50 20 37 62 34 61 36 36 34 65 39 63 36 32 62 34 36   7b4a664e9c62b46
16e60 62 35 31 37 35 36 39 35 38 37 64 35 61 36 32 31  b517569587d5a621
16e70 64 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  d....skipif mysq
16e80 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
16e90 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
16ea0 6f 72 74 20 6c 61 62 65 6c 2d 37 30 33 0d 0a 53  ort label-703..S
16eb0 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 35  ELECT + CAST ( 5
16ec0 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  2 AS INTEGER ) A
16ed0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
16ee0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
16ef0 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62 31 20  tab1 cor1, tab1 
16f00 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
16f10 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
16f20 20 74 6f 20 37 62 34 61 36 36 34 65 39 63 36 32   to 7b4a664e9c62
16f30 62 34 36 62 35 31 37 35 36 39 35 38 37 64 35 61  b46b517569587d5a
16f40 36 32 31 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  621d....onlyif m
16f50 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
16f60 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
16f70 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
16f80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16f90 62 65 6c 2d 37 30 34 0d 0a 53 45 4c 45 43 54 20  bel-704..SELECT 
16fa0 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29  ALL - ( + col2 )
16fb0 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 32 20 46   DIV col0 col2 F
16fc0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
16fd0 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-3..0..0...
16fe0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
16ff0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
17000 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
17010 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
17020 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
17030 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
17040 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
17050 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
17060 30 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  04..SELECT ALL -
17070 20 28 20 2b 20 63 6f 6c 32 20 29 20 2f 20 63 6f   ( + col2 ) / co
17080 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
17090 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  2 cor0..----..-3
170a0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
170b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
170c0 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  T + + col1 * - c
170d0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
170e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
170f0 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36  ---..-1534..-646
17100 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-837....query 
17110 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17120 54 20 41 4c 4c 20 38 34 20 41 53 20 63 6f 6c 30  T ALL 84 AS col0
17130 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
17140 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17150 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
17160 20 74 6f 20 63 61 64 64 38 37 36 63 32 36 33 33   to cadd876c2633
17170 38 66 63 35 38 62 39 32 39 37 65 37 34 66 63 33  8fc58b9297e74fc3
17180 32 34 64 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  24d8....query I 
17190 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
171a0 2d 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  - + col0 - + col
171b0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
171c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
171d0 2d 0d 0a 2d 31 34 0d 0a 2d 31 35 36 0d 0a 2d 31  -..-14..-156..-1
171e0 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
171f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17200 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  L - cor0.col2 + 
17210 63 6f 6c 30 20 2a 20 2b 20 28 20 2b 20 63 6f 6c  col0 * + ( + col
17220 32 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  2 ) * + cor0.col
17230 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  2 + - col2 * - c
17240 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
17250 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 32  r0..----..131..2
17260 38 39 34 31 0d 0a 36 30 35 38 31 36 0d 0a 0d 0a  8941..605816....
17270 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17280 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
17290 20 2d 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20   - + ( + col2 ) 
172a0 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
172b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
172c0 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
172d0 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  16....onlyif mys
172e0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
172f0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
17300 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
17310 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
17320 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
17330 31 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  10..SELECT ALL -
17340 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d   col1 * col2 + -
17350 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41 53   CAST( - col2 AS
17360 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
17370 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
17380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32  or0..----..-1152
17390 0d 0a 2d 31 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d  ..-1350..-513...
173a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
173b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
173c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
173d0 6c 61 62 65 6c 2d 37 31 30 0d 0a 53 45 4c 45 43  label-710..SELEC
173e0 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63  T ALL - col1 * c
173f0 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 2d  ol2 + - CAST ( -
17400 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
17410 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
17420 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
17430 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d 31 33 35 30  --..-1152..-1350
17440 0d 0a 2d 35 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-513....onlyif
17450 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
17460 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
17470 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
17480 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17490 6c 61 62 65 6c 2d 37 31 31 0d 0a 53 45 4c 45 43  label-711..SELEC
174a0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38 32 20  T DISTINCT + 82 
174b0 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  DIV col0 FROM ta
174c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
174d0 0d 0a 31 0d 0a 31 31 0d 0a 0d 0a 73 6b 69 70 69  ..1..11....skipi
174e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
174f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
17500 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
17510 37 31 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  711..SELECT DIST
17520 49 4e 43 54 20 2b 20 38 32 20 2f 20 63 6f 6c 30  INCT + 82 / col0
17530 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
17540 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 31 0d  r0..----..1..11.
17550 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17560 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
17570 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  1 * - col2 FROM 
17580 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
17590 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
175a0 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
175b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
175c0 4c 4c 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f  LL + ( - cor0.co
175d0 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  l1 ) * col1 + + 
175e0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
175f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
17600 2d 2d 2d 2d 0d 0a 2d 32 37 32 0d 0a 2d 33 34 32  ----..-272..-342
17610 32 0d 0a 2d 39 33 30 0d 0a 0d 0a 6f 6e 6c 79 69  2..-930....onlyi
17620 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
17630 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
17640 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
17650 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17660 20 6c 61 62 65 6c 2d 37 31 34 0d 0a 53 45 4c 45   label-714..SELE
17670 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  CT + col2 + - co
17680 6c 30 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20  l0 + - ( + col1 
17690 29 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  ) DIV col1 FROM 
176a0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
176b0 0a 2d 33 35 0d 0a 2d 38 0d 0a 38 0d 0a 0d 0a 73  .-35..-8..8....s
176c0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
176d0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
176e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
176f0 62 65 6c 2d 37 31 34 0d 0a 53 45 4c 45 43 54 20  bel-714..SELECT 
17700 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  + col2 + - col0 
17710 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2f  + - ( + col1 ) /
17720 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
17730 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d  cor0..----..-35.
17740 0a 2d 38 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20  .-8..8....query 
17750 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17760 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
17770 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  2 * cor0.col0 FR
17780 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
17790 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d  --..-189..-2028.
177a0 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .-3002....query 
177b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
177c0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
177d0 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 * col2 FROM 
177e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
177f0 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33  --..189..2028..3
17800 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
17810 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17820 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
17830 20 2d 20 63 6f 6c 30 20 2a 20 36 33 20 2b 20 2b   - col0 * 63 + +
17840 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
17850 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
17860 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
17870 0d 0a 2d 36 32 38 32 0d 0a 2d 36 33 31 0d 0a 2d  ..-6282..-631..-
17880 39 34 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9490....query I 
17890 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
178a0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
178b0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col1 + col1 * + 
178c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
178d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
178e0 39 32 34 0d 0a 31 39 34 0d 0a 35 36 37 36 0d 0a  924..194..5676..
178f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
17900 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
17910 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
17920 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
17930 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 31  rowsort label-71
17940 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
17950 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  CT - - col2 + co
17960 6c 31 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d  l1 DIV col1 FROM
17970 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
17980 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33 39 0d  ---..27..28..39.
17990 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
179a0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
179b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
179c0 74 20 6c 61 62 65 6c 2d 37 31 39 0d 0a 53 45 4c  t label-719..SEL
179d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
179e0 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 63   col2 + col1 / c
179f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
17a00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d   cor0..----..27.
17a10 0a 32 38 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72 79  .28..39....query
17a20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17a30 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  CT - - cor0.col0
17a40 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 39 34   * + col0 + - 94
17a50 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   * cor0.col1 AS 
17a60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
17a70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
17a80 33 33 0d 0a 2d 37 35 30 38 0d 0a 2d 37 38 39 33  33..-7508..-7893
17a90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17aa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
17ab0 2d 20 28 20 35 30 20 29 20 2b 20 2b 20 63 6f 6c  - ( 50 ) + + col
17ac0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
17ad0 2d 0d 0a 2d 31 37 0d 0a 2d 34 39 0d 0a 33 32 0d  -..-17..-49..32.
17ae0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17af0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 34 20  rt..SELECT - 54 
17b00 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
17b10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
17b20 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
17b30 74 6f 20 34 65 63 64 62 30 66 31 62 38 35 66 30  to 4ecdb0f1b85f0
17b40 64 34 66 64 63 33 61 38 32 36 65 66 64 39 66 32  d4fdc3a826efd9f2
17b50 33 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  342....query I r
17b60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
17b70 4c 4c 20 2b 20 35 31 20 2b 20 2d 20 63 6f 6c 30  LL + 51 + - col0
17b80 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
17b90 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 0d  ab1..----..-111.
17ba0 0a 2d 33 35 39 37 0d 0a 2d 37 36 32 39 0d 0a 0d  .-3597..-7629...
17bb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17bc0 0d 0a 53 45 4c 45 43 54 20 31 33 20 2b 20 2d 20  ..SELECT 13 + - 
17bd0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
17be0 2d 2d 2d 2d 0d 0a 2d 37 33 0d 0a 2d 37 38 0d 0a  ----..-73..-78..
17bf0 2d 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -84....query I r
17c00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
17c10 4c 4c 20 2b 20 31 39 20 2a 20 2d 20 63 6f 6c 32  LL + 19 * - col2
17c20 20 2b 20 34 39 20 41 53 20 63 6f 6c 31 20 46 52   + 49 AS col1 FR
17c30 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
17c40 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 39 0d 0a 2d 35  .----..-1509..-5
17c50 37 38 0d 0a 33 30 0d 0a 0d 0a 73 6b 69 70 69 66  78..30....skipif
17c60 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
17c70 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
17c80 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
17c90 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
17ca0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
17cb0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
17cc0 4e 43 54 20 2b 20 33 33 20 63 6f 6c 30 20 46 52  NCT + 33 col0 FR
17cd0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab0..----..3
17ce0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
17cf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
17d00 20 28 20 63 6f 6c 30 20 29 20 29 20 41 53 20 63   ( col0 ) ) AS c
17d10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
17d20 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
17d30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17d40 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d  t..SELECT col2 -
17d50 20 2d 20 34 31 20 41 53 20 63 6f 6c 32 20 46 52   - 41 AS col2 FR
17d60 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36  OM tab2..----..6
17d70 37 0d 0a 36 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65  7..68..79....que
17d80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17d90 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 72  LECT ALL - ( cor
17da0 30 2e 63 6f 6c 32 20 29 20 2a 20 39 32 20 46 52  0.col2 ) * 92 FR
17db0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
17dc0 0a 2d 2d 2d 2d 0d 0a 2d 32 33 39 32 0d 0a 2d 32  .----..-2392..-2
17dd0 34 38 34 0d 0a 2d 33 34 39 36 0d 0a 0d 0a 73 6b  484..-3496....sk
17de0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
17df0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
17e00 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
17e10 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
17e20 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
17e30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17e40 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
17e50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
17e60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17e70 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a  24..-35..-89....
17e80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17e90 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
17ea0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 28   cor0.col0 * - (
17eb0 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   + col2 ) FROM t
17ec0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
17ed0 2d 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33 35 0d 0a  -..-26136..-35..
17ee0 2d 35 39 38 34 33 36 0d 0a 0d 0a 73 6b 69 70 69  -598436....skipi
17ef0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
17f00 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
17f10 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
17f20 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
17f30 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
17f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
17f50 49 4e 43 54 20 37 37 20 2a 20 63 6f 6c 30 20 2b  INCT 77 * col0 +
17f60 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
17f70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d  tab1..----..234.
17f80 0a 34 39 39 32 0d 0a 36 32 34 30 0d 0a 0d 0a 71  .4992..6240....q
17f90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17fa0 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31  SELECT cor0.col1
17fb0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
17fc0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
17fd0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38  0..----..137..38
17fe0 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
17ff0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18000 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  - col2 + + col2 
18010 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18020 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
18030 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
18040 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18050 45 43 54 20 2b 20 39 32 20 2a 20 2d 20 63 6f 6c  ECT + 92 * - col
18060 30 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 41 53  0 * tab0.col0 AS
18070 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
18080 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 37 30 30 0d 0a  .----..-112700..
18090 2d 35 32 39 39 32 0d 0a 2d 37 32 38 37 33 32 0d  -52992..-728732.
180a0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
180b0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
180c0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
180d0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
180e0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
180f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18100 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
18110 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 63 6f  0.col1 * col2 co
18120 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
18130 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
18140 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
18150 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18160 53 54 49 4e 43 54 20 2d 20 33 33 20 41 53 20 63  STINCT - 33 AS c
18170 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
18180 2d 2d 2d 0d 0a 2d 33 33 0d 0a 0d 0a 6f 6e 6c 79  ---..-33....only
18190 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
181a0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
181b0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
181c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
181d0 74 20 6c 61 62 65 6c 2d 37 33 38 0d 0a 53 45 4c  t label-738..SEL
181e0 45 43 54 20 2d 20 2b 20 28 20 63 6f 6c 32 20 29  ECT - + ( col2 )
181f0 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c 31 20 46   DIV col1 col1 F
18200 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
18210 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
18220 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
18230 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
18240 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
18250 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
18260 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
18270 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
18280 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
18290 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
182a0 2d 37 33 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -738..SELECT - +
182b0 20 28 20 63 6f 6c 32 20 29 20 2f 20 63 6f 6c 31   ( col2 ) / col1
182c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
182d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
182e0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
182f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18300 54 20 41 4c 4c 20 2b 20 35 39 20 2a 20 2d 20 63  T ALL + 59 * - c
18310 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
18320 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18330 2d 2d 2d 0d 0a 2d 31 34 31 36 0d 0a 2d 32 30 36  ---..-1416..-206
18340 35 0d 0a 2d 35 32 35 31 0d 0a 0d 0a 73 6b 69 70  5..-5251....skip
18350 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
18360 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
18370 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18380 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20  CT ALL - CAST ( 
18390 2d 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29  - col2 AS REAL )
183a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
183b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
183c0 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71  ..1..33..82....q
183d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
183e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
183f0 2b 20 35 33 20 46 52 4f 4d 20 74 61 62 31 20 63  + 53 FROM tab1 c
18400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 0d  or0..----..53...
18410 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18420 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
18430 54 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63  T ( + col1 ) * c
18440 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ol2 + col2 * + c
18450 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30  or0.col2 AS col0
18460 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
18470 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 36 0d 0a  r0..----..1566..
18480 32 30 39 30 0d 0a 32 32 31 30 0d 0a 0d 0a 6f 6e  2090..2210....on
18490 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
184a0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
184b0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
184c0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
184d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
184e0 20 6c 61 62 65 6c 2d 37 34 33 0d 0a 53 45 4c 45   label-743..SELE
184f0 43 54 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53  CT CAST( col1 AS
18500 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
18510 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
18520 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33  or0..----..17..3
18530 31 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..59....skipif 
18540 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
18550 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
18560 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34  rowsort label-74
18570 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  3..SELECT CAST (
18580 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
18590 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
185a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
185b0 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a  --..17..31..59..
185c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
185d0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
185e0 20 31 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   15 AS col1 FROM
185f0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d   tab2..----..22.
18600 0a 39 33 0d 0a 39 34 0d 0a 0d 0a 6f 6e 6c 79 69  .93..94....onlyi
18610 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
18620 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
18630 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
18640 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18650 20 6c 61 62 65 6c 2d 37 34 35 0d 0a 53 45 4c 45   label-745..SELE
18660 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
18670 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53  l0 DIV - col1 AS
18680 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
18690 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d 0a  .----..0..1..4..
186a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
186b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
186c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
186d0 20 6c 61 62 65 6c 2d 37 34 35 0d 0a 53 45 4c 45   label-745..SELE
186e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
186f0 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63  l0 / - col1 AS c
18700 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
18710 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a  ---..0..1..4....
18720 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
18730 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
18740 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
18750 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
18760 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
18770 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18780 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
18790 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 63   * - tab0.col0 c
187a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
187b0 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37  ---..35..7298..7
187c0 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  92....onlyif mys
187d0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
187e0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
187f0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
18800 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18810 6c 2d 37 34 37 0d 0a 53 45 4c 45 43 54 20 63 6f  l-747..SELECT co
18820 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 44  l2 * tab1.col1 D
18830 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 34 34  IV + col2 + + 44
18840 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63   * tab1.col2 * c
18850 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20  ol1 + tab1.col2 
18860 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
18870 0a 32 35 31 34 37 0d 0a 35 35 30 32 31 0d 0a 36  .25147..55021..6
18880 31 38 35 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1856....skipif m
18890 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
188a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
188b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 37  owsort label-747
188c0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
188d0 74 61 62 31 2e 63 6f 6c 31 20 2f 20 2b 20 63 6f  tab1.col1 / + co
188e0 6c 32 20 2b 20 2b 20 34 34 20 2a 20 74 61 62 31  l2 + + 44 * tab1
188f0 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 74  .col2 * col1 + t
18900 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab1.col2 FROM ta
18910 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 35 31 34 37 0d  b1..----..25147.
18920 0a 35 35 30 32 31 0d 0a 36 31 38 35 36 0d 0a 0d  .55021..61856...
18930 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18940 0d 0a 53 45 4c 45 43 54 20 2d 20 33 36 20 41 53  ..SELECT - 36 AS
18950 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
18960 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
18970 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 0d 0a 2d  OSS JOIN tab2..-
18980 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
18990 61 73 68 69 6e 67 20 74 6f 20 33 62 63 64 30 37  ashing to 3bcd07
189a0 64 32 32 62 36 32 64 32 30 34 32 62 34 39 39 32  d22b62d2042b4992
189b0 35 33 62 31 63 31 33 64 39 65 0d 0a 0d 0a 71 75  53b1c13d9e....qu
189c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
189d0 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 74 61  ELECT ALL ( + ta
189e0 62 32 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c  b2.col0 ) AS col
189f0 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
18a00 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 2c  1 AS cor0, tab1,
18a10 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
18a20 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
18a30 61 73 68 69 6e 67 20 74 6f 20 30 35 38 33 35 66  ashing to 05835f
18a40 32 39 64 64 39 63 64 34 66 61 31 36 38 38 39 64  29dd9cd4fa16889d
18a50 65 35 34 64 65 63 33 63 62 36 0d 0a 0d 0a 71 75  e54dec3cb6....qu
18a60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18a70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
18a80 20 33 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53   36 FROM tab2 AS
18a90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d   cor0..----..36.
18aa0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18ab0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
18ac0 2a 20 2b 20 31 34 20 2a 20 63 6f 6c 31 20 46 52  * + 14 * col1 FR
18ad0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
18ae0 0a 2d 2d 2d 2d 0d 0a 31 30 34 34 36 38 0d 0a 31  .----..104468..1
18af0 33 35 38 0d 0a 33 39 37 33 32 0d 0a 0d 0a 6f 6e  358..39732....on
18b00 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
18b10 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
18b20 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
18b30 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
18b40 6f 72 74 20 6c 61 62 65 6c 2d 37 35 32 0d 0a 53  ort label-752..S
18b50 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b  ELECT - col1 * +
18b60 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 63   cor0.col1 DIV c
18b70 6f 6c 31 20 2d 20 33 31 20 41 53 20 63 6f 6c 32  ol1 - 31 AS col2
18b80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18b90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d  r0..----..-41..-
18ba0 34 34 0d 0a 2d 35 37 0d 0a 0d 0a 73 6b 69 70 69  44..-57....skipi
18bb0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
18bc0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
18bd0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18be0 37 35 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  752..SELECT - co
18bf0 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l1 * + cor0.col1
18c00 20 2f 20 63 6f 6c 31 20 2d 20 33 31 20 41 53 20   / col1 - 31 AS 
18c10 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
18c20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
18c30 31 0d 0a 2d 34 34 0d 0a 2d 35 37 0d 0a 0d 0a 71  1..-44..-57....q
18c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18c50 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
18c60 32 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  2 + col2 * col0 
18c70 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18c80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
18c90 0a 33 34 0d 0a 37 32 31 36 0d 0a 37 35 39 0d 0a  .34..7216..759..
18ca0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18cb0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
18cc0 20 2b 20 35 31 20 2a 20 2d 20 63 6f 6c 31 20 46   + 51 * - col1 F
18cd0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
18ce0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 39 0d 0a 2d  ..----..-1329..-
18cf0 35 37 34 0d 0a 2d 37 34 33 0d 0a 0d 0a 71 75 65  574..-743....que
18d00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18d10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
18d20 35 33 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  53 + col1 AS col
18d30 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
18d40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33  or0..----..33..3
18d50 38 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  8..44....query I
18d60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18d70 20 41 4c 4c 20 37 32 20 2a 20 2d 20 63 6f 6c 31   ALL 72 * - col1
18d80 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
18d90 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
18da0 0d 0a 2d 31 38 37 32 0d 0a 2d 37 32 30 0d 0a 2d  ..-1872..-720..-
18db0 39 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  936....query I r
18dc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
18dd0 20 2d 20 36 20 2a 20 2b 20 28 20 2d 20 63 6f 6c   - 6 * + ( - col
18de0 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  1 ) FROM tab0 co
18df0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 36 0d 0a  r0..----..-516..
18e00 2d 35 34 36 0d 0a 2d 35 38 32 0d 0a 0d 0a 71 75  -546..-582....qu
18e10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18e20 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
18e30 20 2a 20 39 31 20 46 52 4f 4d 20 74 61 62 30 20   * 91 FROM tab0 
18e40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
18e50 38 32 36 0d 0a 38 32 38 31 0d 0a 38 38 32 37 0d  826..8281..8827.
18e60 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
18e70 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
18e80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18e90 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
18ea0 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41   CAST ( - col2 A
18eb0 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 30  S REAL ) AS col0
18ec0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
18ed0 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37  ..-35..-7298..-7
18ee0 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  92....onlyif mys
18ef0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
18f00 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
18f10 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
18f20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
18f30 6c 2d 37 36 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-760..SELECT - 
18f40 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31  cor0.col0 * col1
18f50 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20   + + col2 DIV - 
18f60 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
18f70 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
18f80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 37  or0..----..-1047
18f90 0d 0a 2d 36 34 35 0d 0a 2d 38 30 0d 0a 0d 0a 73  ..-645..-80....s
18fa0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
18fb0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
18fc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
18fd0 62 65 6c 2d 37 36 30 0d 0a 53 45 4c 45 43 54 20  bel-760..SELECT 
18fe0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  - cor0.col0 * co
18ff0 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d 20  l1 + + col2 / - 
19000 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
19010 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
19020 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 37  or0..----..-1047
19030 0d 0a 2d 36 34 35 0d 0a 2d 38 30 0d 0a 0d 0a 71  ..-645..-80....q
19040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19050 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
19060 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  - col0 * - col0 
19070 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
19080 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
19090 0a 31 38 0d 0a 36 30 32 35 0d 0a 36 32 32 34 0d  .18..6025..6224.
190a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
190b0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
190c0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20  * cor0.col0 - - 
190d0 33 38 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  38 FROM tab1 AS 
190e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 33 34  cor0..----..4134
190f0 0d 0a 34 37 0d 0a 36 34 33 38 0d 0a 0d 0a 71 75  ..47..6438....qu
19100 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19110 45 4c 45 43 54 20 2d 20 36 20 2b 20 2b 20 63 6f  ELECT - 6 + + co
19120 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
19130 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a  cor0..----..20..
19140 32 31 0d 0a 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  21..32....onlyif
19150 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
19160 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
19170 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
19180 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
19190 6c 61 62 65 6c 2d 37 36 34 0d 0a 53 45 4c 45 43  label-764..SELEC
191a0 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 31 34 20  T + col1 DIV 14 
191b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
191c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
191d0 0a 31 0d 0a 32 0d 0a 34 0d 0a 0d 0a 73 6b 69 70  .1..2..4....skip
191e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
191f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
19200 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19210 2d 37 36 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -764..SELECT + c
19220 6f 6c 31 20 2f 20 31 34 20 41 53 20 63 6f 6c 30  ol1 / 14 AS col0
19230 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
19240 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a  r0..----..1..2..
19250 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
19260 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
19270 20 34 37 20 2a 20 2b 20 33 39 20 41 53 20 63 6f   47 * + 39 AS co
19280 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
19290 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33 33  cor0..----..1833
192a0 0d 0a 31 38 33 33 0d 0a 31 38 33 33 0d 0a 0d 0a  ..1833..1833....
192b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
192c0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
192d0 20 33 35 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f   35 * + col1 FRO
192e0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
192f0 2d 0d 0a 33 30 39 36 0d 0a 33 32 37 36 0d 0a 33  -..3096..3276..3
19300 34 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  492....onlyif my
19310 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
19320 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
19330 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
19340 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
19350 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
19360 37 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  767..SELECT + CA
19370 53 54 28 20 2d 20 39 38 20 41 53 20 53 49 47 4e  ST( - 98 AS SIGN
19380 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ED ) AS col0 FRO
19390 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
193a0 2d 0d 0a 2d 39 38 0d 0a 2d 39 38 0d 0a 2d 39 38  -..-98..-98..-98
193b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
193c0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
193d0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
193e0 72 74 20 6c 61 62 65 6c 2d 37 36 37 0d 0a 53 45  rt label-767..SE
193f0 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20  LECT + CAST ( - 
19400 39 38 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  98 AS INTEGER ) 
19410 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19420 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  2 cor0..----..-9
19430 38 0d 0a 2d 39 38 0d 0a 2d 39 38 0d 0a 0d 0a 6f  8..-98..-98....o
19440 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
19450 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
19460 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
19470 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
19480 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19490 74 20 6c 61 62 65 6c 2d 37 36 38 0d 0a 53 45 4c  t label-768..SEL
194a0 45 43 54 20 43 41 53 54 28 20 2b 20 63 6f 6c 31  ECT CAST( + col1
194b0 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
194c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
194d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
194e0 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70  ..31..59....skip
194f0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
19500 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
19510 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19520 2d 37 36 38 0d 0a 53 45 4c 45 43 54 20 43 41 53  -768..SELECT CAS
19530 54 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e  T ( + col1 AS IN
19540 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
19550 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19560 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d  0..----..17..31.
19570 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .59....query I r
19580 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
19590 4c 4c 20 2d 20 2d 20 28 20 31 34 20 29 20 2b 20  LL - - ( 14 ) + 
195a0 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col2 * col2 FROM
195b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
195c0 2d 2d 2d 0d 0a 32 39 33 30 0d 0a 33 32 36 33 0d  ---..2930..3263.
195d0 0a 39 32 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .9230....query I
195e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
195f0 20 2d 20 32 32 20 2a 20 63 6f 6c 32 20 2b 20 2d   - 22 * col2 + -
19600 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
19610 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
19620 0a 2d 2d 2d 2d 0d 0a 2d 36 30 31 0d 0a 2d 36 35  .----..-601..-65
19630 30 0d 0a 2d 39 31 35 0d 0a 0d 0a 6f 6e 6c 79 69  0..-915....onlyi
19640 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
19650 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
19660 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
19670 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
19680 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
19690 62 65 6c 2d 37 37 31 0d 0a 53 45 4c 45 43 54 20  bel-771..SELECT 
196a0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
196b0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
196c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
196d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
196e0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
196f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
19700 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
19710 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
19720 6f 72 74 20 6c 61 62 65 6c 2d 37 37 31 0d 0a 53  ort label-771..S
19730 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e  ELECT - CAST ( N
19740 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
19750 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
19760 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
19770 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
19780 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
19790 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
197a0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
197b0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
197c0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
197d0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
197e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
197f0 4c 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 63  L + ( - col2 ) c
19800 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
19810 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
19820 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c  .-33..-82....onl
19830 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
19840 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
19850 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
19860 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
19870 72 74 20 6c 61 62 65 6c 2d 37 37 33 0d 0a 53 45  rt label-773..SE
19880 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
19890 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20  + col1 DIV col0 
198a0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
198b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
198c0 0a 2d 34 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-4..0....skipif
198d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
198e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
198f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
19900 37 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  73..SELECT DISTI
19910 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 63  NCT - + col1 / c
19920 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
19930 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
19940 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a 71 75  ---..-4..0....qu
19950 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19960 45 4c 45 43 54 20 2b 20 2b 20 34 20 2b 20 2b 20  ELECT + + 4 + + 
19970 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
19980 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  S cor0..----..30
19990 0d 0a 33 31 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72  ..31..42....quer
199a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
199b0 45 43 54 20 41 4c 4c 20 2b 20 2b 20 34 35 20 2a  ECT ALL + + 45 *
199c0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
199d0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
199e0 2d 2d 0d 0a 32 34 33 30 0d 0a 32 35 36 35 0d 0a  --..2430..2565..
199f0 34 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4320....query I 
19a00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19a10 2b 20 31 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 10 AS col0 FRO
19a20 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab2..----..10
19a30 0d 0a 31 30 0d 0a 31 30 0d 0a 0d 0a 71 75 65 72  ..10..10....quer
19a40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19a50 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36  ECT DISTINCT - 6
19a60 35 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  5 + - tab0.col0 
19a70 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
19a80 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
19a90 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 35  .----..-100..-15
19aa0 34 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20  4..-89....query 
19ab0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19ac0 54 20 2b 20 35 39 20 2b 20 2b 20 63 6f 6c 30 20  T + 59 + + col0 
19ad0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19ae0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19af0 0a 31 32 33 0d 0a 31 33 39 0d 0a 36 32 0d 0a 0d  .123..139..62...
19b00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19b10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
19b20 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41   col0 * + col1 A
19b30 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
19b40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19b50 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
19b60 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
19b70 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
19b80 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
19b90 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
19ba0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
19bb0 37 38 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  780..SELECT - co
19bc0 6c 31 20 44 49 56 20 2d 20 38 35 20 63 6f 6c 30  l1 DIV - 85 col0
19bd0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
19be0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  r0..----..1..1..
19bf0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
19c00 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
19c10 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
19c20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
19c30 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
19c40 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19c50 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19c60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19c70 65 6c 2d 37 38 30 0d 0a 53 45 4c 45 43 54 20 2d  el-780..SELECT -
19c80 20 63 6f 6c 31 20 2f 20 2d 20 38 35 20 63 6f 6c   col1 / - 85 col
19c90 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
19ca0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  or0..----..1..1.
19cb0 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .1....query I ro
19cc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
19cd0 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53  L col2 * col0 AS
19ce0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
19cf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d  cor0..----..162.
19d00 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 73  .3648..7680....s
19d10 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
19d20 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
19d30 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
19d40 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
19d50 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
19d60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19d70 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
19d80 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  l2 * + col1 col1
19d90 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
19da0 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30  .----..1248..140
19db0 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20  4..570....query 
19dc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19dd0 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 63  T ALL + col0 * c
19de0 6f 6c 32 20 2b 20 2d 20 39 36 20 2d 20 2d 20 63  ol2 + - 96 - - c
19df0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
19e00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
19e10 0d 0a 31 32 30 0d 0a 33 36 30 39 0d 0a 37 36 38  ..120..3609..768
19e20 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
19e30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
19e40 6f 6c 32 20 2b 20 28 20 2d 20 36 39 20 29 20 46  ol2 + ( - 69 ) F
19e50 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
19e60 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 0d 0a 2d 31  ..----..-123..-1
19e70 32 36 0d 0a 2d 31 36 35 0d 0a 0d 0a 71 75 65 72  26..-165....quer
19e80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19e90 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
19ea0 32 20 2b 20 2b 20 31 37 20 41 53 20 63 6f 6c 30  2 + + 17 AS col0
19eb0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
19ec0 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 35 30 0d 0a 39  .----..18..50..9
19ed0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
19ee0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
19ef0 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 31 35 20 2d   + col0 + - 15 -
19f00 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f   col1 * col1 FRO
19f10 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
19f20 2d 2d 2d 2d 0d 0a 2d 37 33 38 37 0d 0a 2d 38 32  ----..-7387..-82
19f30 30 37 0d 0a 2d 39 33 38 39 0d 0a 0d 0a 71 75 65  07..-9389....que
19f40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19f50 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
19f60 2b 20 2d 20 35 34 20 2a 20 2b 20 63 6f 72 30 2e  + - 54 * + cor0.
19f70 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
19f80 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
19f90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34   cor0..----..-34
19fa0 35 30 33 0d 0a 2d 34 31 35 38 0d 0a 2d 35 36 30  503..-4158..-560
19fb0 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
19fc0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
19fd0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
19fe0 37 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  77 FROM tab1 AS 
19ff0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d  cor0..----..103.
1a000 0a 38 37 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79  .87..90....query
1a010 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a020 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 74 61  CT ALL col1 - ta
1a030 62 31 2e 63 6f 6c 31 20 2a 20 39 32 20 46 52 4f  b1.col1 * 92 FRO
1a040 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
1a050 31 38 33 0d 0a 2d 32 33 36 36 0d 0a 2d 39 31 30  183..-2366..-910
1a060 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a070 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1a080 49 4e 43 54 20 2b 20 2b 20 34 32 20 2b 20 2b 20  INCT + + 42 + + 
1a090 28 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ( - col2 ) FROM 
1a0a0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1a0b0 0a 2d 31 32 0d 0a 2d 31 35 0d 0a 2d 35 34 0d 0a  .-12..-15..-54..
1a0c0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1a0d0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1a0e0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1a0f0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1a100 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1a110 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a120 43 54 20 2b 20 28 20 63 6f 6c 30 20 29 20 63 6f  CT + ( col0 ) co
1a130 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1a140 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor0..----..7..7
1a150 38 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  8..79....skipif 
1a160 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1a170 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1a180 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1a190 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1a1a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a1b0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
1a1c0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c   * cor0.col2 col
1a1d0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1a1e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  or0..----..2838.
1a1f0 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .7462..97....que
1a200 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a210 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1a220 74 61 62 32 2e 63 6f 6c 32 20 2d 20 2d 20 63 6f  tab2.col2 - - co
1a230 6c 32 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 31 20  l2 * + ( - col1 
1a240 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
1a250 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38  ab2..----..-1508
1a260 0d 0a 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a  ..-608..-810....
1a270 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a280 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1a290 20 38 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20   82 * col0 FROM 
1a2a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1a2b0 2d 2d 0d 0a 31 39 36 38 0d 0a 32 38 37 30 0d 0a  --..1968..2870..
1a2c0 37 32 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7298....query I 
1a2d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a2e0 41 4c 4c 20 2b 20 34 30 20 46 52 4f 4d 20 74 61  ALL + 40 FROM ta
1a2f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1a300 0d 0a 34 30 0d 0a 34 30 0d 0a 34 30 0d 0a 0d 0a  ..40..40..40....
1a310 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1a320 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1a330 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1a340 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1a350 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 36 0d  wsort label-796.
1a360 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30  .SELECT ( + col0
1a370 20 29 20 44 49 56 20 43 41 53 54 28 20 63 6f 72   ) DIV CAST( cor
1a380 30 2e 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  0.col0 AS SIGNED
1a390 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
1a3a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1a3b0 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
1a3c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1a3d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1a3e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1a3f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1a400 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
1a410 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1a420 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1a430 6f 72 74 20 6c 61 62 65 6c 2d 37 39 36 0d 0a 53  ort label-796..S
1a440 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30 20 29  ELECT ( + col0 )
1a450 20 2f 20 43 41 53 54 20 28 20 63 6f 72 30 2e 63   / CAST ( cor0.c
1a460 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
1a470 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1a480 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1a490 0d 0a 31 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..1..1....onlyif
1a4a0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1a4b0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1a4c0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1a4d0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1a4e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a4f0 65 6c 2d 37 39 37 0d 0a 53 45 4c 45 43 54 20 2b  el-797..SELECT +
1a500 20 37 34 20 2a 20 2d 20 63 6f 6c 30 20 2f 20 43   74 * - col0 / C
1a510 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
1a520 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30  IMAL ) FROM tab0
1a530 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1a540 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1a550 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1a560 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1a570 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a580 6c 61 62 65 6c 2d 37 39 37 0d 0a 53 45 4c 45 43  label-797..SELEC
1a590 54 20 2b 20 37 34 20 2a 20 2d 20 63 6f 6c 30 20  T + 74 * - col0 
1a5a0 2f 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  / CAST ( NULL AS
1a5b0 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62   REAL ) FROM tab
1a5c0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  0 cor0..----..NU
1a5d0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1a5e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a5f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
1a600 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r1.col2 AS col2 
1a610 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
1a620 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
1a630 49 4e 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  IN tab0, tab1 AS
1a640 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20   cor1..----..81 
1a650 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1a660 6f 20 39 64 33 35 35 66 31 66 32 65 64 63 33 34  o 9d355f1f2edc34
1a670 37 61 33 35 39 64 61 64 30 30 64 32 64 33 66 38  7a359dad00d2d3f8
1a680 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  86....query I ro
1a690 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1a6a0 4c 20 2b 20 38 37 20 2a 20 63 6f 6c 30 20 46 52  L + 87 * col0 FR
1a6b0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
1a6c0 30 38 38 0d 0a 33 30 34 35 0d 0a 37 37 34 33 0d  088..3045..7743.
1a6d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a6e0 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 72  rt..SELECT ( cor
1a6f0 30 2e 63 6f 6c 31 20 29 20 2b 20 28 20 63 6f 6c  0.col1 ) + ( col
1a700 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  1 ) FROM tab1 co
1a710 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36  r0..----..20..26
1a720 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..52....query I 
1a730 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a740 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  + col0 * cor0.co
1a750 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1a760 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1a770 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36 32  --..49..6084..62
1a780 34 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  41....onlyif mys
1a790 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1a7a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1a7b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1a7c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1a7d0 6c 2d 38 30 32 0d 0a 53 45 4c 45 43 54 20 2b 20  l-802..SELECT + 
1a7e0 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
1a7f0 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 46 52  col2 DIV col2 FR
1a800 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1a810 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d  --..2..62..62...
1a820 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1a830 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1a840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a850 6c 61 62 65 6c 2d 38 30 32 0d 0a 53 45 4c 45 43  label-802..SELEC
1a860 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  T + - col0 + col
1a870 31 20 2a 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20  1 * col2 / col2 
1a880 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1a890 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d  ----..2..62..62.
1a8a0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1a8b0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1a8c0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1a8d0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1a8e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1a8f0 30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  03..SELECT ALL +
1a900 20 2d 20 38 31 20 2b 20 35 33 20 44 49 56 20 63   - 81 + 53 DIV c
1a910 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1a920 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1a930 2d 2d 2d 0d 0a 2d 38 31 0d 0a 2d 38 31 0d 0a 2d  ---..-81..-81..-
1a940 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  81....skipif mys
1a950 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1a960 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1a970 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 33 0d 0a  sort label-803..
1a980 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 38  SELECT ALL + - 8
1a990 31 20 2b 20 35 33 20 2f 20 63 6f 6c 32 20 41 53  1 + 53 / col2 AS
1a9a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1a9b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1a9c0 38 31 0d 0a 2d 38 31 0d 0a 2d 38 31 0d 0a 0d 0a  81..-81..-81....
1a9d0 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
1a9e0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
1a9f0 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
1aa00 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
1aa10 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74  OSS JOIN tab2, t
1aa20 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab1 AS cor1, tab
1aa30 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d  1, tab0 AS cor2.
1aa40 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75  .----..3645 valu
1aa50 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 62  es hashing to 3b
1aa60 34 35 38 37 61 62 36 63 30 38 64 32 31 37 39 63  4587ab6c08d2179c
1aa70 36 64 66 30 39 34 64 32 66 37 36 61 64 37 0d 0a  6df094d2f76ad7..
1aa80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1aa90 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 33  t..SELECT ALL 23
1aaa0 20 2d 20 2b 20 31 34 20 41 53 20 63 6f 6c 30 20   - + 14 AS col0 
1aab0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
1aac0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1aad0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1aae0 74 6f 20 30 33 62 39 33 62 35 33 31 30 37 65 33  to 03b93b53107e3
1aaf0 36 63 66 37 64 35 32 34 65 34 38 63 35 30 39 62  6cf7d524e48c509b
1ab00 31 37 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  17b....onlyif my
1ab10 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1ab20 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1ab30 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1ab40 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1ab50 65 6c 2d 38 30 36 0d 0a 53 45 4c 45 43 54 20 2b  el-806..SELECT +
1ab60 20 39 33 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c   93 + col2 * col
1ab70 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20  1 DIV - col1 AS 
1ab80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1ab90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
1aba0 0d 0a 33 36 0d 0a 33 39 0d 0a 0d 0a 73 6b 69 70  ..36..39....skip
1abb0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1abc0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1abd0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1abe0 2d 38 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20 39  -806..SELECT + 9
1abf0 33 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  3 + col2 * col1 
1ac00 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  / - col1 AS col1
1ac10 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1ac20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 33 36  r0..----..-3..36
1ac30 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..39....query I 
1ac40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ac50 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
1ac60 2a 20 31 36 20 46 52 4f 4d 20 74 61 62 30 0d 0a  * 16 FROM tab0..
1ac70 2d 2d 2d 2d 0d 0a 2d 31 32 36 37 33 36 0d 0a 2d  ----..-126736..-
1ac80 31 39 36 30 30 0d 0a 2d 39 32 31 36 0d 0a 0d 0a  19600..-9216....
1ac90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1aca0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1acb0 20 63 6f 6c 32 20 2b 20 2d 20 39 30 20 2a 20 2d   col2 + - 90 * -
1acc0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b   col2 * + col2 +
1acd0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20   col1 * col0 AS 
1ace0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1acf0 2d 2d 2d 2d 0d 0a 31 30 30 31 30 37 0d 0a 33 34  ----..100107..34
1ad00 38 36 0d 0a 36 31 33 33 34 31 0d 0a 0d 0a 71 75  86..613341....qu
1ad10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ad20 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61 62 30  ELECT ALL - tab0
1ad30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2b  .col1 * col2 + +
1ad40 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41   col0 * + col1 A
1ad50 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1ad60 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 37 34 0d 0a 33 32  ..----..-774..32
1ad70 39 38 0d 0a 36 33 37 0d 0a 0d 0a 6f 6e 6c 79 69  98..637....onlyi
1ad80 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1ad90 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1ada0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1adb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1adc0 20 6c 61 62 65 6c 2d 38 31 30 0d 0a 53 45 4c 45   label-810..SELE
1add0 43 54 20 34 35 20 44 49 56 20 74 61 62 32 2e 63  CT 45 DIV tab2.c
1ade0 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 35  ol0 + col0 * + 5
1adf0 31 20 2a 20 2b 20 32 38 20 63 6f 6c 32 20 46 52  1 * + 28 col2 FR
1ae00 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
1ae10 30 30 30 32 0d 0a 31 31 31 33 38 34 0d 0a 31 31  0002..111384..11
1ae20 32 38 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  2812....skipif p
1ae30 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1ae40 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1ae50 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1ae60 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1ae70 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1ae80 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1ae90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1aea0 6c 61 62 65 6c 2d 38 31 30 0d 0a 53 45 4c 45 43  label-810..SELEC
1aeb0 54 20 34 35 20 2f 20 74 61 62 32 2e 63 6f 6c 30  T 45 / tab2.col0
1aec0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 35 31 20 2a   + col0 * + 51 *
1aed0 20 2b 20 32 38 20 63 6f 6c 32 20 46 52 4f 4d 20   + 28 col2 FROM 
1aee0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 30  tab2..----..1000
1aef0 32 0d 0a 31 31 31 33 38 34 0d 0a 31 31 32 38 31  2..111384..11281
1af00 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1af10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36  sort..SELECT + 6
1af20 31 20 2b 20 28 20 63 6f 6c 30 20 2b 20 39 30 20  1 + ( col0 + 90 
1af30 29 20 2a 20 37 30 20 2a 20 2d 20 63 6f 6c 31 20  ) * 70 * - col1 
1af40 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1af50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 31 36  0..----..-114016
1af60 39 0d 0a 2d 36 38 36 32 31 39 0d 0a 2d 38 34 38  9..-686219..-848
1af70 36 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  689....query I r
1af80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1af90 4c 4c 20 31 34 20 41 53 20 63 6f 6c 30 20 46 52  LL 14 AS col0 FR
1afa0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
1afb0 34 0d 0a 31 34 0d 0a 31 34 0d 0a 0d 0a 71 75 65  4..14..14....que
1afc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1afd0 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2b  LECT tab0.col2 +
1afe0 20 2d 20 39 33 20 2a 20 63 6f 6c 30 20 41 53 20   - 93 * col0 AS 
1aff0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
1b000 2d 2d 2d 2d 0d 0a 2d 32 31 39 39 0d 0a 2d 33 32  ----..-2199..-32
1b010 35 34 0d 0a 2d 38 31 39 35 0d 0a 0d 0a 71 75 65  54..-8195....que
1b020 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b030 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1b040 36 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  60 + + col0 + co
1b050 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
1b060 2d 2d 0d 0a 2d 33 0d 0a 31 31 36 0d 0a 36 31 0d  --..-3..116..61.
1b070 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b080 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b090 4e 43 54 20 2d 20 38 38 20 2a 20 2d 20 32 33 20  NCT - 88 * - 23 
1b0a0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1b0b0 0a 32 30 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .2024....query I
1b0c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b0d0 20 41 4c 4c 20 2d 20 2d 20 34 30 20 46 52 4f 4d   ALL - - 40 FROM
1b0e0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1b0f0 0d 0a 34 30 0d 0a 34 30 0d 0a 34 30 0d 0a 0d 0a  ..40..40..40....
1b100 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b110 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
1b120 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col0 + + cor0.co
1b130 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
1b140 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1b150 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d  --..171..36..57.
1b160 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1b170 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1b180 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1b190 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1b1a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1b1b0 31 38 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 34  18..SELECT ( - 4
1b1c0 33 20 29 20 44 49 56 20 2b 20 63 6f 6c 31 20 41  3 ) DIV + col1 A
1b1d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1b1e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b1f0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
1b200 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1b210 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1b220 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1b230 38 31 38 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20  818..SELECT ( - 
1b240 34 33 20 29 20 2f 20 2b 20 63 6f 6c 31 20 41 53  43 ) / + col1 AS
1b250 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1b260 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1b270 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
1b280 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b290 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 39 31 20  T - - col1 * 91 
1b2a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1b2b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 37 0d 0a 32  0..----..1547..2
1b2c0 38 32 31 0d 0a 35 33 36 39 0d 0a 0d 0a 71 75 65  821..5369....que
1b2d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b2e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1b2f0 63 6f 6c 30 20 2a 20 2d 20 31 37 20 46 52 4f 4d  col0 * - 17 FROM
1b300 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1b310 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 33 32 36  ---..-119..-1326
1b320 0d 0a 2d 31 33 34 33 0d 0a 0d 0a 71 75 65 72 79  ..-1343....query
1b330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b340 43 54 20 41 4c 4c 20 2d 20 2d 20 39 39 20 2b 20  CT ALL - - 99 + 
1b350 37 36 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  76 * + col2 AS c
1b360 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1b370 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35   cor0..----..175
1b380 0d 0a 32 36 30 37 0d 0a 36 33 33 31 0d 0a 0d 0a  ..2607..6331....
1b390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b3a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31  .SELECT ALL tab1
1b3b0 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41  .col0 * - col2 A
1b3c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1b3d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33  ..----..-162..-3
1b3e0 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75  648..-7680....qu
1b3f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b400 45 4c 45 43 54 20 28 20 2b 20 74 61 62 32 2e 63  ELECT ( + tab2.c
1b410 6f 6c 30 20 2a 20 37 38 20 29 20 2b 20 2b 20 63  ol0 * 78 ) + + c
1b420 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1b430 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 37 33   tab2..----..573
1b440 0d 0a 36 31 31 30 0d 0a 36 32 30 30 0d 0a 0d 0a  ..6110..6200....
1b450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b460 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
1b470 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 35   col2 + col2 + 5
1b480 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1b490 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d  ab2..----..-110.
1b4a0 0a 2d 31 39 35 30 0d 0a 2d 32 39 31 32 0d 0a 0d  .-1950..-2912...
1b4b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b4c0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
1b4d0 2a 20 2d 20 63 6f 6c 31 20 2b 20 28 20 2d 20 33  * - col1 + ( - 3
1b4e0 38 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  8 ) AS col0 FROM
1b4f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1b500 2d 2d 2d 0d 0a 31 34 39 36 0d 0a 36 30 38 0d 0a  ---..1496..608..
1b510 37 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  799....query I r
1b520 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1b530 20 63 6f 6c 30 20 2b 20 28 20 2b 20 34 34 20 2a   col0 + ( + 44 *
1b540 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41   - cor0.col1 ) A
1b550 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1b560 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b570 2d 31 31 34 31 0d 0a 2d 33 37 36 0d 0a 2d 34 39  -1141..-376..-49
1b580 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1b590 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1b5a0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 37  TINCT + col1 + 7
1b5b0 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  6 FROM tab2 AS c
1b5c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a  or0..----..107..
1b5d0 31 33 35 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69  135..93....onlyi
1b5e0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1b5f0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1b600 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1b610 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1b620 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1b630 62 65 6c 2d 38 32 38 0d 0a 53 45 4c 45 43 54 20  bel-828..SELECT 
1b640 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
1b650 2a 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41  * CAST( + col1 A
1b660 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
1b670 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1b680 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39  cor0..----..-289
1b690 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d  ..-3481..-961...
1b6a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1b6b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1b6c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1b6d0 6c 61 62 65 6c 2d 38 32 38 0d 0a 53 45 4c 45 43  label-828..SELEC
1b6e0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
1b6f0 31 20 2a 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  1 * CAST ( + col
1b700 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  1 AS INTEGER ) A
1b710 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1b720 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b730 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36  -289..-3481..-96
1b740 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
1b750 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1b760 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1b770 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1b780 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b790 2d 38 32 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -829..SELECT ALL
1b7a0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   + col0 * - col1
1b7b0 20 44 49 56 20 2b 20 63 6f 6c 31 20 63 6f 6c 30   DIV + col1 col0
1b7c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1b7d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37  r0..----..-7..-7
1b7e0 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66  8..-79....skipif
1b7f0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1b800 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1b810 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1b820 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1b830 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
1b840 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1b850 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b860 74 20 6c 61 62 65 6c 2d 38 32 39 0d 0a 53 45 4c  t label-829..SEL
1b870 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
1b880 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31   - col1 / + col1
1b890 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1b8a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1b8b0 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 6f  7..-78..-79....o
1b8c0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1b8d0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1b8e0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1b8f0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1b900 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b910 74 20 6c 61 62 65 6c 2d 38 33 30 0d 0a 53 45 4c  t label-830..SEL
1b920 45 43 54 20 63 6f 6c 30 20 2b 20 43 41 53 54 28  ECT col0 + CAST(
1b930 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45   + col1 AS SIGNE
1b940 44 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 63  D ) * + col0 - c
1b950 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1b960 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   cor0..----..140
1b970 35 0d 0a 31 39 33 0d 0a 34 36 32 31 0d 0a 0d 0a  5..193..4621....
1b980 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1b990 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1b9a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b9b0 61 62 65 6c 2d 38 33 30 0d 0a 53 45 4c 45 43 54  abel-830..SELECT
1b9c0 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 2b   col0 + CAST ( +
1b9d0 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
1b9e0 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 63 6f   ) * + col0 - co
1b9f0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1ba00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 35  cor0..----..1405
1ba10 0d 0a 31 39 33 0d 0a 34 36 32 31 0d 0a 0d 0a 71  ..193..4621....q
1ba20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ba30 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
1ba40 31 20 2b 20 2d 20 28 20 2b 20 37 39 20 29 20 2a  1 + - ( + 79 ) *
1ba50 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46   col2 * - col0 F
1ba60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1ba70 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 32 34 0d 0a 32  ..----..12824..2
1ba80 38 38 32 30 32 0d 0a 36 30 36 37 33 33 0d 0a 0d  88202..606733...
1ba90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1baa0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1bab0 54 20 2b 20 63 6f 6c 31 20 2b 20 38 39 20 41 53  T + col1 + 89 AS
1bac0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1bad0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1bae0 30 32 0d 0a 31 31 35 0d 0a 39 39 0d 0a 0d 0a 71  02..115..99....q
1baf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1bb00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1bb10 39 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  95 AS col0 FROM 
1bb20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 39 35 0d 0a  tab2..----..95..
1bb30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bb40 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
1bb50 6c 32 20 2d 20 2b 20 35 31 20 41 53 20 63 6f 6c  l2 - + 51 AS col
1bb60 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
1bb70 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 34 35 0d 0a 36  ..----..3..45..6
1bb80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bb90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1bba0 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  INCT + - col1 * 
1bbb0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
1bbc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d  or0..----..-289.
1bbd0 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a  .-3481..-961....
1bbe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bbf0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
1bc00 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b   * cor0.col0 + +
1bc10 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
1bc20 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1bc30 2d 2d 2d 2d 0d 0a 32 31 36 35 0d 0a 32 32 37 0d  ----..2165..227.
1bc40 0a 33 30 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .3098....query I
1bc50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bc60 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20   ALL - col1 * + 
1bc70 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
1bc80 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1bc90 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
1bca0 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  .-8099....query 
1bcb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bcc0 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63  T ALL - - cor0.c
1bcd0 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 72  ol1 * col0 + cor
1bce0 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  0.col2 * + col1 
1bcf0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1bd00 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1bd10 0a 31 30 35 34 0d 0a 31 39 38 39 0d 0a 36 31 33  .1054..1989..613
1bd20 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
1bd30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1bd40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1bd50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1bd60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1bd70 2d 38 33 39 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -839..SELECT - -
1bd80 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32   col1 DIV + col2
1bd90 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   + - col1 + col0
1bda0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1bdb0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
1bdc0 31 0d 0a 2d 36 30 0d 0a 33 35 0d 0a 0d 0a 73 6b  1..-60..35....sk
1bdd0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1bde0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1bdf0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1be00 65 6c 2d 38 33 39 0d 0a 53 45 4c 45 43 54 20 2d  el-839..SELECT -
1be10 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32   - col1 / + col2
1be20 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   + - col1 + col0
1be30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1be40 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
1be50 31 0d 0a 2d 36 30 0d 0a 33 35 0d 0a 0d 0a 71 75  1..-60..35....qu
1be60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1be70 45 4c 45 43 54 20 2d 20 37 31 20 46 52 4f 4d 20  ELECT - 71 FROM 
1be80 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
1be90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
1bea0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 37  es hashing to e7
1beb0 32 66 39 35 63 33 34 36 37 31 34 64 33 30 36 35  2f95c346714d3065
1bec0 61 39 36 64 36 37 61 36 66 64 35 30 36 32 0d 0a  a96d67a6fd5062..
1bed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bee0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1bef0 63 6f 6c 30 20 2b 20 37 36 20 46 52 4f 4d 20 74  col0 + 76 FROM t
1bf00 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 0d 0a  ab2..----..154..
1bf10 31 35 35 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79  155..83....query
1bf20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1bf30 43 54 20 38 38 20 41 53 20 63 6f 6c 32 20 46 52  CT 88 AS col2 FR
1bf40 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
1bf50 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
1bf60 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
1bf70 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1bf80 63 34 36 65 37 63 66 39 62 66 35 31 36 66 64 66  c46e7cf9bf516fdf
1bf90 64 65 38 38 35 33 34 33 33 36 61 32 38 31 37 37  de88534336a28177
1bfa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bfb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1bfc0 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  INCT - cor0.col0
1bfd0 20 2a 20 37 38 20 41 53 20 63 6f 6c 31 20 46 52   * 78 AS col1 FR
1bfe0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1bff0 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d 0a 2d 34 39  .----..-234..-49
1c000 39 32 0d 0a 2d 36 32 34 30 0d 0a 0d 0a 71 75 65  92..-6240....que
1c010 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c020 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
1c030 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  - ( col2 ) * col
1c040 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1c050 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1c060 2d 0d 0a 2d 31 33 36 35 0d 0a 2d 35 39 38 0d 0a  -..-1365..-598..
1c070 2d 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -722....query I 
1c080 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c090 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  ALL - col1 + - c
1c0a0 6f 6c 31 20 2a 20 2b 20 28 20 74 61 62 31 2e 63  ol1 * + ( tab1.c
1c0b0 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  ol2 ) FROM tab1.
1c0c0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 31  .----..-1261..-1
1c0d0 34 33 30 0d 0a 2d 35 38 30 0d 0a 0d 0a 71 75 65  430..-580....que
1c0e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c0f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1c100 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 41 53  col2 - + col0 AS
1c110 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1c120 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1c130 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a 0d  171..-36..-57...
1c140 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1c150 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1c160 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1c170 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1c180 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 37  owsort label-847
1c190 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1c1a0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56  ol1 + - col1 DIV
1c1b0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
1c1c0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1c1d0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 34 0d  .----..-11..-14.
1c1e0 0a 2d 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-27....skipif m
1c1f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1c200 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1c210 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 37  owsort label-847
1c220 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1c230 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 63  ol1 + - col1 / c
1c240 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1c250 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1c260 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 34 0d 0a 2d  ---..-11..-14..-
1c270 32 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  27....onlyif mys
1c280 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1c290 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1c2a0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1c2b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c2c0 6c 2d 38 34 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-848..SELECT DI
1c2d0 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20  STINCT - + col1 
1c2e0 44 49 56 20 63 6f 6c 31 20 2d 20 39 35 20 46 52  DIV col1 - 95 FR
1c2f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1c300 0a 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b  .----..-96....sk
1c310 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1c320 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1c330 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1c340 65 6c 2d 38 34 38 0d 0a 53 45 4c 45 43 54 20 44  el-848..SELECT D
1c350 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31  ISTINCT - + col1
1c360 20 2f 20 63 6f 6c 31 20 2d 20 39 35 20 46 52 4f   / col1 - 95 FRO
1c370 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c380 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  ----..-96....que
1c390 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c3a0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
1c3b0 2a 20 63 6f 6c 30 20 2b 20 35 32 20 2b 20 2d 20  * col0 + 52 + - 
1c3c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
1c3d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 32 31 0d  or0..----..2021.
1c3e0 0a 32 31 30 0d 0a 33 30 33 37 0d 0a 0d 0a 71 75  .210..3037....qu
1c3f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1c400 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
1c410 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
1c420 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  OM tab2, tab2 AS
1c430 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
1c440 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
1c450 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1c460 34 30 66 64 38 63 63 30 64 65 39 32 65 61 36 38  40fd8cc0de92ea68
1c470 64 37 33 36 33 34 63 32 64 38 66 37 35 62 66 35  d73634c2d8f75bf5
1c480 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c490 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1c4a0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  INCT - col0 * - 
1c4b0 63 6f 6c 31 20 2d 20 35 34 20 2a 20 2b 20 63 6f  col1 - 54 * + co
1c4c0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1c4d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 33  cor0..----..-243
1c4e0 38 0d 0a 2d 32 38 33 38 0d 0a 2d 34 31 34 34 0d  8..-2838..-4144.
1c4f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c500 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63  rt..SELECT ( - c
1c510 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41  ol2 ) + - col0 A
1c520 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1c530 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
1c540 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a  1..-176..-57....
1c550 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c560 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 2d 20  .SELECT + - ( - 
1c570 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46  col2 ) AS col2 F
1c580 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1c590 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a  ..----..54..57..
1c5a0 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
1c5b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 37  wsort..SELECT 37
1c5c0 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20   + + ( - col0 ) 
1c5d0 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
1c5e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1c5f0 0d 0a 2d 31 31 38 38 0d 0a 2d 35 33 39 0d 0a 2d  ..-1188..-539..-
1c600 37 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7884....query I 
1c610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c620 44 49 53 54 49 4e 43 54 20 32 38 20 2b 20 2b 20  DISTINCT 28 + + 
1c630 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
1c640 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1c650 2d 0d 0a 34 35 0d 0a 35 39 0d 0a 38 37 0d 0a 0d  -..45..59..87...
1c660 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1c670 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1c680 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1c690 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1c6a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 36  owsort label-856
1c6b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1c6c0 6f 6c 32 20 2d 20 2b 20 31 35 20 44 49 56 20 2d  ol2 - + 15 DIV -
1c6d0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
1c6e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1c6f0 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 33 33 0d 0a 38  .----..16..33..8
1c700 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
1c710 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1c720 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1c730 6f 72 74 20 6c 61 62 65 6c 2d 38 35 36 0d 0a 53  ort label-856..S
1c740 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
1c750 20 2d 20 2b 20 31 35 20 2f 20 2d 20 63 6f 6c 32   - + 15 / - col2
1c760 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1c770 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1c780 0d 0a 31 36 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a  ..16..33..82....
1c790 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c7a0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
1c7b0 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f   col0 - col0 FRO
1c7c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1c7d0 2d 2d 2d 2d 0d 0a 31 32 36 34 0d 0a 32 31 30 0d  ----..1264..210.
1c7e0 0a 34 35 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .4524....query I
1c7f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c800 20 2d 20 37 34 20 2a 20 2b 20 39 30 20 46 52 4f   - 74 * + 90 FRO
1c810 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1c820 2d 2d 2d 2d 0d 0a 2d 36 36 36 30 0d 0a 2d 36 36  ----..-6660..-66
1c830 36 30 0d 0a 2d 36 36 36 30 0d 0a 0d 0a 71 75 65  60..-6660....que
1c840 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c850 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1c860 2b 20 38 34 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  + 84 + - col2 * 
1c870 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1c880 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
1c890 38 33 32 0d 0a 2d 33 31 36 35 0d 0a 2d 39 31 33  832..-3165..-913
1c8a0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1c8b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1c8c0 20 2b 20 38 31 20 41 53 20 63 6f 6c 32 20 46 52   + 81 AS col2 FR
1c8d0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
1c8e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1c8f0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1c900 20 37 61 38 65 61 33 30 63 36 38 30 33 61 65 64   7a8ea30c6803aed
1c910 64 63 35 66 63 61 35 62 35 38 32 31 64 38 32 36  dc5fca5b5821d826
1c920 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1c930 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 30 20  sort..SELECT 10 
1c940 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
1c950 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1c960 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1c970 74 6f 20 61 34 37 31 39 34 34 32 39 66 33 65 30  to a47194429f3e0
1c980 33 35 38 61 33 61 65 62 66 66 64 35 66 30 35 30  358a3aebffd5f050
1c990 31 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  113....query I r
1c9a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1c9b0 4c 4c 20 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63  LL col0 + tab2.c
1c9c0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1c9d0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   tab2..----..104
1c9e0 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65  ..117..34....que
1c9f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ca00 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  LECT + col2 + - 
1ca10 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col1 * + col1 FR
1ca20 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
1ca30 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36 32 32 0d 0a 2d  --..-43..-622..-
1ca40 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
1ca50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1ca60 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
1ca70 28 20 2b 20 28 20 74 61 62 30 2e 63 6f 6c 32 20  ( + ( tab0.col2 
1ca80 29 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ) ) AS col1 FROM
1ca90 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   tab0..----..-53
1caa0 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  ..-9..-96....que
1cab0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1cac0 4c 45 43 54 20 2d 20 2b 20 28 20 2d 20 35 31 20  LECT - + ( - 51 
1cad0 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
1cae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 35  or0..----..51..5
1caf0 31 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  1..51....query I
1cb00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1cb10 20 63 6f 6c 31 20 2b 20 31 20 41 53 20 63 6f 6c   col1 + 1 AS col
1cb20 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1cb30 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d  -..11..14..27...
1cb40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cb50 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
1cb60 20 28 20 63 6f 6c 31 20 29 20 2a 20 2b 20 35 33   ( col1 ) * + 53
1cb70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1cb80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 35 38 0d 0a  r0..----..4558..
1cb90 34 38 32 33 0d 0a 35 31 34 31 0d 0a 0d 0a 71 75  4823..5141....qu
1cba0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cbb0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
1cbc0 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2d  .col1 * - col0 -
1cbd0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
1cbe0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1cbf0 2d 2d 0d 0a 2d 32 30 39 37 0d 0a 2d 33 33 39 36  --..-2097..-3396
1cc00 0d 0a 2d 38 31 38 31 0d 0a 0d 0a 71 75 65 72 79  ..-8181....query
1cc10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cc20 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
1cc30 37 36 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  76 * + col0 AS c
1cc40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1cc50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   cor0..----..-22
1cc60 38 0d 0a 2d 34 38 36 34 0d 0a 2d 36 30 38 30 0d  8..-4864..-6080.
1cc70 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1cc80 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1cc90 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1cca0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1ccb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1ccc0 37 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  70..SELECT ALL -
1ccd0 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30   col2 DIV - col0
1cce0 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30   + + col0 * col0
1ccf0 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
1cd00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1cd10 2d 0d 0a 32 35 0d 0a 36 30 35 38 0d 0a 36 32 30  -..25..6058..620
1cd20 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
1cd30 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1cd40 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1cd50 6f 72 74 20 6c 61 62 65 6c 2d 38 37 30 0d 0a 53  ort label-870..S
1cd60 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
1cd70 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   / - col0 + + co
1cd80 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  l0 * col0 + - co
1cd90 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1cda0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a  cor0..----..25..
1cdb0 36 30 35 38 0d 0a 36 32 30 33 0d 0a 0d 0a 71 75  6058..6203....qu
1cdc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1cdd0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
1cde0 6c 31 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 - + col2 FROM
1cdf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1ce00 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d  ---..-28..-47..-
1ce10 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
1ce20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1ce30 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52  + col0 * col1 FR
1ce40 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1ce50 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a  --..2064..3395..
1ce60 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
1ce70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ce80 44 49 53 54 49 4e 43 54 20 2d 20 36 34 20 2a 20  DISTINCT - 64 * 
1ce90 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col0 * - col0 FR
1cea0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1ceb0 0a 2d 2d 2d 2d 0d 0a 33 36 38 36 34 0d 0a 35 30  .----..36864..50
1cec0 36 39 34 34 0d 0a 37 38 34 30 30 0d 0a 0d 0a 71  6944..78400....q
1ced0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1cee0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1cef0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  - cor0.col2 * - 
1cf00 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1cf10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
1cf20 34 34 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a  44..676..729....
1cf30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1cf40 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
1cf50 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 28 20 63   cor0.col2 * ( c
1cf60 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
1cf70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1cf80 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 37 35 32 0d 0a  .----..0..2752..
1cf90 37 33 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7371....query I 
1cfa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cfb0 41 4c 4c 20 2b 20 34 36 20 2b 20 63 6f 6c 31 20  ALL + 46 + col1 
1cfc0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1cfd0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 36 33  2..----..105..63
1cfe0 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..77....query I 
1cff0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d000 44 49 53 54 49 4e 43 54 20 2d 20 31 30 20 2a 20  DISTINCT - 10 * 
1d010 2d 20 63 6f 6c 31 20 2d 20 28 20 2d 20 63 6f 6c  - col1 - ( - col
1d020 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  1 ) FROM tab0 AS
1d030 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
1d040 31 0d 0a 31 30 36 37 0d 0a 39 34 36 0d 0a 0d 0a  1..1067..946....
1d050 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d060 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
1d070 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41   - col0 * col1 A
1d080 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
1d090 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1d0a0 2d 32 30 39 37 0d 0a 2d 33 33 39 36 0d 0a 2d 38  -2097..-3396..-8
1d0b0 31 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  181....query I r
1d0c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32  owsort..SELECT 2
1d0d0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
1d0e0 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
1d0f0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
1d100 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
1d110 20 68 61 73 68 69 6e 67 20 74 6f 20 33 31 32 63   hashing to 312c
1d120 31 36 36 66 34 64 63 34 31 32 37 33 30 63 34 33  166f4dc412730c43
1d130 35 35 35 31 30 35 62 31 66 34 34 62 0d 0a 0d 0a  555105b1f44b....
1d140 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d150 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
1d160 20 28 20 38 33 20 29 20 46 52 4f 4d 20 74 61 62   ( 83 ) FROM tab
1d170 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1d180 0a 31 30 37 0d 0a 31 31 38 0d 0a 31 37 32 0d 0a  .107..118..172..
1d190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d1a0 74 0d 0a 53 45 4c 45 43 54 20 31 36 20 2b 20 63  t..SELECT 16 + c
1d1b0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
1d1c0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
1d1d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1d1e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1d1f0 20 74 6f 20 31 62 39 32 36 62 61 31 32 36 36 34   to 1b926ba12664
1d200 33 64 61 63 30 65 66 31 31 34 61 37 34 62 30 62  3dac0ef114a74b0b
1d210 64 32 36 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20  d26c....query I 
1d220 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d230 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63  DISTINCT - ( + c
1d240 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol2 ) AS col2 FR
1d250 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1d260 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a  .----..-1..-33..
1d270 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -82....query I r
1d280 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d290 4c 4c 20 2d 20 38 36 20 46 52 4f 4d 20 74 61 62  LL - 86 FROM tab
1d2a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 38  0..----..-86..-8
1d2b0 36 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72 79 20  6..-86....query 
1d2c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d2d0 54 20 2b 20 38 20 41 53 20 63 6f 6c 32 20 46 52  T + 8 AS col2 FR
1d2e0 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
1d2f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1d300 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1d310 20 66 66 63 35 62 34 63 39 38 62 35 37 61 65 35   ffc5b4c98b57ae5
1d320 34 36 35 32 31 31 37 35 39 39 35 63 34 39 63 35  46521175995c49c5
1d330 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  7....query IIIII
1d340 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
1d350 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
1d360 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
1d370 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31   cor0, tab2 cor1
1d380 2c 20 74 61 62 32 20 63 6f 72 32 0d 0a 2d 2d 2d  , tab2 cor2..---
1d390 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61  -..972 values ha
1d3a0 73 68 69 6e 67 20 74 6f 20 38 32 64 65 66 31 63  shing to 82def1c
1d3b0 33 33 36 31 65 36 33 35 64 64 34 63 66 34 34 37  3361e635dd4cf447
1d3c0 65 64 63 32 32 65 64 62 39 0d 0a 0d 0a 71 75 65  edc22edb9....que
1d3d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d3e0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
1d3f0 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53  * col0 + col2 AS
1d400 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1d410 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d420 31 30 38 0d 0a 2d 33 35 39 31 0d 0a 2d 37 35 38  108..-3591..-758
1d430 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1d440 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1d450 20 2d 20 35 34 20 46 52 4f 4d 20 74 61 62 32 2c   - 54 FROM tab2,
1d460 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
1d470 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
1d480 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1d490 37 31 65 32 37 61 31 32 37 36 37 64 33 61 39 38  71e27a12767d3a98
1d4a0 37 63 65 30 35 65 34 64 36 65 64 61 64 32 31 31  7ce05e4d6edad211
1d4b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1d4c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
1d4d0 37 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  72 * + col2 AS c
1d4e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1d4f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 37   cor0..----..237
1d500 36 0d 0a 35 39 30 34 0d 0a 37 32 0d 0a 0d 0a 71  6..5904..72....q
1d510 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d520 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
1d530 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  + col2 + - col1 
1d540 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d550 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36  0..----..-29..-6
1d560 31 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..80....skipif 
1d570 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1d580 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1d590 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1d5a0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1d5b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d5c0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d  t..SELECT col2 -
1d5d0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63   + col0 * cor0.c
1d5e0 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol0 col1 FROM ta
1d5f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1d600 0d 0a 2d 32 32 0d 0a 2d 36 30 35 38 0d 0a 2d 36  ..-22..-6058..-6
1d610 32 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  203....query I r
1d620 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1d630 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   + col2 * cor0.c
1d640 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1d650 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   cor0..----..291
1d660 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d  6..3249..9216...
1d670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d680 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
1d690 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 34 20 46  * + col1 * - 4 F
1d6a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d6b0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 38 30 0d 0a 33  ..----..13580..3
1d6c0 32 33 39 36 0d 0a 38 32 35 36 0d 0a 0d 0a 71 75  2396..8256....qu
1d6d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d6e0 45 4c 45 43 54 20 2b 20 2b 20 38 37 20 2a 20 2b  ELECT + + 87 * +
1d6f0 20 63 6f 6c 32 20 2d 20 34 32 20 41 53 20 63 6f   col2 - 42 AS co
1d700 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1d710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 35 36  cor0..----..4656
1d720 0d 0a 34 39 31 37 0d 0a 38 33 31 30 0d 0a 0d 0a  ..4917..8310....
1d730 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1d740 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1d750 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1d760 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1d770 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 34 0d  wsort label-894.
1d780 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 44  .SELECT + col2 D
1d790 49 56 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 32 36  IV + col2 + - 26
1d7a0 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   * col2 + - col2
1d7b0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1d7c0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
1d7d0 32 32 31 33 0d 0a 2d 32 36 0d 0a 2d 38 39 30 0d  2213..-26..-890.
1d7e0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1d7f0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1d800 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d810 74 20 6c 61 62 65 6c 2d 38 39 34 0d 0a 53 45 4c  t label-894..SEL
1d820 45 43 54 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63  ECT + col2 / + c
1d830 6f 6c 32 20 2b 20 2d 20 32 36 20 2a 20 63 6f 6c  ol2 + - 26 * col
1d840 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  2 + - col2 AS co
1d850 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
1d860 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 31 33 0d 0a  0..----..-2213..
1d870 2d 32 36 0d 0a 2d 38 39 30 0d 0a 0d 0a 73 6b 69  -26..-890....ski
1d880 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1d890 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1d8a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1d8b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1d8c0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1d8d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1d8e0 33 39 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  39 + col2 + col2
1d8f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1d900 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1d910 31 35 0d 0a 39 31 0d 0a 39 33 0d 0a 0d 0a 71 75  15..91..93....qu
1d920 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d930 45 4c 45 43 54 20 2d 20 2d 20 36 39 20 2b 20 63  ELECT - - 69 + c
1d940 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 + col1 AS co
1d950 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
1d960 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 0d 0a 32 30  0..----..179..20
1d970 31 0d 0a 32 34 39 0d 0a 0d 0a 71 75 65 72 79 20  1..249....query 
1d980 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d990 54 20 2d 20 63 6f 6c 32 20 2b 20 35 37 20 41 53  T - col2 + 57 AS
1d9a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1d9b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1d9c0 39 0d 0a 33 30 0d 0a 33 31 0d 0a 0d 0a 71 75 65  9..30..31....que
1d9d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d9e0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  LECT - + col1 * 
1d9f0 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 63  + ( - col1 ) + c
1da00 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 * col1 AS co
1da10 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1da20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 39  cor0..----..1209
1da30 0d 0a 37 34 30 0d 0a 37 35 34 0d 0a 0d 0a 71 75  ..740..754....qu
1da40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1da50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1da60 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
1da70 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  2 + col2 AS col0
1da80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1da90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37 30 0d 0a  r0..----..2970..
1daa0 33 33 30 36 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75  3306..9312....qu
1dab0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1dac0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
1dad0 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20  .col0 + col1 AS 
1dae0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1daf0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
1db00 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71  0..132..180....q
1db10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1db20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1db30 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  - col0 * + col2 
1db40 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
1db50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1db60 0d 0a 2d 31 36 35 0d 0a 2d 33 37 31 32 0d 0a 2d  ..-165..-3712..-
1db70 37 37 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7760....onlyif m
1db80 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1db90 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1dba0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1dbb0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1dbc0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1dbd0 2d 39 30 32 0d 0a 53 45 4c 45 43 54 20 28 20 34  -902..SELECT ( 4
1dbe0 31 20 29 20 2a 20 63 6f 6c 32 20 2b 20 43 41 53  1 ) * col2 + CAS
1dbf0 54 28 20 2d 20 38 32 20 41 53 20 53 49 47 4e 45  T( - 82 AS SIGNE
1dc00 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  D ) FROM tab1 AS
1dc10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33   cor0..----..213
1dc20 32 0d 0a 32 32 35 35 0d 0a 33 38 35 34 0d 0a 0d  2..2255..3854...
1dc30 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1dc40 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1dc50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1dc60 6c 61 62 65 6c 2d 39 30 32 0d 0a 53 45 4c 45 43  label-902..SELEC
1dc70 54 20 28 20 34 31 20 29 20 2a 20 63 6f 6c 32 20  T ( 41 ) * col2 
1dc80 2b 20 43 41 53 54 20 28 20 2d 20 38 32 20 41 53  + CAST ( - 82 AS
1dc90 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
1dca0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1dcb0 2d 2d 0d 0a 32 31 33 32 0d 0a 32 32 35 35 0d 0a  --..2132..2255..
1dcc0 33 38 35 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  3854....skipif p
1dcd0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1dce0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1dcf0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1dd00 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1dd10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dd20 0d 0a 53 45 4c 45 43 54 20 2d 20 31 20 63 6f 6c  ..SELECT - 1 col
1dd30 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
1dd40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
1dd50 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49  1..-1....query I
1dd60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1dd70 20 32 37 20 2a 20 35 32 20 41 53 20 63 6f 6c 32   27 * 52 AS col2
1dd80 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1dd90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 34 0d 0a  r0..----..1404..
1dda0 31 34 30 34 0d 0a 31 34 30 34 0d 0a 0d 0a 6f 6e  1404..1404....on
1ddb0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1ddc0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1ddd0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1dde0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1ddf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1de00 20 6c 61 62 65 6c 2d 39 30 35 0d 0a 53 45 4c 45   label-905..SELE
1de10 43 54 20 2d 20 43 41 53 54 28 20 2b 20 34 20 41  CT - CAST( + 4 A
1de20 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
1de30 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1de40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
1de50 2d 34 0d 0a 2d 34 0d 0a 0d 0a 73 6b 69 70 69 66  -4..-4....skipif
1de60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1de70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1de80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
1de90 30 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  05..SELECT - CAS
1dea0 54 20 28 20 2b 20 34 20 41 53 20 49 4e 54 45 47  T ( + 4 AS INTEG
1deb0 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ER ) AS col0 FRO
1dec0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1ded0 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 34 0d 0a 2d 34  ----..-4..-4..-4
1dee0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1def0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 37 20 2a  ort..SELECT 67 *
1df00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1df10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
1df20 37 36 32 0d 0a 36 30 39 37 0d 0a 36 34 39 39 0d  762..6097..6499.
1df30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1df40 72 74 0d 0a 53 45 4c 45 43 54 20 31 34 20 2a 20  rt..SELECT 14 * 
1df50 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 41 53  col2 + + col1 AS
1df60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1df70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1df80 33 35 37 0d 0a 37 38 32 0d 0a 38 30 38 0d 0a 0d  357..782..808...
1df90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dfa0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1dfb0 54 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a  T + ( + col2 ) *
1dfc0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a   - col0 + col2 *
1dfd0 20 2b 20 33 33 20 41 53 20 63 6f 6c 31 20 46 52   + 33 AS col1 FR
1dfe0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1dff0 2d 2d 0d 0a 2d 32 0d 0a 2d 34 35 39 32 0d 0a 32  --..-2..-4592..2
1e000 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
1e010 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1e020 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col1 * - col0 * 
1e030 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
1e040 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1e050 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 35 0d 0a  ..----..118825..
1e060 34 39 35 33 36 0d 0a 37 32 30 38 31 31 0d 0a 0d  49536..720811...
1e070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e080 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36  ..SELECT ALL - 6
1e090 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1e0a0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1e0b0 2d 36 31 0d 0a 2d 36 31 0d 0a 2d 36 31 0d 0a 0d  -61..-61..-61...
1e0c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1e0d0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1e0e0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1e0f0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1e100 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 31  owsort label-911
1e110 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e120 54 20 2d 20 2d 20 43 41 53 54 28 20 2b 20 28 20  T - - CAST( + ( 
1e130 63 6f 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44  col0 ) AS SIGNED
1e140 20 29 20 44 49 56 20 2b 20 28 20 63 6f 6c 31 20   ) DIV + ( col1 
1e150 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
1e160 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
1e170 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .4....skipif mys
1e180 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1e190 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1e1a0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 31 0d 0a  sort label-911..
1e1b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1e1c0 2d 20 2d 20 43 41 53 54 20 28 20 2b 20 28 20 63  - - CAST ( + ( c
1e1d0 6f 6c 30 20 29 20 41 53 20 49 4e 54 45 47 45 52  ol0 ) AS INTEGER
1e1e0 20 29 20 2f 20 2b 20 28 20 63 6f 6c 31 20 29 20   ) / + ( col1 ) 
1e1f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1e200 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34  0..----..0..1..4
1e210 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1e220 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1e230 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1e240 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1e250 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1e260 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 32  owsort label-912
1e270 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e280 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
1e290 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
1e2a0 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  0 * cor0.col2 FR
1e2b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1e2c0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
1e2d0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1e2e0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1e2f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1e300 62 65 6c 2d 39 31 32 0d 0a 53 45 4c 45 43 54 20  bel-912..SELECT 
1e310 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20  DISTINCT - CAST 
1e320 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
1e330 52 20 29 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  R ) + col0 * cor
1e340 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
1e350 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e360 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
1e370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e380 41 4c 4c 20 28 20 38 30 20 29 20 2a 20 2b 20 63  ALL ( 80 ) * + c
1e390 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1e3a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32   cor0..----..192
1e3b0 30 0d 0a 32 38 30 30 0d 0a 37 31 32 30 0d 0a 0d  0..2800..7120...
1e3c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e3d0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
1e3e0 31 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29  1 + - ( + col0 )
1e3f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1e400 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  r0..----..-19..-
1e410 36 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20  62..24....query 
1e420 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e430 54 20 2b 20 32 38 20 2b 20 63 6f 6c 31 20 46 52  T + 28 + col1 FR
1e440 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1e450 0a 2d 2d 2d 2d 0d 0a 33 38 0d 0a 34 31 0d 0a 35  .----..38..41..5
1e460 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
1e470 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1e480 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1e490 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1e4a0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1e4b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e4c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1e4d0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 37 36 20   cor0.col0 + 76 
1e4e0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 31  * cor0.col0 col1
1e4f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1e500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 0d 0a 34  r0..----..231..4
1e510 39 32 38 0d 0a 36 31 36 30 0d 0a 0d 0a 71 75 65  928..6160....que
1e520 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e530 4c 45 43 54 20 41 4c 4c 20 2d 20 37 20 2b 20 39  LECT ALL - 7 + 9
1e540 38 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  8 - col0 * - col
1e550 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1e560 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
1e570 34 31 38 37 0d 0a 36 34 39 31 0d 0a 0d 0a 71 75  4187..6491....qu
1e580 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e590 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28 20  ELECT ALL + + ( 
1e5a0 2d 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 32 20  - col0 ) * col2 
1e5b0 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + + col1 AS col2
1e5c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1e5d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a  r0..----..-136..
1e5e0 2d 33 36 33 38 0d 0a 2d 37 36 36 37 0d 0a 0d 0a  -3638..-7667....
1e5f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e600 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e610 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   cor0.col0 + col
1e620 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1e630 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1e640 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d  -..121..176..57.
1e650 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e660 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1e670 20 31 35 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f   15 + col1 AS co
1e680 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1e690 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d 0a  cor0..----..71..
1e6a0 37 36 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  76..82....query 
1e6b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e6c0 54 20 2b 20 38 20 41 53 20 63 6f 6c 31 20 46 52  T + 8 AS col1 FR
1e6d0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1e6e0 0a 2d 2d 2d 2d 0d 0a 38 0d 0a 38 0d 0a 38 0d 0a  .----..8..8..8..
1e6f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e700 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1e710 43 54 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41  CT col1 - col0 A
1e720 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1e730 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
1e740 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65  ..-67..23....que
1e750 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e760 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72  LECT ALL - - cor
1e770 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  0.col1 + - col0 
1e780 2a 20 28 20 2d 20 33 33 20 29 20 41 53 20 63 6f  * ( - 33 ) AS co
1e790 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1e7a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 32  cor0..----..1252
1e7b0 0d 0a 33 30 32 38 0d 0a 38 37 38 0d 0a 0d 0a 71  ..3028..878....q
1e7c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e7d0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 30 20  SELECT ALL + 70 
1e7e0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
1e7f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1e800 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1e810 74 6f 20 39 37 35 38 64 61 36 35 61 65 34 37 31  to 9758da65ae471
1e820 31 65 33 65 38 63 38 64 65 66 32 66 65 30 32 36  1e3e8c8def2fe026
1e830 39 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  911....query I r
1e840 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e850 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41   col1 + - col0 A
1e860 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1e870 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34  ..----..-29..-74
1e880 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-93....query I
1e890 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e8a0 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f   - col0 * ( + co
1e8b0 6c 30 20 29 20 2d 20 34 31 20 2a 20 2d 20 63 6f  l0 ) - 41 * - co
1e8c0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
1e8d0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 36  tab2..----..-366
1e8e0 35 0d 0a 2d 35 35 34 34 0d 0a 31 32 32 32 0d 0a  5..-5544..1222..
1e8f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e900 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1e910 39 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  91 FROM tab1, ta
1e920 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1e930 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1e940 6e 67 20 74 6f 20 35 37 34 38 36 32 37 65 66 35  ng to 5748627ef5
1e950 66 64 38 36 61 32 31 63 64 35 35 39 66 64 32 37  fd86a21cd559fd27
1e960 38 64 37 32 37 37 0d 0a 0d 0a 71 75 65 72 79 20  8d7277....query 
1e970 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e980 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20 28  T ALL col2 + + (
1e990 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20   col0 ) AS col0 
1e9a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1e9b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31  0..----..104..11
1e9c0 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  7..34....query I
1e9d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e9e0 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 38 38 20 2b   - col0 * - 88 +
1e9f0 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2b 20   ( - col2 ) + + 
1ea00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1ea10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
1ea20 36 35 0d 0a 33 31 37 36 0d 0a 37 38 34 31 0d 0a  65..3176..7841..
1ea30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ea40 74 0d 0a 53 45 4c 45 43 54 20 33 35 20 2a 20 2b  t..SELECT 35 * +
1ea50 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f   tab1.col2 AS co
1ea60 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
1ea70 2d 2d 0d 0a 31 38 39 30 0d 0a 31 39 39 35 0d 0a  --..1890..1995..
1ea80 33 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3360....query I 
1ea90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1eaa0 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ALL + + col0 * c
1eab0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1eac0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1ead0 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d  ---..2064..3395.
1eae0 0a 38 30 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .8099....onlyif 
1eaf0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1eb00 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1eb10 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1eb20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1eb30 61 62 65 6c 2d 39 33 32 0d 0a 53 45 4c 45 43 54  abel-932..SELECT
1eb40 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
1eb50 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74   DIV col0 FROM t
1eb60 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  ab0..----..1..2.
1eb70 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .3....skipif mys
1eb80 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1eb90 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1eba0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 32 0d 0a  sort label-932..
1ebb0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ebc0 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 46 52  + col1 / col0 FR
1ebd0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
1ebe0 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20  ..2..3....query 
1ebf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ec00 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
1ec10 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  + - col1 * + cor
1ec20 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
1ec30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ec40 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 36 33 0d 0a 2d  ..----..-7363..-
1ec50 38 31 39 39 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 6f  8199..-9408....o
1ec60 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1ec70 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1ec80 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1ec90 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1eca0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ecb0 74 20 6c 61 62 65 6c 2d 39 33 34 0d 0a 53 45 4c  t label-934..SEL
1ecc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
1ecd0 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 28 20   col0 * CAST( ( 
1ece0 63 6f 6c 32 20 29 20 41 53 20 53 49 47 4e 45 44  col2 ) AS SIGNED
1ecf0 20 29 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20   ) + CAST( col0 
1ed00 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
1ed10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1ed20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36   cor0..----..196
1ed30 0d 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a  ..2106..3081....
1ed40 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1ed50 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1ed60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ed70 61 62 65 6c 2d 39 33 34 0d 0a 53 45 4c 45 43 54  abel-934..SELECT
1ed80 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f   DISTINCT + + co
1ed90 6c 30 20 2a 20 43 41 53 54 20 28 20 28 20 63 6f  l0 * CAST ( ( co
1eda0 6c 32 20 29 20 41 53 20 49 4e 54 45 47 45 52 20  l2 ) AS INTEGER 
1edb0 29 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 30 20  ) + CAST ( col0 
1edc0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
1edd0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1ede0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
1edf0 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a 0d  6..2106..3081...
1ee00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ee10 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
1ee20 31 35 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  15 - + col1 FROM
1ee30 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1ee40 2d 2d 2d 0d 0a 31 34 30 0d 0a 31 38 32 0d 0a 33  ---..140..182..3
1ee50 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
1ee60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1ee70 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20  STINCT - - col2 
1ee80 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
1ee90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1eea0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34  ..----..1534..64
1eeb0 36 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69 70 69 66  6..837....skipif
1eec0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1eed0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1eee0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1eef0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1ef00 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1ef10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1ef20 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  NCT + + cor0.col
1ef30 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  0 * col0 + col2 
1ef40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
1ef50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 35 33 0d  or0..----..4153.
1ef60 0a 36 33 0d 0a 36 34 39 36 0d 0a 0d 0a 71 75 65  .63..6496....que
1ef70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ef80 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20  LECT ALL col0 * 
1ef90 2d 20 28 20 63 6f 6c 31 20 29 20 2d 20 63 6f 72  - ( col1 ) - cor
1efa0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  0.col2 AS col1 F
1efb0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1efc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d  ..----..-1136..-
1efd0 31 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a 6f 6e 6c  132..-697....onl
1efe0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1eff0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1f000 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1f010 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1f020 72 74 20 6c 61 62 65 6c 2d 39 33 39 0d 0a 53 45  rt label-939..SE
1f030 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  LECT - col0 + + 
1f040 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 2d 20  cor0.col1 DIV - 
1f050 38 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  84 AS col1 FROM 
1f060 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1f070 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d  .-7..-78..-79...
1f080 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1f090 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1f0a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1f0b0 6c 61 62 65 6c 2d 39 33 39 0d 0a 53 45 4c 45 43  label-939..SELEC
1f0c0 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72  T - col0 + + cor
1f0d0 30 2e 63 6f 6c 31 20 2f 20 2d 20 38 34 20 41 53  0.col1 / - 84 AS
1f0e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
1f0f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  cor0..----..-7..
1f100 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72  -78..-79....quer
1f110 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f120 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
1f130 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
1f140 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f150 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
1f160 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20  2..180....query 
1f170 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f180 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
1f190 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  0 * - cor0.col0 
1f1a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1f1b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1f1c0 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32  .-49..-6084..-62
1f1d0 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  41....query I ro
1f1e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1f1f0 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  L + + cor0.col1 
1f200 2b 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 41  + - ( - col2 ) A
1f210 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1f220 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f230 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 6f 6e  55..58..85....on
1f240 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1f250 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1f260 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1f270 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1f280 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f290 20 6c 61 62 65 6c 2d 39 34 33 0d 0a 53 45 4c 45   label-943..SELE
1f2a0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
1f2b0 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
1f2c0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
1f2d0 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
1f2e0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
1f2f0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1f300 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1f310 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1f320 61 62 65 6c 2d 39 34 33 0d 0a 53 45 4c 45 43 54  abel-943..SELECT
1f330 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2d   DISTINCT col1 -
1f340 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
1f350 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
1f360 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
1f370 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
1f380 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1f390 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1f3a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1f3b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1f3c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 34 0d  wsort label-944.
1f3d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1f3e0 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31   - col2 DIV col1
1f3f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1f400 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d  r0..----..-2..0.
1f410 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1f420 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1f430 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f440 74 20 6c 61 62 65 6c 2d 39 34 34 0d 0a 53 45 4c  t label-944..SEL
1f450 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
1f460 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 / col1 FROM 
1f470 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f480 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 73 6b 69  --..-2..0....ski
1f490 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1f4a0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1f4b0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1f4c0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1f4d0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1f4e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1f4f0 34 34 20 2a 20 2d 20 36 32 20 63 6f 6c 31 20 46  44 * - 62 col1 F
1f500 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1f510 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 38 0d 0a 32 37  ..----..2728..27
1f520 32 38 0d 0a 32 37 32 38 0d 0a 0d 0a 71 75 65 72  28..2728....quer
1f530 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f540 45 43 54 20 2b 20 28 20 2b 20 34 34 20 29 20 2b  ECT + ( + 44 ) +
1f550 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41   col2 * - col2 A
1f560 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
1f570 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f580 2d 31 30 34 35 0d 0a 2d 36 36 38 30 0d 0a 34 33  -1045..-6680..43
1f590 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1f5a0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1f5b0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1f5c0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1f5d0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1f5e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 37  owsort label-947
1f5f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1f600 6f 6c 32 20 2b 20 2b 20 43 41 53 54 28 20 63 6f  ol2 + + CAST( co
1f610 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l2 AS SIGNED ) *
1f620 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1f630 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 30 35 36 0d 0a  .----..0..1056..
1f640 36 36 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  6642....skipif m
1f650 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1f660 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1f670 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 37  owsort label-947
1f680 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1f690 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20 28 20 63  ol2 + + CAST ( c
1f6a0 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
1f6b0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
1f6c0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 30 35 36  0..----..0..1056
1f6d0 0d 0a 36 36 34 32 0d 0a 0d 0a 71 75 65 72 79 20  ..6642....query 
1f6e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f6f0 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b  T ALL - col1 * +
1f700 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 35   ( cor0.col2 * 5
1f710 34 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  4 ) FROM tab0 co
1f720 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 32 35  r0..----..-15325
1f730 32 0d 0a 2d 34 30 32 39 34 38 0d 0a 2d 35 32 33  2..-402948..-523
1f740 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1f750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1f760 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 32 30 20  TINCT col0 + 20 
1f770 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1f780 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 34 34  0..----..109..44
1f790 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..55....query I 
1f7a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f7b0 41 4c 4c 20 2d 20 34 39 20 41 53 20 63 6f 6c 31  ALL - 49 AS col1
1f7c0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
1f7d0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63   AS cor0, tab1 c
1f7e0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
1f7f0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1f800 61 64 66 63 63 62 31 30 63 39 34 36 38 38 32 35  adfccb10c9468825
1f810 64 39 39 36 31 65 33 36 31 33 31 34 30 66 38 39  d9961e3613140f89
1f820 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f830 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1f840 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  r0.col2 AS col2 
1f850 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f860 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
1f870 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor1..----..9 
1f880 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1f890 6f 20 63 38 66 39 66 61 39 65 66 30 66 38 37 30  o c8f9fa9ef0f870
1f8a0 32 62 64 33 38 32 65 38 32 31 33 37 38 61 39 36  2bd382e821378a96
1f8b0 64 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  d8....query I ro
1f8c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1f8d0 6c 32 20 2a 20 33 38 20 41 53 20 63 6f 6c 30 20  l2 * 38 AS col0 
1f8e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1f8f0 0a 31 32 35 34 0d 0a 33 31 31 36 0d 0a 33 38 0d  .1254..3116..38.
1f900 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f910 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  rt..SELECT - tab
1f920 32 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  2.col0 + + col1 
1f930 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1f940 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36  2..----..-19..-6
1f950 32 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  2..24....query I
1f960 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f970 20 44 49 53 54 49 4e 43 54 20 39 38 20 46 52 4f   DISTINCT 98 FRO
1f980 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
1f990 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
1f9a0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 38 0d 0a 0d 0a  r1..----..98....
1f9b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f9c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
1f9d0 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l0 * - cor0.col2
1f9e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1f9f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1fa00 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37  ..-35..-7298..-7
1fa10 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  92....onlyif mys
1fa20 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1fa30 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1fa40 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1fa50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fa60 6c 2d 39 35 36 0d 0a 53 45 4c 45 43 54 20 44 49  l-956..SELECT DI
1fa70 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
1fa80 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63   DIV + col0 AS c
1fa90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1faa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
1fab0 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  8....skipif mysq
1fac0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1fad0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1fae0 6f 72 74 20 6c 61 62 65 6c 2d 39 35 36 0d 0a 53  ort label-956..S
1faf0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1fb00 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c  or0.col1 / + col
1fb10 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1fb20 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1fb30 2d 0d 0a 30 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69  -..0..8....skipi
1fb40 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1fb50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1fb60 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1fb70 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1fb80 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1fb90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1fba0 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20 46  l0 * col2 col1 F
1fbb0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1fbc0 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34  ..----..162..364
1fbd0 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79  8..7680....query
1fbe0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fbf0 43 54 20 36 37 20 41 53 20 63 6f 6c 31 20 46 52  CT 67 AS col1 FR
1fc00 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
1fc10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1fc20 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1fc30 20 62 35 36 66 38 61 34 66 31 66 63 65 62 63 39   b56f8a4f1fcebc9
1fc40 38 30 32 34 38 31 32 35 36 64 66 36 31 65 39 37  802481256df61e97
1fc50 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  c....query I row
1fc60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36  sort..SELECT + 6
1fc70 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
1fc80 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
1fc90 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
1fca0 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  2..----..27 valu
1fcb0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 63  es hashing to 1c
1fcc0 39 64 30 62 66 39 36 63 64 33 33 36 31 39 34 32  9d0bf96cd3361942
1fcd0 66 61 64 61 64 36 36 38 31 33 38 62 39 63 0d 0a  fadad668138b9c..
1fce0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fcf0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20  t..SELECT - ( - 
1fd00 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2b 20  col1 ) * col1 + 
1fd10 28 20 63 6f 6c 32 20 2b 20 31 37 20 29 20 2a 20  ( col2 + 17 ) * 
1fd20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63  - ( col1 ) * + c
1fd30 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
1fd40 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   tab2..----..-35
1fd50 32 34 31 0d 0a 2d 33 35 38 36 37 0d 0a 2d 36 32  241..-35867..-62
1fd60 34 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  481....query I r
1fd70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1fd80 49 53 54 49 4e 43 54 20 37 36 20 46 52 4f 4d 20  ISTINCT 76 FROM 
1fd90 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 36 0d 0a  tab2..----..76..
1fda0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fdb0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
1fdc0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
1fdd0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f  OM tab1, tab1 co
1fde0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
1fdf0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 32  es hashing to b2
1fe00 33 34 37 39 38 64 34 37 30 36 33 31 34 62 61 31  34798d4706314ba1
1fe10 34 65 61 61 64 35 33 39 64 30 61 61 38 38 0d 0a  4eaad539d0aa88..
1fe20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fe30 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1fe40 43 54 20 2b 20 31 38 20 2a 20 2d 20 63 6f 6c 30  CT + 18 * - col0
1fe50 20 2a 20 2d 20 32 30 20 46 52 4f 4d 20 74 61 62   * - 20 FROM tab
1fe60 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 30 0d 0a 32  1..----..1080..2
1fe70 33 30 34 30 0d 0a 32 38 38 30 30 0d 0a 0d 0a 71  3040..28800....q
1fe80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fe90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1fea0 28 20 2d 20 63 6f 72 31 2e 63 6f 6c 30 20 29 20  ( - cor1.col0 ) 
1feb0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
1fec0 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
1fed0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor1..----..-24
1fee0 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75  ..-35..-89....qu
1fef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ff00 45 4c 45 43 54 20 2b 20 38 34 20 46 52 4f 4d 20  ELECT + 84 FROM 
1ff10 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
1ff20 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
1ff30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
1ff40 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 38 63  s hashing to e8c
1ff50 64 36 38 33 66 65 38 63 65 61 37 37 62 34 33 32  d683fe8cea77b432
1ff60 36 64 39 62 38 30 66 32 31 63 37 34 61 0d 0a 0d  6d9b80f21c74a...
1ff70 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
1ff80 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
1ff90 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
1ffa0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
1ffb0 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72  S cor0, tab1 cor
1ffc0 31 2c 20 74 61 62 31 20 63 6f 72 32 0d 0a 2d 2d  1, tab1 cor2..--
1ffd0 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68  --..972 values h
1ffe0 61 73 68 69 6e 67 20 74 6f 20 66 38 66 65 32 38  ashing to f8fe28
1fff0 36 38 31 65 38 37 32 30 35 35 31 65 31 65 63 31  681e8720551e1ec1
20000 37 33 36 33 31 66 63 35 32 39 0d 0a 0d 0a 71 75  73631fc529....qu
20010 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20020 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
20030 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a   col2 + - col1 *
20040 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
20050 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  cor0..----..-134
20060 34 0d 0a 2d 31 34 35 38 0d 0a 2d 36 32 37 0d 0a  4..-1458..-627..
20070 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20080 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 37 20 41  t..SELECT - 27 A
20090 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
200a0 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
200b0 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31  OIN tab1 AS cor1
200c0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
200d0 20 68 61 73 68 69 6e 67 20 74 6f 20 39 30 62 37   hashing to 90b7
200e0 36 63 61 66 35 34 61 34 65 34 38 65 65 34 61 39  6caf54a4e48ee4a9
200f0 37 38 34 66 35 32 39 39 37 61 36 61 0d 0a 0d 0a  784f52997a6a....
20100 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20110 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
20120 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46   - col2 * col0 F
20130 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20140 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d 0a  ..----..-26136..
20150 2d 33 35 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d 0a  -35..-598436....
20160 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20170 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31  .SELECT ALL tab1
20180 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41  .col1 * - col0 A
20190 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
201a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d  ..----..-1040..-
201b0 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 6f 6e 6c 79  640..-78....only
201c0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
201d0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
201e0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
201f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20200 74 20 6c 61 62 65 6c 2d 39 37 31 0d 0a 53 45 4c  t label-971..SEL
20210 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
20220 31 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63  1 + col2 DIV + c
20230 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
20240 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20250 2d 2d 2d 0d 0a 31 30 0d 0a 31 34 0d 0a 34 34 0d  ---..10..14..44.
20260 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
20270 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
20280 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20290 74 20 6c 61 62 65 6c 2d 39 37 31 0d 0a 53 45 4c  t label-971..SEL
202a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
202b0 31 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  1 + col2 / + col
202c0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
202d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
202e0 2d 0d 0a 31 30 0d 0a 31 34 0d 0a 34 34 0d 0a 0d  -..10..14..44...
202f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20300 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20310 54 20 37 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  T 7 FROM tab0, t
20320 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
20330 2d 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -..7....onlyif m
20340 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
20350 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
20360 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
20370 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
20380 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
20390 2d 39 37 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  -973..SELECT DIS
203a0 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 43 41 53  TINCT col1 * CAS
203b0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
203c0 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  D ) AS col1 FROM
203d0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
203e0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
203f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
20400 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
20410 6f 72 74 20 6c 61 62 65 6c 2d 39 37 33 0d 0a 53  ort label-973..S
20420 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
20430 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 4e 55 4c  ol1 * CAST ( NUL
20440 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
20450 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
20460 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
20470 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
20480 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
20490 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
204a0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
204b0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
204c0 72 74 20 6c 61 62 65 6c 2d 39 37 34 0d 0a 53 45  rt label-974..SE
204d0 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
204e0 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 2d 20 63  l1 * + CAST( - c
204f0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  ol0 * - col1 AS 
20500 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
20510 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d  b1..----..13520.
20520 0a 32 30 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 73  .2028..6400....s
20530 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
20540 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
20550 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20560 62 65 6c 2d 39 37 34 0d 0a 53 45 4c 45 43 54 20  bel-974..SELECT 
20570 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  ALL tab1.col1 * 
20580 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20  + CAST ( - col0 
20590 2a 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  * - col1 AS INTE
205a0 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  GER ) FROM tab1.
205b0 0a 2d 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32 30  .----..13520..20
205c0 32 38 0d 0a 36 34 30 30 0d 0a 0d 0a 6f 6e 6c 79  28..6400....only
205d0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
205e0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
205f0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
20600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20610 74 20 6c 61 62 65 6c 2d 39 37 35 0d 0a 53 45 4c  t label-975..SEL
20620 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 44 49 56  ECT ALL col1 DIV
20630 20 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab2.col0 FROM 
20640 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab2..----..0..0
20650 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..4....skipif my
20660 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
20670 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
20680 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 35 0d  wsort label-975.
20690 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
206a0 20 2f 20 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f   / tab2.col0 FRO
206b0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab2..----..0.
206c0 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..4....query I
206d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
206e0 20 34 20 2b 20 2b 20 38 35 20 41 53 20 63 6f 6c   4 + + 85 AS col
206f0 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
20700 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  0 cor0..----..9 
20710 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
20720 6f 20 35 63 38 34 32 38 65 39 66 31 65 37 64 65  o 5c8428e9f1e7de
20730 33 64 30 39 63 62 30 38 31 34 62 34 63 63 31 37  3d09cb0814b4cc17
20740 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  43....query I ro
20750 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
20760 63 6f 6c 32 20 2a 20 2b 20 28 20 39 35 20 29 20  col2 * + ( 95 ) 
20770 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  * - cor0.col0 FR
20780 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
20790 0a 2d 2d 2d 2d 0d 0a 33 33 32 35 0d 0a 36 39 33  .----..3325..693
207a0 33 31 30 0d 0a 37 35 32 34 30 0d 0a 0d 0a 6f 6e  310..75240....on
207b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
207c0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
207d0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
207e0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
207f0 6f 72 74 20 6c 61 62 65 6c 2d 39 37 38 0d 0a 53  ort label-978..S
20800 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56  ELECT - col2 DIV
20810 20 28 20 2b 20 38 34 20 29 20 41 53 20 63 6f 6c   ( + 84 ) AS col
20820 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
20830 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
20840 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
20850 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
20860 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
20870 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 38 0d 0a  sort label-978..
20880 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20  SELECT - col2 / 
20890 28 20 2b 20 38 34 20 29 20 41 53 20 63 6f 6c 30  ( + 84 ) AS col0
208a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
208b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
208c0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
208d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
208e0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  or0.col2 * - cor
208f0 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
20900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20910 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32 31 36  2916..3249..9216
20920 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
20930 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
20940 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
20950 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  rt..SELECT - CAS
20960 54 20 28 20 63 6f 6c 31 20 41 53 20 52 45 41 4c  T ( col1 AS REAL
20970 20 29 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 30   ) * - tab0.col0
20980 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
20990 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a  b0..----..2064..
209a0 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75  3395..8099....qu
209b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
209c0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 28  ELECT col0 + - (
209d0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 29 20 41   col0 + col0 ) A
209e0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
209f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35  ..----..-24..-35
20a00 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-89....query I
20a10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20a20 20 35 36 20 2b 20 2d 20 37 34 20 41 53 20 63 6f   56 + - 74 AS co
20a30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
20a40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d  cor0..----..-18.
20a50 0a 2d 31 38 0d 0a 2d 31 38 0d 0a 0d 0a 71 75 65  .-18..-18....que
20a60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20a70 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  LECT cor0.col2 +
20a80 20 35 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   53 AS col2 FROM
20a90 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
20aa0 2d 2d 2d 0d 0a 37 39 0d 0a 38 30 0d 0a 39 31 0d  ---..79..80..91.
20ab0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
20ac0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
20ad0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
20ae0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
20af0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
20b00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 34 0d  wsort label-984.
20b10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
20b20 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
20b30 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f   SIGNED ) * - co
20b40 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l1 + - col2 FROM
20b50 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20b60 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
20b70 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
20b80 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
20b90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
20ba0 6c 2d 39 38 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-984..SELECT DI
20bb0 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20  STINCT + CAST ( 
20bc0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
20bd0 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  ) * - col1 + - c
20be0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
20bf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
20c00 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
20c10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
20c20 20 2d 20 37 30 20 2b 20 2b 20 28 20 2d 20 63 6f   - 70 + + ( - co
20c30 6c 31 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  l1 ) * col0 FROM
20c40 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20c50 2d 2d 2d 0d 0a 2d 32 31 33 34 0d 0a 2d 33 34 36  ---..-2134..-346
20c60 35 0d 0a 2d 38 31 36 39 0d 0a 0d 0a 73 6b 69 70  5..-8169....skip
20c70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
20c80 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
20c90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20ca0 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20  CT ALL + CAST ( 
20cb0 34 30 20 41 53 20 52 45 41 4c 20 29 20 41 53 20  40 AS REAL ) AS 
20cc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
20cd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d 0a 34  or0..----..40..4
20ce0 30 0d 0a 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  0..40....query I
20cf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20d00 20 41 4c 4c 20 28 20 63 6f 6c 30 20 29 20 2a 20   ALL ( col0 ) * 
20d10 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
20d20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
20d30 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d  43..217..4602...
20d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20d50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20d60 54 20 2d 20 2b 20 34 37 20 41 53 20 63 6f 6c 30  T - + 47 AS col0
20d70 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
20d80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d 0a 0d  r0..----..-47...
20d90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20da0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 33 20  ..SELECT ALL 13 
20db0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
20dc0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
20dd0 0a 31 33 0d 0a 31 33 0d 0a 31 33 0d 0a 0d 0a 71  .13..13..13....q
20de0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20df0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
20e00 30 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 + - col1 AS co
20e10 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
20e20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30  cor0..----..-110
20e30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a  ..-132..-180....
20e40 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
20e50 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
20e60 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
20e70 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
20e80 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 31 0d  wsort label-991.
20e90 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
20ea0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 44 49  col2 + - col2 DI
20eb0 56 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f  V ( - col1 ) FRO
20ec0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
20ed0 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 32 0d 0a  ----..-52..-52..
20ee0 2d 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -89....skipif my
20ef0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
20f00 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
20f10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 31 0d  wsort label-991.
20f20 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
20f30 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2f 20  col2 + - col2 / 
20f40 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  ( - col1 ) FROM 
20f50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
20f60 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 32 0d 0a 2d 38  --..-52..-52..-8
20f70 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
20f80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
20f90 37 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  7 + col0 FROM ta
20fa0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
20fb0 33 34 0d 0a 32 37 0d 0a 34 33 0d 0a 0d 0a 71 75  34..27..43....qu
20fc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20fd0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b  ELECT - - col1 +
20fe0 20 2b 20 63 6f 6c 30 20 2a 20 36 35 20 46 52 4f   + col0 * 65 FRO
20ff0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
21000 2d 2d 2d 2d 0d 0a 31 36 34 36 0d 0a 32 33 37 32  ----..1646..2372
21010 0d 0a 35 38 37 36 0d 0a 0d 0a 71 75 65 72 79 20  ..5876....query 
21020 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21030 54 20 2b 20 2b 20 39 38 20 2b 20 2d 20 63 6f 72  T + + 98 + - cor
21040 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  0.col1 * cor0.co
21050 6c 30 20 2a 20 34 32 20 46 52 4f 4d 20 74 61 62  l0 * 42 FROM tab
21060 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
21070 0a 2d 31 34 32 34 39 32 0d 0a 2d 33 34 30 30 36  .-142492..-34006
21080 30 0d 0a 2d 38 36 35 39 30 0d 0a 0d 0a 6f 6e 6c  0..-86590....onl
21090 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
210a0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
210b0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
210c0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
210d0 72 74 20 6c 61 62 65 6c 2d 39 39 35 0d 0a 53 45  rt label-995..SE
210e0 4c 45 43 54 20 2b 20 2b 20 36 39 20 44 49 56 20  LECT + + 69 DIV 
210f0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
21100 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
21110 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 36 39 0d 0a  ----..0..2..69..
21120 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21130 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
21140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21150 20 6c 61 62 65 6c 2d 39 39 35 0d 0a 53 45 4c 45   label-995..SELE
21160 43 54 20 2b 20 2b 20 36 39 20 2f 20 63 6f 6c 32  CT + + 69 / col2
21170 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
21180 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
21190 0d 0a 30 0d 0a 32 0d 0a 36 39 0d 0a 0d 0a 6f 6e  ..0..2..69....on
211a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
211b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
211c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
211d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
211e0 6f 72 74 20 6c 61 62 65 6c 2d 39 39 36 0d 0a 53  ort label-996..S
211f0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
21200 20 44 49 56 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   DIV col2 + col1
21210 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
21220 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
21230 0a 37 33 39 36 0d 0a 38 32 38 32 0d 0a 39 34 34  .7396..8282..944
21240 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
21250 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
21260 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
21270 6f 72 74 20 6c 61 62 65 6c 2d 39 39 36 0d 0a 53  ort label-996..S
21280 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
21290 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a   / col2 + col1 *
212a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
212b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
212c0 33 39 36 0d 0a 38 32 38 32 0d 0a 39 34 34 34 0d  396..8282..9444.
212d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
212e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
212f0 20 35 33 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63   53 * + col2 + c
21300 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63  ol0 * - col1 + c
21310 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 * col2 FROM 
21320 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
21330 2d 2d 0d 0a 31 31 37 32 38 0d 0a 32 39 34 36 0d  --..11728..2946.
21340 0a 36 30 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .6029....query I
21350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21360 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f   ALL + - cor0.co
21370 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46  l2 * cor0.col0 F
21380 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
21390 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
213a0 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79  ..-7680....query
213b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
213c0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
213d0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63  col0 * col0 AS c
213e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
213f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d   cor0..----..49.
21400 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 71  .6084..6241....q
21410 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21420 53 45 4c 45 43 54 20 41 4c 4c 20 37 30 20 2b 20  SELECT ALL 70 + 
21430 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
21440 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
21450 31 34 38 0d 0a 31 34 39 0d 0a 37 37 0d 0a 0d 0a  148..149..77....
21460 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
21470 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
21480 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
21490 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
214a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 31  wsort label-1001
214b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 34 20  ..SELECT ALL 44 
214c0 2b 20 2d 20 37 30 20 44 49 56 20 2d 20 63 6f 6c  + - 70 DIV - col
214d0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
214e0 2d 0d 0a 34 34 0d 0a 34 34 0d 0a 34 34 0d 0a 0d  -..44..44..44...
214f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
21500 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
21510 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
21520 6c 61 62 65 6c 2d 31 30 30 31 0d 0a 53 45 4c 45  label-1001..SELE
21530 43 54 20 41 4c 4c 20 34 34 20 2b 20 2d 20 37 30  CT ALL 44 + - 70
21540 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   / - col1 FROM t
21550 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 0d 0a 34  ab0..----..44..4
21560 34 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  4..44....query I
21570 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21580 20 36 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20   62 * - col0 AS 
21590 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
215a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
215b0 34 38 38 0d 0a 2d 32 31 37 30 0d 0a 2d 35 35 31  488..-2170..-551
215c0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
215d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
215e0 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20   col2 * col1 AS 
215f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
21600 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
21610 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30  248..-1404..-570
21620 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
21630 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
21640 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
21650 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
21660 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
21670 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21680 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  LECT + - col0 * 
21690 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
216a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
216b0 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d  -..-49..-6084..-
216c0 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6241....query I 
216d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
216e0 2d 20 2b 20 32 30 20 41 53 20 63 6f 6c 30 20 46  - + 20 AS col0 F
216f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
21700 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 30  ..----..-20..-20
21710 0d 0a 2d 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-20....query I
21720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21730 20 44 49 53 54 49 4e 43 54 20 2d 20 34 39 20 41   DISTINCT - 49 A
21740 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
21750 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
21760 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 0d 0a 71 75 65  ----..-49....que
21770 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21780 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20 63  LECT ALL + ( + c
21790 6f 6c 30 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41  ol0 ) + + col2 A
217a0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
217b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
217c0 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a  104..117..34....
217d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
217e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
217f0 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2d 20   + ( - col0 ) - 
21800 2b 20 63 6f 6c 31 20 2a 20 31 30 20 41 53 20 63  + col1 * 10 AS c
21810 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
21820 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
21830 39 0d 0a 2d 33 31 37 0d 0a 2d 36 36 38 0d 0a 0d  9..-317..-668...
21840 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21850 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
21860 54 20 2b 20 32 38 20 2a 20 63 6f 6c 32 20 2b 20  T + 28 * col2 + 
21870 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
21880 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21890 31 35 30 39 0d 0a 31 35 33 32 0d 0a 32 36 30 38  1509..1532..2608
218a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
218b0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
218c0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
218d0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
218e0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
218f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21900 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36 30  LECT DISTINCT 60
21910 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
21920 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 0d 0a 71 75 65  .----..60....que
21930 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21940 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
21950 37 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  79 AS col2 FROM 
21960 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
21970 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 0d 0a 0d  r0..----..-79...
21980 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21990 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
219a0 30 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  0 + col2 + - col
219b0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
219c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
219d0 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
219e0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
219f0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
21a00 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
21a10 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
21a20 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 31  owsort label-101
21a30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  3..SELECT ALL - 
21a40 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 32 20  col0 DIV - col2 
21a50 2b 20 2d 20 63 6f 6c 30 20 2a 20 36 36 20 2a 20  + - col0 * 66 * 
21a60 2d 20 63 6f 6c 31 20 2d 20 2b 20 33 34 20 63 6f  - col1 - + 34 co
21a70 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
21a80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 31  cor0..----..1361
21a90 39 30 0d 0a 32 32 34 30 37 31 0d 0a 35 33 34 35  90..224071..5345
21aa0 30 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  01....skipif pos
21ab0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
21ac0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
21ad0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
21ae0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
21af0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
21b00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
21b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
21b20 62 65 6c 2d 31 30 31 33 0d 0a 53 45 4c 45 43 54  bel-1013..SELECT
21b30 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2f 20 2d 20   ALL - col0 / - 
21b40 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col2 + - col0 * 
21b50 36 36 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 2b 20  66 * - col1 - + 
21b60 33 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  34 col1 FROM tab
21b70 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
21b80 0a 31 33 36 31 39 30 0d 0a 32 32 34 30 37 31 0d  .136190..224071.
21b90 0a 35 33 34 35 30 31 0d 0a 0d 0a 71 75 65 72 79  .534501....query
21ba0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21bb0 43 54 20 44 49 53 54 49 4e 43 54 20 33 37 20 46  CT DISTINCT 37 F
21bc0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
21bd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37  S cor0..----..37
21be0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
21bf0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
21c00 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
21c10 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
21c20 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
21c30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21c40 4c 45 43 54 20 2d 20 28 20 2d 20 36 35 20 29 20  LECT - ( - 65 ) 
21c50 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  + col0 col1 FROM
21c60 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39   tab1..----..129
21c70 0d 0a 31 34 35 0d 0a 36 38 0d 0a 0d 0a 71 75 65  ..145..68....que
21c80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21c90 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  LECT col0 - - co
21ca0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
21cb0 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36 0d  --..137..38..96.
21cc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21cd0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  rt..SELECT + tab
21ce0 31 2e 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20  1.col1 - col0 * 
21cf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
21d00 2d 2d 2d 2d 0d 0a 2d 34 30 38 36 0d 0a 2d 36 33  ----..-4086..-63
21d10 38 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20  87..17....query 
21d20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21d30 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  T col2 + - col1 
21d40 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
21d50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21d60 2d 32 34 0d 0a 2d 35 38 33 0d 0a 2d 39 34 34 0d  -24..-583..-944.
21d70 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
21d80 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
21d90 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
21da0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
21db0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
21dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21dd0 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20  ECT - tab1.col1 
21de0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
21df0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
21e00 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
21e10 68 69 6e 67 20 74 6f 20 62 32 33 34 37 39 38 64  hing to b234798d
21e20 34 37 30 36 33 31 34 62 61 31 34 65 61 61 64 35  4706314ba14eaad5
21e30 33 39 64 30 61 61 38 38 0d 0a 0d 0a 6f 6e 6c 79  39d0aa88....only
21e40 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
21e50 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
21e60 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
21e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21e80 74 20 6c 61 62 65 6c 2d 31 30 32 30 0d 0a 53 45  t label-1020..SE
21e90 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 74 61 62  LECT ALL + ( tab
21ea0 31 2e 63 6f 6c 32 20 29 20 44 49 56 20 74 61 62  1.col2 ) DIV tab
21eb0 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  1.col0 FROM tab1
21ec0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38  ..----..0..1..18
21ed0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21ee0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21ef0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
21f00 72 74 20 6c 61 62 65 6c 2d 31 30 32 30 0d 0a 53  rt label-1020..S
21f10 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 74 61  ELECT ALL + ( ta
21f20 62 31 2e 63 6f 6c 32 20 29 20 2f 20 74 61 62 31  b1.col2 ) / tab1
21f30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d  .col0 FROM tab1.
21f40 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d  .----..0..1..18.
21f50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21f60 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35  rt..SELECT ALL 5
21f70 34 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  4 * col2 AS col1
21f80 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
21f90 0d 0a 32 39 31 36 0d 0a 33 30 37 38 0d 0a 35 31  ..2916..3078..51
21fa0 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  84....query I ro
21fb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
21fc0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
21fd0 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 31 20  l0 * - ( + col1 
21fe0 2b 20 39 20 2a 20 2b 20 28 20 63 6f 6c 32 20 29  + 9 * + ( col2 )
21ff0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
22000 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 38  cor0..----..1298
22010 35 30 0d 0a 32 32 30 36 30 38 0d 0a 36 35 36 36  50..220608..6566
22020 35 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  509....query I r
22030 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
22040 49 53 54 49 4e 43 54 20 2d 20 32 34 20 2a 20 2b  ISTINCT - 24 * +
22050 20 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor1.col0 FROM 
22060 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
22070 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d  r0, tab2 cor1..-
22080 2d 2d 2d 0d 0a 2d 31 36 38 0d 0a 2d 31 38 37 32  ---..-168..-1872
22090 0d 0a 2d 31 38 39 36 0d 0a 0d 0a 71 75 65 72 79  ..-1896....query
220a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
220b0 43 54 20 41 4c 4c 20 2b 20 33 37 20 2a 20 2d 20  CT ALL + 37 * - 
220c0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
220d0 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
220e0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
220f0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
22100 20 68 61 73 68 69 6e 67 20 74 6f 20 62 32 39 30   hashing to b290
22110 65 36 32 66 62 34 36 63 35 39 62 37 66 31 37 36  e62fb46c59b7f176
22120 38 33 36 61 34 31 65 64 33 38 31 64 0d 0a 0d 0a  836a41ed381d....
22130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22140 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
22150 6c 30 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30  l0 * - tab1.col0
22160 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53   * ( - col0 ) AS
22170 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
22180 0a 2d 2d 2d 2d 0d 0a 2d 32 36 32 31 34 34 0d 0a  .----..-262144..
22190 2d 32 37 0d 0a 2d 35 31 32 30 30 30 0d 0a 0d 0a  -27..-512000....
221a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
221b0 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 32 20 2b  .SELECT ( col2 +
221c0 20 37 34 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46   74 ) * - col2 F
221d0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
221e0 2d 32 36 30 30 0d 0a 2d 32 37 32 37 0d 0a 2d 34  -2600..-2727..-4
221f0 32 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  256....query I r
22200 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
22210 20 32 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   26 AS col0 FROM
22220 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   tab1..----..-26
22230 0d 0a 2d 32 36 0d 0a 2d 32 36 0d 0a 0d 0a 71 75  ..-26..-26....qu
22240 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22250 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
22260 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41   + cor0.col0 ) A
22270 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
22280 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
22290 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31  OIN tab0 AS cor1
222a0 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38  ..----..3..64..8
222b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
222c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
222d0 6f 6c 30 20 2a 20 2b 20 37 31 20 46 52 4f 4d 20  ol0 * + 71 FROM 
222e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 33  tab1..----..-213
222f0 0d 0a 2d 34 35 34 34 0d 0a 2d 35 36 38 30 0d 0a  ..-4544..-5680..
22300 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22310 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
22320 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  CT - col0 + col0
22330 20 2a 20 37 36 20 41 53 20 63 6f 6c 30 20 46 52   * 76 AS col0 FR
22340 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
22350 38 30 30 0d 0a 32 36 32 35 0d 0a 36 36 37 35 0d  800..2625..6675.
22360 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
22370 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
22380 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
22390 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
223a0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
223b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 31  wsort label-1031
223c0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
223d0 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + + CAST( NULL A
223e0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 28  S SIGNED ) * + (
223f0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46   + cor0.col2 ) F
22400 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
22410 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
22420 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
22430 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
22440 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
22450 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22460 2d 31 30 33 31 0d 0a 53 45 4c 45 43 54 20 2b 20  -1031..SELECT + 
22470 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20 28 20  col2 + + CAST ( 
22480 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
22490 29 20 2a 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63  ) * + ( + cor0.c
224a0 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol2 ) FROM tab0 
224b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
224c0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
224d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
224e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
224f0 30 20 2b 20 2d 20 28 20 2d 20 38 31 20 29 20 46  0 + - ( - 81 ) F
22500 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
22510 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 37 0d 0a 37  ..----..1..17..7
22520 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
22530 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
22540 6f 6c 31 20 2a 20 35 31 20 2b 20 2d 20 31 20 41  ol1 * 51 + - 1 A
22550 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
22560 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22570 31 33 32 35 0d 0a 35 30 39 0d 0a 36 36 32 0d 0a  1325..509..662..
22580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22590 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
225a0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col1 + + col2 * 
225b0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
225c0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
225d0 31 34 32 37 0d 0a 36 31 37 0d 0a 36 39 38 0d 0a  1427..617..698..
225e0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
225f0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
22600 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
22610 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
22620 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
22630 33 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  35..SELECT DISTI
22640 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20 35 32 20  NCT col0 + + 52 
22650 44 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  DIV - col2 FROM 
22660 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  tab0..----..-17.
22670 0a 32 33 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  .23..89....skipi
22680 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
22690 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
226a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
226b0 31 30 33 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  1035..SELECT DIS
226c0 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20 35  TINCT col0 + + 5
226d0 32 20 2f 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 / - col2 FROM 
226e0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  tab0..----..-17.
226f0 0a 32 33 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  .23..89....skipi
22700 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
22710 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
22720 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22730 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2d 20 63  T ALL CAST ( - c
22740 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ol0 AS REAL ) * 
22750 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
22760 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22770 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
22780 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22790 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
227a0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 28 20  INCT + col0 * ( 
227b0 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  + col0 ) * + col
227c0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
227d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d  or0..----..1323.
227e0 0a 31 35 38 31 38 34 0d 0a 32 33 37 31 35 38 0d  .158184..237158.
227f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
22800 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
22810 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
22820 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
22830 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
22840 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 33 38  wsort label-1038
22850 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
22860 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
22870 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
22880 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
22890 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
228a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
228b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
228c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
228d0 65 6c 2d 31 30 33 38 0d 0a 53 45 4c 45 43 54 20  el-1038..SELECT 
228e0 2d 20 63 6f 6c 30 20 2d 20 43 41 53 54 20 28 20  - col0 - CAST ( 
228f0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
22900 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
22910 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
22920 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
22930 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
22940 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 38 33 20 46  LL col2 + - 83 F
22950 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
22960 2d 31 0d 0a 2d 35 30 0d 0a 2d 38 32 0d 0a 0d 0a  -1..-50..-82....
22970 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22980 0a 53 45 4c 45 43 54 20 2b 20 33 39 20 2a 20 2b  .SELECT + 39 * +
22990 20 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   ( + col1 * col2
229a0 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
229b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 32 33  cor0..----..2223
229c0 30 0d 0a 34 38 36 37 32 0d 0a 35 34 37 35 36 0d  0..48672..54756.
229d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
229e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 39 20  rt..SELECT - 89 
229f0 2b 20 33 36 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  + 36 * cor0.col0
22a00 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
22a10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 0d 0a 32  r0..----..163..2
22a20 37 31 39 0d 0a 32 37 35 35 0d 0a 0d 0a 6f 6e 6c  719..2755....onl
22a30 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
22a40 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
22a50 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
22a60 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
22a70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
22a80 6c 61 62 65 6c 2d 31 30 34 32 0d 0a 53 45 4c 45  label-1042..SELE
22a90 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
22aa0 43 41 53 54 28 20 2b 20 34 39 20 41 53 20 53 49  CAST( + 49 AS SI
22ab0 47 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 2a 20  GNED ) + col2 * 
22ac0 2b 20 35 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 50 AS col1 FRO
22ad0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
22ae0 2d 2d 2d 2d 0d 0a 32 37 34 39 0d 0a 32 38 39 39  ----..2749..2899
22af0 0d 0a 34 38 34 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..4849....skipif
22b00 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
22b10 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
22b20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
22b30 30 34 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  042..SELECT DIST
22b40 49 4e 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20  INCT - - CAST ( 
22b50 2b 20 34 39 20 41 53 20 49 4e 54 45 47 45 52 20  + 49 AS INTEGER 
22b60 29 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 35 30 20  ) + col2 * + 50 
22b70 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22b80 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
22b90 0a 32 37 34 39 0d 0a 32 38 39 39 0d 0a 34 38 34  .2749..2899..484
22ba0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
22bb0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
22bc0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
22bd0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
22be0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
22bf0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
22c00 34 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  43..SELECT CAST(
22c10 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 63   tab2.col0 * - c
22c20 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
22c30 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  + + col2 AS col1
22c40 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
22c50 0d 0a 2d 31 36 32 0d 0a 2d 32 30 30 32 0d 0a 2d  ..-162..-2002..-
22c60 32 39 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2964....skipif m
22c70 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
22c80 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
22c90 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
22ca0 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  3..SELECT CAST (
22cb0 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 63   tab2.col0 * - c
22cc0 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
22cd0 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
22ce0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
22cf0 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30 30 32 0d 0a  -..-162..-2002..
22d00 2d 32 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -2964....query I
22d10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
22d20 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20   - ( - col2 ) * 
22d30 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col1 + - col2 FR
22d40 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
22d50 2d 2d 0d 0a 31 35 30 38 0d 0a 36 30 38 0d 0a 38  --..1508..608..8
22d60 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
22d70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
22d80 4c 20 2b 20 63 6f 6c 30 20 2b 20 31 30 20 2a 20  L + col0 + 10 * 
22d90 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
22da0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
22db0 0d 0a 2d 2d 2d 2d 0d 0a 33 35 34 0d 0a 34 35 0d  ..----..354..45.
22dc0 0a 39 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .909....query I 
22dd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22de0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  col1 + col1 * - 
22df0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
22e00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
22e10 2d 0d 0a 2d 32 37 32 0d 0a 2d 33 34 32 32 0d 0a  -..-272..-3422..
22e20 2d 39 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -930....onlyif m
22e30 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
22e40 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
22e50 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
22e60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22e70 62 65 6c 2d 31 30 34 37 0d 0a 53 45 4c 45 43 54  bel-1047..SELECT
22e80 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30   + col0 DIV col0
22e90 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   + - col2 * - co
22ea0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
22eb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
22ec0 2d 2d 0d 0a 31 34 34 35 0d 0a 36 37 37 0d 0a 37  --..1445..677..7
22ed0 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  30....skipif mys
22ee0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
22ef0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
22f00 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 37 0d  sort label-1047.
22f10 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f  .SELECT + col0 /
22f20 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
22f30 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
22f40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
22f50 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 35 0d 0a 36  0..----..1445..6
22f60 37 37 0d 0a 37 33 30 0d 0a 0d 0a 71 75 65 72 79  77..730....query
22f70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22f80 43 54 20 2d 20 38 35 20 2a 20 2b 20 31 37 20 46  CT - 85 * + 17 F
22f90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
22fa0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 35 0d 0a 2d  ..----..-1445..-
22fb0 31 34 34 35 0d 0a 2d 31 34 34 35 0d 0a 0d 0a 71  1445..-1445....q
22fc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22fd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22fe0 2b 20 37 37 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 77 AS col0 FRO
22ff0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
23000 2d 2d 2d 2d 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72  ----..77....quer
23010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23020 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 33 20  ECT DISTINCT 33 
23030 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
23040 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33  1 cor0..----..33
23050 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23060 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
23070 2b 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 63  + col2 * - ( + c
23080 6f 6c 31 20 29 20 2a 20 2b 20 28 20 2b 20 63 6f  ol1 ) * + ( + co
23090 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l0 ) FROM tab2 A
230a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
230b0 31 39 36 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d  19652..-51034..-
230c0 35 38 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5859....onlyif m
230d0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
230e0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
230f0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
23100 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
23110 62 65 6c 2d 31 30 35 32 0d 0a 53 45 4c 45 43 54  bel-1052..SELECT
23120 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f   - col1 DIV - co
23130 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
23140 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73  --..1..1..1....s
23150 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
23160 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
23170 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
23180 62 65 6c 2d 31 30 35 32 0d 0a 53 45 4c 45 43 54  bel-1052..SELECT
23190 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31   - col1 / - col1
231a0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
231b0 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65  ..1..1..1....que
231c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
231d0 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  LECT - + cor0.co
231e0 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  l1 * - col1 + - 
231f0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
23200 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
23210 2d 2d 2d 2d 0d 0a 37 33 37 32 0d 0a 38 31 39 32  ----..7372..8192
23220 0d 0a 39 33 37 34 0d 0a 0d 0a 71 75 65 72 79 20  ..9374....query 
23230 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23240 54 20 2d 20 34 38 20 46 52 4f 4d 20 74 61 62 32  T - 48 FROM tab2
23250 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23260 2d 34 38 0d 0a 2d 34 38 0d 0a 2d 34 38 0d 0a 0d  -48..-48..-48...
23270 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23280 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
23290 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 63   col1 + col1 + c
232a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
232b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d   cor0..----..26.
232c0 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79  .27..38....query
232d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
232e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
232f0 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f  l0 + col2 + + co
23300 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
23310 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d  cor0..----..-24.
23320 0a 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20  .51..7....query 
23330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23340 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
23350 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 34 33 20  2 + + col0 * 43 
23360 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
23370 2d 2d 2d 2d 0d 0a 31 30 36 35 0d 0a 31 35 30 36  ----..1065..1506
23380 0d 0a 33 39 30 39 0d 0a 0d 0a 71 75 65 72 79 20  ..3909....query 
23390 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
233a0 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2d  T ALL + + col2 -
233b0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
233c0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
233d0 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71  .-34..-7..9....q
233e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
233f0 53 45 4c 45 43 54 20 32 33 20 41 53 20 63 6f 6c  SELECT 23 AS col
23400 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
23410 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 32  or0..----..23..2
23420 33 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  3..23....query I
23430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23440 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 35 34 20 46   + + col0 - 54 F
23450 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
23460 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 33 30  ..----..-19..-30
23470 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..35....query I 
23480 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23490 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ALL + + col1 * +
234a0 20 39 33 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   93 FROM tab0 co
234b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 39 39 38 0d 0a  r0..----..7998..
234c0 38 34 36 33 0d 0a 39 30 32 31 0d 0a 0d 0a 71 75  8463..9021....qu
234d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
234e0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
234f0 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col1 + cor0.col
23500 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
23510 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  1 AS cor0, tab2 
23520 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
23530 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
23540 20 74 6f 20 63 37 38 34 30 38 64 39 30 63 34 65   to c78408d90c4e
23550 31 33 35 65 66 31 62 62 63 32 33 63 35 32 35 32  135ef1bbc23c5252
23560 63 64 31 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20  cd1d....query I 
23570 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23580 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
23590 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  1 * + cor0.col2 
235a0 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  + col2 + + col1 
235b0 2a 20 2b 20 39 20 2a 20 63 6f 6c 32 20 46 52 4f  * + 9 * col2 FRO
235c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
235d0 2d 2d 2d 2d 0d 0a 32 32 37 33 37 0d 0a 35 39 37  ----..22737..597
235e0 37 38 0d 0a 37 37 37 0d 0a 0d 0a 71 75 65 72 79  78..777....query
235f0 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
23600 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23610 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61   * FROM tab0, ta
23620 62 31 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  b1 cor0, tab2 AS
23630 20 63 6f 72 31 2c 20 74 61 62 32 2c 20 74 61 62   cor1, tab2, tab
23640 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  1 AS cor2..----.
23650 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61 73  .3645 values has
23660 68 69 6e 67 20 74 6f 20 38 64 34 64 31 33 66 36  hing to 8d4d13f6
23670 35 66 38 36 65 31 62 32 36 62 36 30 30 34 61 36  5f86e1b26b6004a6
23680 62 64 63 36 36 32 62 33 0d 0a 0d 0a 73 6b 69 70  bdc662b3....skip
23690 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
236a0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
236b0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
236c0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
236d0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
236e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
236f0 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   - + col1 + + co
23700 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
23710 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
23720 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a  .-24..19..62....
23730 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23740 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
23750 20 2b 20 35 37 20 2a 20 2b 20 63 6f 6c 30 20 46   + 57 * + col0 F
23760 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
23770 33 39 39 0d 0a 34 34 34 36 0d 0a 34 35 30 33 0d  399..4446..4503.
23780 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23790 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
237a0 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f   tab2.col1 AS co
237b0 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
237c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
237d0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
237e0 6e 67 20 74 6f 20 63 63 61 61 35 64 64 33 33 38  ng to ccaa5dd338
237f0 38 64 39 65 65 30 66 65 61 36 37 36 66 61 33 35  8d9ee0fea676fa35
23800 32 39 39 66 65 35 0d 0a 0d 0a 71 75 65 72 79 20  299fe5....query 
23810 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23820 54 20 44 49 53 54 49 4e 43 54 20 2d 20 35 32 20  T DISTINCT - 52 
23830 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52  * col0 + col0 FR
23840 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
23850 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 34 0d 0a 2d 31  .----..-1224..-1
23860 37 38 35 0d 0a 2d 34 35 33 39 0d 0a 0d 0a 71 75  785..-4539....qu
23870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23880 45 4c 45 43 54 20 41 4c 4c 20 37 39 20 41 53 20  ELECT ALL 79 AS 
23890 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
238a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
238b0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
238c0 68 69 6e 67 20 74 6f 20 34 30 61 32 32 36 31 63  hing to 40a2261c
238d0 61 61 32 63 35 63 64 62 66 64 38 30 39 36 35 64  aa2c5cdbfd80965d
238e0 37 64 66 31 32 33 31 66 0d 0a 0d 0a 71 75 65 72  7df1231f....quer
238f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23900 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32  ECT ALL - + col2
23910 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   * - col2 * - co
23920 6c 31 20 2b 20 2b 20 39 38 20 41 53 20 63 6f 6c  l1 + + 98 AS col
23930 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
23940 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 30  or0..----..-2250
23950 31 0d 0a 2d 32 34 34 35 30 0d 0a 2d 33 39 37 38  1..-24450..-3978
23960 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
23970 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
23980 20 37 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   78 AS col0 FROM
23990 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
239a0 2d 2d 2d 0d 0a 37 38 0d 0a 37 38 0d 0a 37 38 0d  ---..78..78..78.
239b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
239c0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
239d0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   - col1 + col2 *
239e0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
239f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23a00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 35 0d 0a  0..----..-1235..
23a10 2d 31 33 37 38 0d 0a 2d 35 36 30 0d 0a 0d 0a 71  -1378..-560....q
23a20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23a30 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
23a40 2b 20 34 35 20 46 52 4f 4d 20 74 61 62 32 20 63  + 45 FROM tab2 c
23a50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 30 0d  or0..----..1170.
23a60 0a 31 32 31 35 0d 0a 31 37 31 30 0d 0a 0d 0a 6f  .1215..1710....o
23a70 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
23a80 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
23a90 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
23aa0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
23ab0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 34 0d  sort label-1074.
23ac0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
23ad0 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 44   - col0 * col2 D
23ae0 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  IV + col2 FROM t
23af0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
23b00 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
23b10 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
23b20 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
23b30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23b40 61 62 65 6c 2d 31 30 37 34 0d 0a 53 45 4c 45 43  abel-1074..SELEC
23b50 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
23b60 30 20 2a 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c  0 * col2 / + col
23b70 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
23b80 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
23b90 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-80....skipif m
23ba0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
23bb0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
23bc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
23bd0 49 53 54 49 4e 43 54 20 2b 20 2b 20 43 41 53 54  ISTINCT + + CAST
23be0 20 28 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20   ( col2 AS REAL 
23bf0 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ) + - cor0.col1 
23c00 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  / col0 FROM tab0
23c10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23c20 2d 31 0d 0a 33 30 0d 0a 38 31 0d 0a 0d 0a 71 75  -1..30..81....qu
23c30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23c40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20  ELECT ALL + ( + 
23c50 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 2b 20  col1 ) * col2 + 
23c60 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
23c70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
23c80 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d  ----..1560..684.
23c90 0a 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .864....query I 
23ca0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23cb0 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20  - ( + col2 ) AS 
23cc0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
23cd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
23ce0 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71  4..-57..-96....q
23cf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23d00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23d10 2b 20 36 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  + 60 * + cor0.co
23d20 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l0 - - col0 FROM
23d30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23d40 2d 2d 2d 0d 0a 34 32 37 0d 0a 34 37 35 38 0d 0a  ---..427..4758..
23d50 34 38 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4819....onlyif m
23d60 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
23d70 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
23d80 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
23d90 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
23da0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
23db0 2d 31 30 37 39 0d 0a 53 45 4c 45 43 54 20 41 4c  -1079..SELECT AL
23dc0 4c 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  L - CAST( NULL A
23dd0 53 20 53 49 47 4e 45 44 20 29 20 2b 20 37 36 20  S SIGNED ) + 76 
23de0 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  * col1 FROM tab2
23df0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23e00 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
23e10 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23e20 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
23e30 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
23e40 72 74 20 6c 61 62 65 6c 2d 31 30 37 39 0d 0a 53  rt label-1079..S
23e50 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
23e60 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
23e70 45 52 20 29 20 2b 20 37 36 20 2a 20 63 6f 6c 31  ER ) + 76 * col1
23e80 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
23e90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
23ea0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
23eb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23ec0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
23ed0 20 2b 20 36 35 20 41 53 20 63 6f 6c 30 20 46 52   + 65 AS col0 FR
23ee0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
23ef0 2d 2d 0d 0a 2d 36 35 0d 0a 0d 0a 6f 6e 6c 79 69  --..-65....onlyi
23f00 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
23f10 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
23f20 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
23f30 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
23f40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
23f50 62 65 6c 2d 31 30 38 31 0d 0a 53 45 4c 45 43 54  bel-1081..SELECT
23f60 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 43 41   DISTINCT + - CA
23f70 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
23f80 45 44 20 29 20 2b 20 2d 20 39 33 20 41 53 20 63  ED ) + - 93 AS c
23f90 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
23fa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
23fb0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
23fc0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
23fd0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
23fe0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 31 0d 0a  ort label-1081..
23ff0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24000 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
24010 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
24020 20 39 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   93 AS col1 FROM
24030 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24040 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
24050 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
24060 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
24070 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
24080 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
24090 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
240a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
240b0 53 54 49 4e 43 54 20 2b 20 32 30 20 2a 20 63 6f  STINCT + 20 * co
240c0 6c 30 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46  l0 + col1 col2 F
240d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
240e0 0d 0a 2d 2d 2d 2d 0d 0a 31 38 37 31 0d 0a 35 36  ..----..1871..56
240f0 36 0d 0a 37 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  6..797....onlyif
24100 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
24110 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
24120 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
24130 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
24140 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
24150 65 6c 2d 31 30 38 33 0d 0a 53 45 4c 45 43 54 20  el-1083..SELECT 
24160 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
24170 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45   + col1 AS SIGNE
24180 44 20 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  D ) * - col0 AS 
24190 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
241a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d  or0..----..1343.
241b0 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 73 6b  .217..4602....sk
241c0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
241d0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
241e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
241f0 65 6c 2d 31 30 38 33 0d 0a 53 45 4c 45 43 54 20  el-1083..SELECT 
24200 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20  DISTINCT - CAST 
24210 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  ( + col1 AS INTE
24220 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 30 20 41  GER ) * - col0 A
24230 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
24240 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34   cor0..----..134
24250 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a  3..217..4602....
24260 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24270 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
24280 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a   - col2 + col1 *
24290 20 28 20 34 20 29 20 2b 20 63 6f 6c 30 20 41 53   ( 4 ) + col0 AS
242a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
242b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
242c0 36 0d 0a 34 37 0d 0a 35 33 0d 0a 0d 0a 71 75 65  6..47..53....que
242d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
242e0 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63  LECT ALL + ( - c
242f0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
24300 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
24310 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d  .----..-24..-35.
24320 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-89....query I 
24330 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24340 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 28 20  col2 - col1 * ( 
24350 2b 20 36 38 20 29 20 41 53 20 63 6f 6c 30 20 46  + 68 ) AS col0 F
24360 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24370 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 38 0d 0a 2d  ..----..-1118..-
24380 32 30 38 31 0d 0a 2d 33 39 38 36 0d 0a 0d 0a 71  2081..-3986....q
24390 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
243a0 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c  SELECT - ( - col
243b0 32 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  2 ) * - cor0.col
243c0 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 + col1 FROM ta
243d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
243e0 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37 0d 0a 36  ..-706..-7207..6
243f0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
24400 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
24410 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 46   col0 - + col1 F
24420 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24430 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d  ..----..-24..19.
24440 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .62....query I r
24450 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
24460 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31  ISTINCT + + col1
24470 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2d 20   * col1 + - ( - 
24480 63 6f 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63  cor0.col1 ) AS c
24490 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
244a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 36 0d 0a 33  r0..----..306..3
244b0 35 34 30 0d 0a 39 39 32 0d 0a 0d 0a 71 75 65 72  540..992....quer
244c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
244d0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
244e0 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   + - cor0.col2 +
244f0 20 2d 20 31 38 20 41 53 20 63 6f 6c 30 20 46 52   - 18 AS col0 FR
24500 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
24510 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 0d 0a 2d 31 33  .----..-122..-13
24520 35 0d 0a 2d 35 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  5..-52....onlyif
24530 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
24540 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
24550 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
24560 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24570 6c 61 62 65 6c 2d 31 30 39 31 0d 0a 53 45 4c 45  label-1091..SELE
24580 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2d  CT - cor0.col0 -
24590 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f   - col1 DIV + co
245a0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
245b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a  cor0..----..-3..
245c0 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70  -78..-79....skip
245d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
245e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
245f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
24600 2d 31 30 39 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1091..SELECT - 
24610 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f  cor0.col0 - - co
24620 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l1 / + col0 FROM
24630 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24640 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 37 38 0d 0a 2d 37  ---..-3..-78..-7
24650 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
24660 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
24670 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  TINCT - - col0 *
24680 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
24690 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
246a0 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d  ----..1120..704.
246b0 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .81....onlyif my
246c0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
246d0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
246e0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
246f0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
24700 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24710 31 30 39 33 0d 0a 53 45 4c 45 43 54 20 2b 20 35  1093..SELECT + 5
24720 35 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  5 - - cor0.col2 
24730 2a 20 2d 20 43 41 53 54 28 20 63 6f 6c 32 20 2b  * - CAST( col2 +
24740 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
24750 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  ) col1 FROM tab0
24760 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24770 2d 31 33 33 39 33 0d 0a 2d 32 31 32 33 0d 0a 35  -13393..-2123..5
24780 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
24790 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
247a0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
247b0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
247c0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
247d0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
247e0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
247f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
24800 65 6c 2d 31 30 39 33 0d 0a 53 45 4c 45 43 54 20  el-1093..SELECT 
24810 2b 20 35 35 20 2d 20 2d 20 63 6f 72 30 2e 63 6f  + 55 - - cor0.co
24820 6c 32 20 2a 20 2d 20 43 41 53 54 20 28 20 63 6f  l2 * - CAST ( co
24830 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54  l2 + col2 AS INT
24840 45 47 45 52 20 29 20 63 6f 6c 31 20 46 52 4f 4d  EGER ) col1 FROM
24850 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
24860 2d 2d 2d 0d 0a 2d 31 33 33 39 33 0d 0a 2d 32 31  ---..-13393..-21
24870 32 33 0d 0a 35 33 0d 0a 0d 0a 71 75 65 72 79 20  23..53....query 
24880 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24890 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
248a0 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  0 + + col0 + col
248b0 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  2 * col1 AS col0
248c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
248d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  r0..----..1534..
248e0 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72  646..837....quer
248f0 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49  y IIIIIIIIIIIIII
24900 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24910 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  T * FROM tab1, t
24920 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab1 AS cor0 CROS
24930 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62  S JOIN tab2, tab
24940 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20  2 AS cor1, tab0 
24950 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
24960 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
24970 6e 67 20 74 6f 20 37 36 64 65 31 38 63 35 62 66  ng to 76de18c5bf
24980 32 63 66 32 36 32 30 65 31 66 34 31 31 64 37 62  2cf2620e1f411d7b
24990 64 65 38 36 65 37 0d 0a 0d 0a 71 75 65 72 79 20  de86e7....query 
249a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
249b0 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  T - cor0.col0 * 
249c0 28 20 2b 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  ( + col2 ) + col
249d0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
249e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d  or0..----..-136.
249f0 0a 2d 33 36 33 38 0d 0a 2d 37 36 36 37 0d 0a 0d  .-3638..-7667...
24a00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24a10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
24a20 20 63 6f 6c 30 20 2a 20 2d 20 34 38 20 41 53 20   col0 * - 48 AS 
24a30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
24a40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
24a50 34 0d 0a 33 30 37 32 0d 0a 33 38 34 30 0d 0a 0d  4..3072..3840...
24a60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24a70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24a80 54 20 2d 20 63 6f 6c 31 20 2b 20 32 39 20 41 53  T - col1 + 29 AS
24a90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
24aa0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24ab0 36 0d 0a 31 39 0d 0a 33 0d 0a 0d 0a 71 75 65 72  6..19..3....quer
24ac0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24ad0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
24ae0 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 + cor0.col0 
24af0 2d 20 34 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 40 AS col2 FRO
24b00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
24b10 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 31 32 30 0d 0a  ----..-34..120..
24b20 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
24b30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
24b40 4c 20 38 39 20 41 53 20 63 6f 6c 31 20 46 52 4f  L 89 AS col1 FRO
24b50 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 39  M tab1..----..89
24b60 0d 0a 38 39 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72  ..89..89....quer
24b70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24b80 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
24b90 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20 63 6f   + col1 + - ( co
24ba0 6c 30 20 2a 20 38 38 20 29 20 41 53 20 63 6f 6c  l0 * 88 ) AS col
24bb0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
24bc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32 39  or0..----..-1529
24bd0 34 0d 0a 2d 33 31 37 37 0d 0a 2d 34 39 35 30 0d  4..-3177..-4950.
24be0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24bf0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24c00 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  NCT - col2 * - c
24c10 6f 6c 30 20 2b 20 2d 20 33 35 20 46 52 4f 4d 20  ol0 + - 35 FROM 
24c20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
24c30 2d 2d 0d 0a 31 32 37 0d 0a 33 36 31 33 0d 0a 37  --..127..3613..7
24c40 36 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  645....query I r
24c50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
24c60 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
24c70 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20   + ( - col0 ) * 
24c80 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
24c90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
24ca0 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32  ..----..2087..22
24cb0 30 0d 0a 33 30 31 39 0d 0a 0d 0a 71 75 65 72 79  0..3019....query
24cc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24cd0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20  CT ALL col1 * - 
24ce0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col1 + - col1 * 
24cf0 28 20 2b 20 36 30 20 29 20 41 53 20 63 6f 6c 31  ( + 60 ) AS col1
24d00 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
24d10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 35 36  r0..----..-12556
24d20 0d 0a 2d 31 33 37 34 31 0d 0a 2d 31 35 32 32 39  ..-13741..-15229
24d30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
24d40 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
24d50 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
24d60 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
24d70 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
24d80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24d90 4c 45 43 54 20 41 4c 4c 20 2d 20 38 39 20 2b 20  LECT ALL - 89 + 
24da0 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 63 6f 6c  - ( - col1 ) col
24db0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
24dc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 33 0d 0a  or0..----..-63..
24dd0 2d 37 36 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72  -76..-79....quer
24de0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24df0 45 43 54 20 34 32 20 2a 20 63 6f 72 30 2e 63 6f  ECT 42 * cor0.co
24e00 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 + col2 FROM t
24e10 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
24e20 2d 0d 0a 31 30 34 31 0d 0a 31 34 37 31 0d 0a 33  -..1041..1471..3
24e30 38 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  820....query I r
24e40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24e50 4c 4c 20 38 37 20 2b 20 63 6f 6c 32 20 46 52 4f  LL 87 + col2 FRO
24e60 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
24e70 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 31 34 0d 0a  ----..113..114..
24e80 31 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  125....query I r
24e90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24ea0 4c 4c 20 2d 20 39 35 20 2a 20 63 6f 6c 31 20 46  LL - 95 * col1 F
24eb0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24ec0 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 31 37 30 0d 0a 2d  ..----..-8170..-
24ed0 38 36 34 35 0d 0a 2d 39 32 31 35 0d 0a 0d 0a 71  8645..-9215....q
24ee0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24ef0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 37 30  SELECT col0 + 70
24f00 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
24f10 0d 0a 31 34 38 0d 0a 31 34 39 0d 0a 37 37 0d 0a  ..148..149..77..
24f20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24f30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31  t..SELECT + tab1
24f40 2e 63 6f 6c 31 20 2b 20 2d 20 28 20 2d 20 63 6f  .col1 + - ( - co
24f50 6c 32 20 2a 20 63 6f 6c 32 20 29 20 46 52 4f 4d  l2 * col2 ) FROM
24f60 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34   tab1..----..294
24f70 32 0d 0a 33 32 35 39 0d 0a 39 32 32 39 0d 0a 0d  2..3259..9229...
24f80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24f90 0d 0a 53 45 4c 45 43 54 20 2d 20 31 39 20 2a 20  ..SELECT - 19 * 
24fa0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
24fb0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
24fc0 2d 2d 2d 2d 0d 0a 2d 31 30 32 36 0d 0a 2d 31 30  ----..-1026..-10
24fd0 38 33 0d 0a 2d 31 38 32 34 0d 0a 0d 0a 71 75 65  83..-1824....que
24fe0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24ff0 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 31 38  LECT col0 * - 18
25000 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
25010 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
25020 0d 0a 2d 31 31 35 32 0d 0a 2d 31 34 34 30 0d 0a  ..-1152..-1440..
25030 2d 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -54....onlyif my
25040 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
25050 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
25060 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
25070 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
25080 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25090 31 31 31 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1113..SELECT - c
250a0 6f 6c 31 20 2a 20 43 41 53 54 28 20 2d 20 63 6f  ol1 * CAST( - co
250b0 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l2 AS SIGNED ) A
250c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
250d0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34  ..----..1534..64
250e0 36 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69 70 69 66  6..837....skipif
250f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
25100 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
25110 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
25120 31 31 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  113..SELECT - co
25130 6c 31 20 2a 20 43 41 53 54 20 28 20 2d 20 63 6f  l1 * CAST ( - co
25140 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l2 AS INTEGER ) 
25150 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25160 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36  2..----..1534..6
25170 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79  46..837....query
25180 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25190 43 54 20 41 4c 4c 20 31 30 20 41 53 20 63 6f 6c  CT ALL 10 AS col
251a0 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
251b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
251c0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
251d0 67 20 74 6f 20 61 34 37 31 39 34 34 32 39 66 33  g to a47194429f3
251e0 65 30 33 35 38 61 33 61 65 62 66 66 64 35 66 30  e0358a3aebffd5f0
251f0 35 30 31 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  50113....skipif 
25200 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
25210 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
25220 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
25230 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
25240 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25250 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63  t..SELECT tab2.c
25260 6f 6c 32 20 2b 20 2b 20 31 31 20 2a 20 2d 20 63  ol2 + + 11 * - c
25270 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
25280 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 30 0d 0a 2d  b2..----..-50..-
25290 38 33 31 0d 0a 2d 38 33 32 0d 0a 0d 0a 71 75 65  831..-832....que
252a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
252b0 4c 45 43 54 20 34 31 20 2a 20 33 20 46 52 4f 4d  LECT 41 * 3 FROM
252c0 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
252d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
252e0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32  ues hashing to 2
252f0 39 65 39 64 38 31 33 31 39 35 32 64 35 36 39 34  9e9d8131952d5694
25300 36 62 63 36 34 33 63 39 37 61 37 36 30 62 62 0d  6bc643c97a760bb.
25310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25320 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
25330 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  NCT + col2 * + c
25340 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 * col0 FROM 
25350 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33  tab2..----..1323
25360 0d 0a 31 35 38 31 38 34 0d 0a 32 33 37 31 35 38  ..158184..237158
25370 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25380 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
25390 34 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  43 AS col0 FROM 
253a0 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61 62 31  tab1, tab0, tab1
253b0 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31   cor0, tab0 cor1
253c0 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
253d0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 33 62  s hashing to 53b
253e0 32 66 31 33 39 61 30 37 66 38 35 36 61 63 34 34  2f139a07f856ac44
253f0 61 31 31 35 38 65 66 64 34 65 36 33 64 0d 0a 0d  a1158efd4e63d...
25400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25410 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
25420 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  + + col0 * col2 
25430 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
25440 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37  1..----..165..37
25450 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72  12..7760....quer
25460 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25470 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 30 20  ECT DISTINCT 50 
25480 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
25490 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  2, tab0 AS cor0.
254a0 0a 2d 2d 2d 2d 0d 0a 35 30 0d 0a 0d 0a 6f 6e 6c  .----..50....onl
254b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
254c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
254d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
254e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
254f0 72 74 20 6c 61 62 65 6c 2d 31 31 32 31 0d 0a 53  rt label-1121..S
25500 45 4c 45 43 54 20 2b 20 37 35 20 2b 20 2d 20 63  ELECT + 75 + - c
25510 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20 46  ol2 DIV - col1 F
25520 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
25530 37 35 0d 0a 37 35 0d 0a 37 37 0d 0a 0d 0a 73 6b  75..75..77....sk
25540 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
25550 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
25560 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25570 65 6c 2d 31 31 32 31 0d 0a 53 45 4c 45 43 54 20  el-1121..SELECT 
25580 2b 20 37 35 20 2b 20 2d 20 63 6f 6c 32 20 2f 20  + 75 + - col2 / 
25590 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
255a0 0d 0a 2d 2d 2d 2d 0d 0a 37 35 0d 0a 37 35 0d 0a  ..----..75..75..
255b0 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  77....query I ro
255c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
255d0 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  - ( col2 ) * col
255e0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
255f0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
25600 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d  -..-1248..-1404.
25610 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-570....query I
25620 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25630 20 2b 20 32 31 20 46 52 4f 4d 20 74 61 62 32 0d   + 21 FROM tab2.
25640 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 31 0d 0a 32  .----..21..21..2
25650 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
25660 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
25670 20 31 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   14 AS col1 FROM
25680 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d   tab1..----..14.
25690 0a 31 34 0d 0a 31 34 0d 0a 0d 0a 71 75 65 72 79  .14..14....query
256a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
256b0 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  CT - + cor0.col2
256c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
256d0 62 30 2c 20 74 61 62 32 2c 20 74 61 62 30 20 41  b0, tab2, tab0 A
256e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
256f0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
25700 74 6f 20 36 61 34 33 65 37 66 31 35 31 39 34 61  to 6a43e7f15194a
25710 66 37 33 66 65 31 63 38 33 33 38 35 65 36 65 62  f73fe1c83385e6eb
25720 65 62 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ebc....query I r
25730 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
25740 6f 6c 32 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20  ol2 * tab0.col0 
25750 2b 20 2b 20 39 36 20 2b 20 63 6f 6c 32 20 46 52  + + 96 + col2 FR
25760 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
25770 33 32 0d 0a 37 34 37 36 0d 0a 39 32 31 0d 0a 0d  32..7476..921...
25780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25790 0d 0a 53 45 4c 45 43 54 20 38 35 20 2b 20 2d 20  ..SELECT 85 + - 
257a0 31 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  15 AS col0 FROM 
257b0 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30 2c  tab1, tab0 cor0,
257c0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
257d0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
257e0 61 73 68 69 6e 67 20 74 6f 20 63 37 36 31 35 37  ashing to c76157
257f0 61 37 61 37 65 63 31 38 64 65 35 36 38 32 33 62  a7a7ec18de56823b
25800 32 30 35 38 62 34 39 66 33 32 0d 0a 0d 0a 73 6b  2058b49f32....sk
25810 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
25820 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
25830 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
25840 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
25850 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
25860 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
25870 4c 4c 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63  LL col2 + tab0.c
25880 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 30 20 29  ol2 * + ( col0 )
25890 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
258a0 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d  .----..36..7380.
258b0 0a 38 32 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .825....onlyif m
258c0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
258d0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
258e0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
258f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25900 62 65 6c 2d 31 31 32 39 0d 0a 53 45 4c 45 43 54  bel-1129..SELECT
25910 20 63 6f 6c 32 20 44 49 56 20 32 20 46 52 4f 4d   col2 DIV 2 FROM
25920 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
25930 2d 2d 2d 0d 0a 30 0d 0a 31 36 0d 0a 34 31 0d 0a  ---..0..16..41..
25940 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
25950 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
25960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25970 20 6c 61 62 65 6c 2d 31 31 32 39 0d 0a 53 45 4c   label-1129..SEL
25980 45 43 54 20 63 6f 6c 32 20 2f 20 32 20 46 52 4f  ECT col2 / 2 FRO
25990 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
259a0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 36 0d 0a 34 31 0d  ----..0..16..41.
259b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
259c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
259d0 32 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  2 - - col1 FROM 
259e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d  tab1..----..109.
259f0 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .67..80....query
25a00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25a10 43 54 20 44 49 53 54 49 4e 43 54 20 39 38 20 2a  CT DISTINCT 98 *
25a20 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 33 33 20   tab2.col0 * 33 
25a30 2b 20 2b 20 32 33 20 46 52 4f 4d 20 74 61 62 32  + + 23 FROM tab2
25a40 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 36 31 0d 0a 32  ..----..22661..2
25a50 35 32 32 37 35 0d 0a 32 35 35 35 30 39 0d 0a 0d  52275..255509...
25a60 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
25a70 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
25a80 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
25a90 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
25aa0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33  owsort label-113
25ab0 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
25ac0 43 54 20 2b 20 36 37 20 44 49 56 20 74 61 62 32  CT + 67 DIV tab2
25ad0 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20  .col1 + col1 AS 
25ae0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
25af0 2d 2d 2d 2d 0d 0a 32 30 0d 0a 33 33 0d 0a 36 30  ----..20..33..60
25b00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
25b10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
25b20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
25b30 72 74 20 6c 61 62 65 6c 2d 31 31 33 32 0d 0a 53  rt label-1132..S
25b40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
25b50 20 36 37 20 2f 20 74 61 62 32 2e 63 6f 6c 31 20   67 / tab2.col1 
25b60 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
25b70 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
25b80 32 30 0d 0a 33 33 0d 0a 36 30 0d 0a 0d 0a 71 75  20..33..60....qu
25b90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25ba0 45 4c 45 43 54 20 31 30 20 2a 20 2d 20 63 6f 6c  ELECT 10 * - col
25bb0 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 * col0 AS col1
25bc0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
25bd0 0d 0a 2d 31 33 34 33 30 0d 0a 2d 32 31 37 30 0d  ..-13430..-2170.
25be0 0a 2d 34 36 30 32 30 0d 0a 0d 0a 71 75 65 72 79  .-46020....query
25bf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25c00 43 54 20 44 49 53 54 49 4e 43 54 20 37 35 20 2a  CT DISTINCT 75 *
25c10 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20 63   tab0.col2 + + c
25c20 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20  ol0 * tab0.col0 
25c30 2b 20 2b 20 63 6f 6c 32 20 2a 20 35 35 20 2a 20  + + col2 * 55 * 
25c40 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
25c50 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 35 37 34 39 0d  ..----..-355749.
25c60 0a 2d 35 36 38 34 34 0d 0a 31 32 34 35 0d 0a 0d  .-56844..1245...
25c70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25c80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
25c90 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63   cor0.col0 * - c
25ca0 6f 6c 32 20 2b 20 2b 20 39 32 20 2b 20 63 6f 6c  ol2 + + 92 + col
25cb0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
25cc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  or0..----..162..
25cd0 37 34 37 39 0d 0a 39 30 38 0d 0a 0d 0a 71 75 65  7479..908....que
25ce0 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
25cf0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
25d00 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 41  CT * FROM tab0 A
25d10 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
25d20 4e 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  N tab2, tab2 AS 
25d30 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f  cor1, tab0 AS co
25d40 72 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 33  r2, tab2 AS cor3
25d50 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
25d60 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64  ues hashing to d
25d70 37 35 32 61 33 38 66 66 34 32 62 30 36 37 65 65  752a38ff42b067ee
25d80 64 64 31 32 61 64 36 63 33 66 39 33 36 35 65 0d  dd12ad6c3f9365e.
25d90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25da0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
25db0 6f 6c 30 20 2a 20 2d 20 37 39 20 2b 20 2b 20 63  ol0 * - 79 + + c
25dc0 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 * - cor0.col
25dd0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
25de0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
25df0 2d 0d 0a 2d 31 33 36 30 0d 0a 31 34 30 38 0d 0a  -..-1360..1408..
25e00 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
25e10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
25e20 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20  STINCT col1 + - 
25e30 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  ( col2 ) AS col1
25e40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
25e50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d  r0..----..53..9.
25e60 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
25e70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
25e80 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 28 20  LL + - col1 * ( 
25e90 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30  col1 ) FROM tab0
25ea0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25eb0 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39  -7396..-8281..-9
25ec0 34 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  409....skipif my
25ed0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
25ee0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
25ef0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
25f00 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
25f10 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 52  CAST ( col1 AS R
25f20 45 41 4c 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f  EAL ) * col0 FRO
25f30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
25f40 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33 32 39 38  ----..1978..3298
25f50 0d 0a 38 30 30 38 0d 0a 0d 0a 73 6b 69 70 69 66  ..8008....skipif
25f60 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
25f70 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
25f80 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
25f90 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
25fa0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
25fb0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
25fc0 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 31  ol0 * - ( + col1
25fd0 20 29 20 2a 20 63 6f 6c 32 20 63 6f 6c 32 20 46   ) * col2 col2 F
25fe0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
25ff0 2d 33 36 34 38 30 0d 0a 2d 34 32 31 32 0d 0a 2d  -36480..-4212..-
26000 39 39 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  99840....query I
26010 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26020 20 41 4c 4c 20 2b 20 37 37 20 46 52 4f 4d 20 74   ALL + 77 FROM t
26030 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
26040 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63  S JOIN tab1 AS c
26050 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
26060 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
26070 35 31 62 66 31 30 63 35 30 65 30 36 31 64 37 34  51bf10c50e061d74
26080 61 64 30 61 34 64 32 30 35 61 31 63 36 32 32 0d  ad0a4d205a1c622.
26090 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
260a0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
260b0 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol2 * col1 + + c
260c0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  ol1 * - col2 AS 
260d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
260e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
260f0 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..0....onlyif 
26100 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
26110 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
26120 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
26130 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26140 61 62 65 6c 2d 31 31 34 34 0d 0a 53 45 4c 45 43  abel-1144..SELEC
26150 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
26160 32 20 44 49 56 20 2d 20 28 20 2b 20 39 33 20 29  2 DIV - ( + 93 )
26170 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
26180 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
26190 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
261a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
261b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
261c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 34  wsort label-1144
261d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
261e0 54 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 28 20 2b  T + col2 / - ( +
261f0 20 39 33 20 29 20 41 53 20 63 6f 6c 32 20 46 52   93 ) AS col2 FR
26200 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26210 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .----..0....skip
26220 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
26230 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
26240 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
26250 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
26260 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
26270 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
26280 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
26290 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
262a0 6c 30 20 2b 20 2b 20 43 41 53 54 20 28 20 2b 20  l0 + + CAST ( + 
262b0 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 63  col0 AS REAL ) c
262c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
262d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38   cor0..----..178
262e0 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72  ..48..70....quer
262f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26300 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b  ECT ALL - col1 +
26310 20 35 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53   57 FROM tab1 AS
26320 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d   cor0..----..31.
26330 0a 34 34 0d 0a 34 37 0d 0a 0d 0a 71 75 65 72 79  .44..47....query
26340 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26350 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20  CT ALL col1 * - 
26360 33 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  37 AS col0 FROM 
26370 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
26380 2d 2d 0d 0a 2d 33 31 38 32 0d 0a 2d 33 33 36 37  --..-3182..-3367
26390 0d 0a 2d 33 35 38 39 0d 0a 0d 0a 73 6b 69 70 69  ..-3589....skipi
263a0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
263b0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
263c0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
263d0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
263e0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
263f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
26400 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  + col2 * - col2 
26410 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
26420 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
26430 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d  444..-676..-729.
26440 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26450 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33  rt..SELECT - - 3
26460 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
26470 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26480 2d 0d 0a 33 39 0d 0a 33 39 0d 0a 33 39 0d 0a 0d  -..39..39..39...
26490 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
264a0 0d 0a 53 45 4c 45 43 54 20 2d 20 36 32 20 41 53  ..SELECT - 62 AS
264b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
264c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
264d0 36 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a  62..-62..-62....
264e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
264f0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
26500 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41   + col1 + col2 A
26510 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
26520 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26530 31 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d  1344..1458..627.
26540 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
26550 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
26560 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
26570 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
26580 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26590 31 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  152..SELECT ALL 
265a0 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  - col2 + + cor0.
265b0 63 6f 6c 31 20 44 49 56 20 2b 20 31 31 20 2d 20  col1 DIV + 11 - 
265c0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
265d0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
265e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 36 0d 0a 2d 33  ..----..-116..-3
265f0 32 0d 0a 2d 39 39 0d 0a 0d 0a 73 6b 69 70 69 66  2..-99....skipif
26600 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
26610 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
26620 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26630 31 35 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  152..SELECT ALL 
26640 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  - col2 + + cor0.
26650 63 6f 6c 31 20 2f 20 2b 20 31 31 20 2d 20 2b 20  col1 / + 11 - + 
26660 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
26670 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
26680 2d 2d 2d 2d 0d 0a 2d 31 31 36 0d 0a 2d 33 32 0d  ----..-116..-32.
26690 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-99....query I 
266a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
266b0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
266c0 2b 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  + + ( - cor0.col
266d0 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
266e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
266f0 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32  ---..-24..19..62
26700 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26710 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
26720 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  + col0 + + col2 
26730 2b 20 2d 20 35 20 2a 20 2d 20 63 6f 6c 32 20 46  + - 5 * - col2 F
26740 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
26750 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 0d 0a 32 33 34  ..----..169..234
26760 0d 0a 33 30 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..307....skipif 
26770 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
26780 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
26790 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
267a0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
267b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
267c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
267d0 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 36 35  CT + col2 * + 65
267e0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63   + + cor0.col0 c
267f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
26800 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 32  r0..----..100..2
26810 31 36 39 0d 0a 35 34 31 39 0d 0a 0d 0a 71 75 65  169..5419....que
26820 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26830 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  LECT - col1 * co
26840 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 * col1 FROM t
26850 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
26860 2d 0d 0a 2d 31 30 39 38 32 0d 0a 2d 32 35 39 34  -..-10982..-2594
26870 37 0d 0a 2d 39 30 35 30 36 0d 0a 0d 0a 71 75 65  7..-90506....que
26880 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26890 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
268a0 63 6f 6c 31 20 2a 20 2d 20 36 37 20 2d 20 2d 20  col1 * - 67 - - 
268b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
268c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
268d0 37 33 39 0d 0a 2d 36 30 36 0d 0a 2d 37 39 31 0d  739..-606..-791.
268e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
268f0 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63  rt..SELECT ( + c
26900 6f 6c 31 20 29 20 2a 20 2b 20 39 31 20 41 53 20  ol1 ) * + 91 AS 
26910 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
26920 2d 2d 2d 2d 0d 0a 37 38 32 36 0d 0a 38 32 38 31  ----..7826..8281
26930 0d 0a 38 38 32 37 0d 0a 0d 0a 71 75 65 72 79 20  ..8827....query 
26940 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26950 54 20 2b 20 28 20 2d 20 39 32 20 29 20 41 53 20  T + ( - 92 ) AS 
26960 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
26970 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
26980 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
26990 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
269a0 69 6e 67 20 74 6f 20 61 30 65 36 62 37 36 32 32  ing to a0e6b7622
269b0 37 64 38 37 30 64 31 30 63 34 64 39 66 34 36 35  7d870d10c4d9f465
269c0 34 35 61 37 63 38 33 0d 0a 0d 0a 6f 6e 6c 79 69  45a7c83....onlyi
269d0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
269e0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
269f0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
26a00 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
26a10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
26a20 62 65 6c 2d 31 31 36 30 0d 0a 53 45 4c 45 43 54  bel-1160..SELECT
26a30 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29   + ( cor0.col0 )
26a40 20 2a 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20   * col1 + CAST( 
26a50 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
26a60 20 2b 20 2d 20 37 30 20 46 52 4f 4d 20 74 61 62   + - 70 FROM tab
26a70 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
26a80 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
26a90 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
26aa0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
26ab0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
26ac0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 30 0d 0a  ort label-1160..
26ad0 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 72 30 2e  SELECT + ( cor0.
26ae0 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2b 20  col0 ) * col1 + 
26af0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
26b00 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 37 30 20  NTEGER ) + - 70 
26b10 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
26b20 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
26b30 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
26b40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26b50 4c 45 43 54 20 32 32 20 2a 20 63 6f 6c 32 20 46  LECT 22 * col2 F
26b60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26b70 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 0d 0a 31 32  ..----..1188..12
26b80 35 34 0d 0a 32 31 31 32 0d 0a 0d 0a 6f 6e 6c 79  54..2112....only
26b90 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
26ba0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
26bb0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
26bc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26bd0 74 20 6c 61 62 65 6c 2d 31 31 36 32 0d 0a 53 45  t label-1162..SE
26be0 4c 45 43 54 20 2d 20 35 36 20 2b 20 2b 20 35 36  LECT - 56 + + 56
26bf0 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74   DIV col0 FROM t
26c00 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
26c10 2d 0d 0a 2d 33 38 0d 0a 2d 35 36 0d 0a 2d 35 36  -..-38..-56..-56
26c20 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
26c30 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
26c40 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
26c50 72 74 20 6c 61 62 65 6c 2d 31 31 36 32 0d 0a 53  rt label-1162..S
26c60 45 4c 45 43 54 20 2d 20 35 36 20 2b 20 2b 20 35  ELECT - 56 + + 5
26c70 36 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  6 / col0 FROM ta
26c80 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
26c90 0d 0a 2d 33 38 0d 0a 2d 35 36 0d 0a 2d 35 36 0d  ..-38..-56..-56.
26ca0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26cb0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
26cc0 31 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  1 - + col1 FROM 
26cd0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
26ce0 0a 2d 31 31 38 0d 0a 2d 33 34 0d 0a 2d 36 32 0d  .-118..-34..-62.
26cf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26d00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
26d10 31 20 2a 20 2b 20 38 31 20 2b 20 63 6f 6c 31 20  1 * + 81 + col1 
26d20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
26d30 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
26d40 0a 2d 31 30 34 30 0d 0a 2d 32 30 38 30 0d 0a 2d  .-1040..-2080..-
26d50 38 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  800....query I r
26d60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
26d70 20 63 6f 6c 30 20 2a 20 2b 20 38 39 20 2a 20 63   col0 * + 89 * c
26d80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
26d90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor0..----..364
26da0 35 34 34 0d 0a 35 36 39 36 30 30 0d 0a 38 30 31  544..569600..801
26db0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26dc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 31 20 2a  ort..SELECT 31 *
26dd0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
26de0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
26df0 38 32 39 0d 0a 35 32 37 0d 0a 39 36 31 0d 0a 0d  829..527..961...
26e00 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
26e10 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
26e20 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
26e30 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
26e40 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
26e50 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 37 0d 0a  ort label-1167..
26e60 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26e70 2b 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28  + col2 * - CAST(
26e80 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
26e90 20 29 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20   ) + + ( col0 ) 
26ea0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
26eb0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
26ec0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26ed0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26ee0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
26ef0 36 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  67..SELECT DISTI
26f00 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 43  NCT + col2 * - C
26f10 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
26f20 41 4c 20 29 20 2b 20 2b 20 28 20 63 6f 6c 30 20  AL ) + + ( col0 
26f30 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
26f40 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
26f50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26f60 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63 6f  CT ALL + tab0.co
26f70 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63  l1 + + col1 AS c
26f80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
26f90 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a 31  ---..172..182..1
26fa0 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
26fb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
26fc0 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30  STINCT cor0.col0
26fd0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
26fe0 62 32 2c 20 74 61 62 31 2c 20 74 61 62 31 20 41  b2, tab1, tab1 A
26ff0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  S cor0..----..3.
27000 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .64..80....query
27010 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27020 43 54 20 41 4c 4c 20 2b 20 2d 20 38 36 20 41 53  CT ALL + - 86 AS
27030 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
27040 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
27050 38 36 0d 0a 2d 38 36 0d 0a 2d 38 36 0d 0a 0d 0a  86..-86..-86....
27060 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27070 0a 53 45 4c 45 43 54 20 2d 20 39 20 2a 20 2b 20  .SELECT - 9 * + 
27080 63 6f 6c 31 20 2a 20 39 36 20 2b 20 63 6f 6c 32  col1 * 96 + col2
27090 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
270a0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
270b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 33  or0..----..-1533
270c0 34 0d 0a 2d 32 37 36 32 31 0d 0a 2d 35 32 35 31  4..-27621..-5251
270d0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
270e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
270f0 54 49 4e 43 54 20 2d 20 35 37 20 41 53 20 63 6f  TINCT - 57 AS co
27100 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
27110 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
27120 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
27130 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
27140 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  L cor0.col2 * - 
27150 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col0 * + col0 FR
27160 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
27170 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 31  .----..-1225..-1
27180 39 30 30 38 0d 0a 2d 36 34 39 35 32 32 0d 0a 0d  9008..-649522...
27190 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
271a0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
271b0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 41 53  col0 + + col1 AS
271c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
271d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
271e0 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d  150..3492..8190.
271f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
27200 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
27210 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
27220 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
27230 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
27240 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 35  wsort label-1175
27250 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
27260 54 28 20 2d 20 63 6f 6c 31 20 41 53 20 53 49 47  T( - col1 AS SIG
27270 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
27280 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
27290 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
272a0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
272b0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
272c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
272d0 61 62 65 6c 2d 31 31 37 35 0d 0a 53 45 4c 45 43  abel-1175..SELEC
272e0 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2d 20 63  T ALL CAST ( - c
272f0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
27300 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
27310 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d  b1..----..-10..-
27320 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79  13..-26....query
27330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27340 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  CT + col2 * col1
27350 20 2d 20 34 33 20 41 53 20 63 6f 6c 30 20 46 52   - 43 AS col0 FR
27360 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
27370 0a 2d 2d 2d 2d 0d 0a 32 37 39 35 0d 0a 35 34 0d  .----..2795..54.
27380 0a 37 34 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .7419....query I
27390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
273a0 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   - - cor0.col0 +
273b0 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2d 20 63 6f   col1 + - ( - co
273c0 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  l2 * + col0 + co
273d0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l1 ) FROM tab1 A
273e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
273f0 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d  5..3712..7760...
27400 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
27410 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
27420 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
27430 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
27440 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37  owsort label-117
27450 38 0d 0a 53 45 4c 45 43 54 20 2b 20 32 38 20 44  8..SELECT + 28 D
27460 49 56 20 2b 20 32 30 20 46 52 4f 4d 20 74 61 62  IV + 20 FROM tab
27470 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31  2..----..1..1..1
27480 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
27490 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
274a0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
274b0 72 74 20 6c 61 62 65 6c 2d 31 31 37 38 0d 0a 53  rt label-1178..S
274c0 45 4c 45 43 54 20 2b 20 32 38 20 2f 20 2b 20 32  ELECT + 28 / + 2
274d0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
274e0 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75  -..1..1..1....qu
274f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27500 45 4c 45 43 54 20 41 4c 4c 20 36 20 41 53 20 63  ELECT ALL 6 AS c
27510 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
27520 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
27530 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
27540 69 6e 67 20 74 6f 20 35 64 31 63 62 39 30 65 64  ing to 5d1cb90ed
27550 35 38 66 61 37 35 37 33 38 39 35 64 32 66 39 35  58fa7573895d2f95
27560 62 32 31 31 38 32 31 0d 0a 0d 0a 71 75 65 72 79  b211821....query
27570 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27580 43 54 20 2b 20 2b 20 35 36 20 41 53 20 63 6f 6c  CT + + 56 AS col
27590 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
275a0 30 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61  0, tab0 cor0, ta
275b0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c  b1..----..81 val
275c0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
275d0 63 65 65 39 31 63 61 39 63 36 30 62 61 36 65 34  cee91ca9c60ba6e4
275e0 35 61 33 33 62 33 38 38 61 33 62 37 64 39 62 0d  5a33b388a3b7d9b.
275f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27600 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
27610 20 2d 20 39 33 20 46 52 4f 4d 20 74 61 62 31 20   - 93 FROM tab1 
27620 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 33 0d  cor0..----..-93.
27630 0a 2d 39 33 0d 0a 2d 39 33 0d 0a 0d 0a 6f 6e 6c  .-93..-93....onl
27640 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
27650 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
27660 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
27670 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
27680 72 74 20 6c 61 62 65 6c 2d 31 31 38 32 0d 0a 53  rt label-1182..S
27690 45 4c 45 43 54 20 2d 20 2b 20 39 33 20 44 49 56  ELECT - + 93 DIV
276a0 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31   - col0 - - col1
276b0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
276c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
276d0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 34 31 0d 0a 37  0..----..2841..7
276e0 34 36 33 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69  463..99....skipi
276f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
27700 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
27710 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
27720 31 31 38 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  1182..SELECT - +
27730 20 39 33 20 2f 20 2d 20 63 6f 6c 30 20 2d 20 2d   93 / - col0 - -
27740 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20   col1 * col2 AS 
27750 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
27760 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
27770 34 31 0d 0a 37 34 36 33 0d 0a 39 39 0d 0a 0d 0a  41..7463..99....
27780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27790 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
277a0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 31 38 20   cor0.col2 + 18 
277b0 2b 20 2b 20 31 33 20 41 53 20 63 6f 6c 31 20 46  + + 13 AS col1 F
277c0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
277d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 38 35 0d 0a 2d  ..----..-2885..-
277e0 33 32 31 38 0d 0a 2d 39 31 38 35 0d 0a 0d 0a 71  3218..-9185....q
277f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27800 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27810 35 38 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30  58 * - tab2.col0
27820 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2d   + + tab2.col0 -
27830 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
27840 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
27850 0a 2d 34 30 36 0d 0a 2d 34 35 32 34 0d 0a 2d 34  .-406..-4524..-4
27860 35 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  582....query I r
27870 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
27880 4c 4c 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 41  LL col1 - col2 A
27890 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
278a0 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39  ..----..53..9..9
278b0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
278c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34  sort..SELECT + 4
278d0 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  6 AS col0 FROM t
278e0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 36 0d 0a 34  ab1..----..46..4
278f0 36 0d 0a 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49  6..46....query I
27900 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
27910 20 2b 20 32 35 20 2a 20 63 6f 6c 30 20 41 53 20   + 25 * col0 AS 
27920 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
27930 2d 2d 2d 2d 0d 0a 32 32 32 35 0d 0a 36 30 30 0d  ----..2225..600.
27940 0a 38 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .875....query I 
27950 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27960 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20  col1 * - col1 * 
27970 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
27980 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 30 36 38 0d  ..----..-244068.
27990 0a 2d 36 37 39 30 34 32 0d 0a 2d 39 34 30 39 0d  .-679042..-9409.
279a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
279b0 72 74 0d 0a 53 45 4c 45 43 54 20 36 31 20 41 53  rt..SELECT 61 AS
279c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
279d0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
279e0 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
279f0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
27a00 68 69 6e 67 20 74 6f 20 30 37 31 34 39 39 30 35  hing to 07149905
27a10 61 37 32 62 64 38 37 35 35 33 33 38 31 66 33 34  a72bd87553381f34
27a20 64 31 39 65 64 32 39 30 0d 0a 0d 0a 73 6b 69 70  d19ed290....skip
27a30 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
27a40 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
27a50 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
27a60 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
27a70 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
27a80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
27a90 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 63 6f 6c   - tab0.col1 col
27aa0 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
27ab0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
27ac0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
27ad0 67 20 74 6f 20 35 38 65 64 34 36 37 61 39 61 33  g to 58ed467a9a3
27ae0 33 32 65 34 64 37 62 66 61 61 39 61 62 64 62 62  32e4d7bfaa9abdbb
27af0 64 30 36 33 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  d063f....onlyif 
27b00 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
27b10 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
27b20 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
27b30 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
27b40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
27b50 6c 2d 31 31 39 31 0d 0a 53 45 4c 45 43 54 20 44  l-1191..SELECT D
27b60 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d  ISTINCT col1 + -
27b70 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55   col0 * CAST( NU
27b80 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
27b90 20 36 37 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   67 FROM tab1..-
27ba0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
27bb0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
27bc0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
27bd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
27be0 6c 2d 31 31 39 31 0d 0a 53 45 4c 45 43 54 20 44  l-1191..SELECT D
27bf0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d  ISTINCT col1 + -
27c00 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e   col0 * CAST ( N
27c10 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
27c20 20 2b 20 36 37 20 46 52 4f 4d 20 74 61 62 31 0d   + 67 FROM tab1.
27c30 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
27c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27c50 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e  SELECT + - cor0.
27c60 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col0 + cor0.col1
27c70 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
27c80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d  r0..----..-54..-
27c90 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79 20  67..23....query 
27ca0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27cb0 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2d  T ALL - col0 + -
27cc0 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 63   col0 * col1 * c
27cd0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
27ce0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
27cf0 2d 2d 2d 0d 0a 2d 31 31 38 38 36 30 0d 0a 2d 34  ---..-118860..-4
27d00 39 35 36 30 0d 0a 2d 37 32 30 39 30 30 0d 0a 0d  9560..-720900...
27d10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27d20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
27d30 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  T col2 + + cor0.
27d40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
27d50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
27d60 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72  4..2..66....quer
27d70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27d80 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31  ECT ALL - - col1
27d90 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
27da0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  1 cor0..----..10
27db0 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71  0..169..676....q
27dc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27dd0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
27de0 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  0 * cor0.col1 AS
27df0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
27e00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  cor0..----..-104
27e10 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a  0..-640..-78....
27e20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27e30 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
27e40 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 + + col2 FRO
27e50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27e60 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31 34 0d 0a  ----..108..114..
27e70 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  192....query I r
27e80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
27e90 20 63 6f 6c 30 20 2d 20 74 61 62 30 2e 63 6f 6c   col0 - tab0.col
27ea0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
27eb0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
27ec0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27ed0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 31 31 20  ELECT col1 * 11 
27ee0 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  + - col2 * cor0.
27ef0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
27f00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
27f10 35 39 0d 0a 2d 34 39 36 0d 0a 2d 38 38 35 0d 0a  59..-496..-885..
27f20 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
27f30 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
27f40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
27f50 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f  OM tab0, tab2 co
27f60 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
27f70 2c 20 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72  , tab1, tab0 cor
27f80 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61  2..----..3645 va
27f90 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
27fa0 33 62 34 35 38 37 61 62 36 63 30 38 64 32 31 37  3b4587ab6c08d217
27fb0 39 63 36 64 66 30 39 34 64 32 66 37 36 61 64 37  9c6df094d2f76ad7
27fc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27fd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 38 31  ort..SELECT ( 81
27fe0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72   ) FROM tab0 cor
27ff0 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 0d 0a 38 31 0d  0..----..81..81.
28000 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .81....query I r
28010 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
28020 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 37 32 20   cor0.col2 + 72 
28030 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
28040 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 35  0..----..105..15
28050 34 0d 0a 37 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..73....onlyif 
28060 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
28070 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
28080 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
28090 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
280a0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
280b0 6c 2d 31 32 30 33 0d 0a 53 45 4c 45 43 54 20 41  l-1203..SELECT A
280c0 4c 4c 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  LL + CAST( NULL 
280d0 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 32 35  AS SIGNED ) + 25
280e0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
280f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28100 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
28110 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
28120 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
28130 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
28140 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28150 6c 2d 31 32 30 33 0d 0a 53 45 4c 45 43 54 20 41  l-1203..SELECT A
28160 4c 4c 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  LL + CAST ( NULL
28170 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
28180 32 35 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  25 * col2 AS col
28190 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
281a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
281b0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
281c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
281d0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 28  SELECT ALL - ( (
281e0 20 2d 20 63 6f 6c 31 20 29 20 29 20 46 52 4f 4d   - col1 ) ) FROM
281f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
28200 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
28210 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28220 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
28230 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d  ol0 + + col1 + -
28240 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
28250 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 37 37 0d 0a  .----..131..77..
28260 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
28270 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
28280 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 33 20 2a 20  r0.col0 * - 3 * 
28290 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
282a0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
282b0 2d 2d 2d 2d 0d 0a 2d 31 32 32 38 38 0d 0a 2d 31  ----..-12288..-1
282c0 39 32 30 30 0d 0a 2d 32 37 0d 0a 0d 0a 71 75 65  9200..-27....que
282d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
282e0 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
282f0 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l0 * col2 AS col
28300 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
28310 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32  ..----..189..202
28320 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79  8..3002....query
28330 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28340 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT - cor0.col2 *
28350 20 37 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   77 AS col2 FROM
28360 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
28370 0d 0a 2d 34 31 35 38 0d 0a 2d 34 33 38 39 0d 0a  ..-4158..-4389..
28380 2d 37 33 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -7392....query I
28390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
283a0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b   - col1 + col0 +
283b0 20 28 20 2b 20 33 30 20 2b 20 2b 20 63 6f 6c 31   ( + 30 + + col1
283c0 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
283d0 2d 2d 0d 0a 31 31 30 0d 0a 33 33 0d 0a 39 34 0d  --..110..33..94.
283e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
283f0 72 74 0d 0a 53 45 4c 45 43 54 20 39 30 20 2a 20  rt..SELECT 90 * 
28400 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  + col1 + + col0 
28410 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
28420 0a 31 32 35 30 0d 0a 32 33 34 33 0d 0a 39 36 34  .1250..2343..964
28430 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
28440 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
28450 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
28460 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
28470 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
28480 31 32 31 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1211..SELECT col
28490 32 20 2b 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c  2 + col0 * ( col
284a0 31 20 29 20 44 49 56 20 28 20 63 6f 6c 30 20 29  1 ) DIV ( col0 )
284b0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
284c0 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a  ..55..58..85....
284d0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
284e0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
284f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28500 61 62 65 6c 2d 31 32 31 31 0d 0a 53 45 4c 45 43  abel-1211..SELEC
28510 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  T col2 + col0 * 
28520 28 20 63 6f 6c 31 20 29 20 2f 20 28 20 63 6f 6c  ( col1 ) / ( col
28530 30 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  0 ) FROM tab2..-
28540 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d  ---..55..58..85.
28550 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28560 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
28570 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  NCT + col2 * + c
28580 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
28590 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
285a0 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a  ---..1444..676..
285b0 37 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  729....skipif po
285c0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
285d0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
285e0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
285f0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
28600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28610 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31  .SELECT - - col1
28620 20 2a 20 32 34 20 63 6f 6c 31 20 46 52 4f 4d 20   * 24 col1 FROM 
28630 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
28640 2d 2d 0d 0a 32 34 30 0d 0a 33 31 32 0d 0a 36 32  --..240..312..62
28650 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
28660 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
28670 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
28680 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
28690 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
286a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
286b0 31 34 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  14..SELECT col2 
286c0 2a 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41  * CAST( + col2 A
286d0 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
286e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
286f0 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37  --..1444..676..7
28700 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  29....skipif mys
28710 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
28720 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
28730 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 34 0d  sort label-1214.
28740 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 43  .SELECT col2 * C
28750 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
28760 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
28770 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28780 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32  -..1444..676..72
28790 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
287a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
287b0 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  TINCT + col2 * +
287c0 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
287d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
287e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a  cor0..----..35..
287f0 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 6f 6e 6c  7298..792....onl
28800 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
28810 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
28820 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
28830 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
28840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28850 6c 61 62 65 6c 2d 31 32 31 36 0d 0a 53 45 4c 45  label-1216..SELE
28860 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
28870 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 28 20 4e  col0 + - CAST( N
28880 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
28890 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
288a0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
288b0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
288c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
288d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
288e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
288f0 31 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  16..SELECT DISTI
28900 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d  NCT + + col0 + -
28910 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
28920 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
28930 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
28940 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
28950 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28960 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
28970 20 63 6f 6c 32 20 2b 20 36 35 20 46 52 4f 4d 20   col2 + 65 FROM 
28980 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
28990 2d 2d 0d 0a 31 30 33 0d 0a 39 31 0d 0a 39 32 0d  --..103..91..92.
289a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
289b0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
289c0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 + - col0 AS 
289d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
289e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
289f0 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
28a00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28a10 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   ALL col0 + - co
28a20 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63  l2 + - col2 AS c
28a30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
28a40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
28a50 35 0d 0a 2d 31 31 32 0d 0a 2d 35 30 0d 0a 0d 0a  5..-112..-50....
28a60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28a70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
28a80 20 63 6f 6c 31 20 2d 20 28 20 2b 20 63 6f 6c 30   col1 - ( + col0
28a90 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f   ) * - col1 * co
28aa0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
28ab0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
28ac0 0a 33 34 39 32 0d 0a 36 36 34 32 30 39 0d 0a 36  .3492..664209..6
28ad0 38 31 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8198....query I 
28ae0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28af0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
28b00 2d 20 38 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53  - 81 * - col2 AS
28b10 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
28b20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
28b30 31 38 34 0d 0a 32 31 39 34 0d 0a 33 31 35 37 0d  184..2194..3157.
28b40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28b50 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
28b60 30 20 2b 20 2b 20 32 33 20 2a 20 63 6f 6c 32 20  0 + + 23 * col2 
28b70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28b80 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 39 0d 0a 31  0..----..1239..1
28b90 32 34 37 0d 0a 32 31 32 38 0d 0a 0d 0a 6f 6e 6c  247..2128....onl
28ba0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
28bb0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
28bc0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
28bd0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
28be0 72 74 20 6c 61 62 65 6c 2d 31 32 32 33 0d 0a 53  rt label-1223..S
28bf0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a  ELECT ALL col0 *
28c00 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b   - cor0.col0 + +
28c10 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 44   col2 + + col0 D
28c20 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  IV + col1 AS col
28c30 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
28c40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a  or0..----..-22..
28c50 2d 36 30 35 37 0d 0a 2d 36 31 39 39 0d 0a 0d 0a  -6057..-6199....
28c60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
28c70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
28c80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28c90 61 62 65 6c 2d 31 32 32 33 0d 0a 53 45 4c 45 43  abel-1223..SELEC
28ca0 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 63  T ALL col0 * - c
28cb0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  or0.col0 + + col
28cc0 32 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63  2 + + col0 / + c
28cd0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
28ce0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
28cf0 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 36 30 35 37 0d  ---..-22..-6057.
28d00 0a 2d 36 31 39 39 0d 0a 0d 0a 71 75 65 72 79 20  .-6199....query 
28d10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28d20 54 20 2b 20 28 20 2d 20 36 34 20 29 20 2b 20 2b  T + ( - 64 ) + +
28d30 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63   col1 * col0 + c
28d40 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
28d50 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37   tab1..----..107
28d60 32 0d 0a 36 33 33 0d 0a 36 38 0d 0a 0d 0a 6f 6e  2..633..68....on
28d70 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
28d80 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
28d90 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
28da0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
28db0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 35 0d 0a  ort label-1225..
28dc0 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f  SELECT + tab0.co
28dd0 6c 30 20 44 49 56 20 2b 20 35 33 20 63 6f 6c 31  l0 DIV + 53 col1
28de0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
28df0 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..0..0..1....ski
28e00 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
28e10 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
28e20 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
28e30 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
28e40 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
28e50 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
28e60 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
28e70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 35 0d  sort label-1225.
28e80 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
28e90 6f 6c 30 20 2f 20 2b 20 35 33 20 63 6f 6c 31 20  ol0 / + 53 col1 
28ea0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
28eb0 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .0..0..1....quer
28ec0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28ed0 45 43 54 20 2b 20 35 34 20 2a 20 2d 20 74 61 62  ECT + 54 * - tab
28ee0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
28ef0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 34 34 0d 0a 2d  ..----..-4644..-
28f00 34 39 31 34 0d 0a 2d 35 32 33 38 0d 0a 0d 0a 71  4914..-5238....q
28f10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28f20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28f30 28 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c  ( col2 ) + - col
28f40 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  0 + col0 * col0 
28f50 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
28f60 0a 31 31 39 31 0d 0a 35 38 35 0d 0a 37 39 31 34  .1191..585..7914
28f70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28f80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
28f90 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b  .col1 * - col0 +
28fa0 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32   - col0 - + col2
28fb0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
28fc0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
28fd0 0d 0a 2d 31 32 31 36 0d 0a 2d 31 33 35 0d 0a 2d  ..-1216..-135..-
28fe0 37 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  761....query I r
28ff0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
29000 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 2b 20  ISTINCT - + ( + 
29010 28 20 2b 20 63 6f 6c 32 20 29 20 29 20 2b 20 2d  ( + col2 ) ) + -
29020 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a   ( cor0.col0 ) *
29030 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
29040 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
29050 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33 31 0d 0a 33  0..----..2031..3
29060 33 39 34 0d 0a 38 30 31 37 0d 0a 0d 0a 71 75 65  394..8017....que
29070 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29080 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
29090 32 32 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  22 * col2 * col2
290a0 20 2b 20 38 20 2a 20 39 39 20 2b 20 2d 20 63 6f   + 8 * 99 + - co
290b0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
290c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 32 32 35  0..----..-147225
290d0 0d 0a 2d 32 33 31 39 30 0d 0a 37 33 35 0d 0a 0d  ..-23190..735...
290e0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
290f0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
29100 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
29110 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
29120 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
29130 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 31 0d 0a  ort label-1231..
29140 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 2d  SELECT + CAST( -
29150 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 53 49   cor0.col0 AS SI
29160 47 4e 45 44 20 29 20 2b 20 63 6f 72 30 2e 63 6f  GNED ) + cor0.co
29170 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
29180 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  cor0..----..-7..
29190 31 36 0d 0a 35 31 0d 0a 0d 0a 73 6b 69 70 69 66  16..51....skipif
291a0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
291b0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
291c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
291d0 32 33 31 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  231..SELECT + CA
291e0 53 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  ST ( - cor0.col0
291f0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
29200 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
29210 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
29220 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d  -..-7..16..51...
29230 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
29240 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
29250 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
29260 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
29270 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
29280 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 32 0d 0a  ort label-1232..
29290 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28  SELECT ALL CAST(
292a0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
292b0 29 20 2a 20 33 36 20 2b 20 63 6f 6c 31 20 41 53  ) * 36 + col1 AS
292c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
292d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
292e0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
292f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
29300 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
29310 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29320 74 20 6c 61 62 65 6c 2d 31 32 33 32 0d 0a 53 45  t label-1232..SE
29330 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20  LECT ALL CAST ( 
29340 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
29350 29 20 2a 20 33 36 20 2b 20 63 6f 6c 31 20 41 53  ) * 36 + col1 AS
29360 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
29370 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
29380 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
29390 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
293a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28  rt..SELECT - - (
293b0 20 2b 20 35 33 20 29 20 2b 20 2b 20 63 6f 6c 30   + 53 ) + + col0
293c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
293d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d 0a 37  r0..----..142..7
293e0 37 0d 0a 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..88....onlyif 
293f0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
29400 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
29410 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
29420 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
29430 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29440 6c 2d 31 32 33 34 0d 0a 53 45 4c 45 43 54 20 41  l-1234..SELECT A
29450 4c 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  LL CAST( NULL AS
29460 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f   SIGNED ) + - co
29470 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
29480 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
29490 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
294a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
294b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
294c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
294d0 6c 2d 31 32 33 34 0d 0a 53 45 4c 45 43 54 20 41  l-1234..SELECT A
294e0 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  LL CAST ( NULL A
294f0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20  S INTEGER ) + - 
29500 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
29510 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
29520 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
29530 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29540 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 37 20  SELECT ALL - 77 
29550 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
29560 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
29570 34 32 0d 0a 2d 35 33 0d 0a 31 32 0d 0a 0d 0a 71  42..-53..12....q
29580 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29590 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
295a0 2b 20 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f 6c  + col0 + ( - col
295b0 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  1 ) FROM tab0 AS
295c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
295d0 0a 2d 36 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-62....onlyif m
295e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
295f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
29600 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
29610 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29620 62 65 6c 2d 31 32 33 37 0d 0a 53 45 4c 45 43 54  bel-1237..SELECT
29630 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   + col1 * + col2
29640 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
29650 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  ab0..----..86..9
29660 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..97....skipif 
29670 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
29680 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
29690 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
296a0 33 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  37..SELECT + col
296b0 31 20 2a 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c  1 * + col2 / col
296c0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
296d0 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..86..91..97...
296e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
296f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
29700 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d  T - ( col0 ) * -
29710 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
29720 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d  cor0..----..162.
29730 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71  .3648..7680....q
29740 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29750 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
29760 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 31 39  col1 * col0 + 19
29770 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
29780 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 30 0d 0a  r0..----..2050..
29790 33 34 31 33 0d 0a 38 30 33 36 0d 0a 0d 0a 71 75  3413..8036....qu
297a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
297b0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20  ELECT ALL + - ( 
297c0 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46  col0 ) AS col1 F
297d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
297e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
297f0 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-80....query I 
29800 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29810 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
29820 63 6f 6c 30 20 2a 20 2b 20 33 37 20 46 52 4f 4d  col0 * + 37 FROM
29830 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29840 2d 2d 2d 0d 0a 31 31 31 0d 0a 32 33 36 38 0d 0a  ---..111..2368..
29850 32 39 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2960....onlyif m
29860 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
29870 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
29880 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
29890 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
298a0 62 65 6c 2d 31 32 34 32 0d 0a 53 45 4c 45 43 54  bel-1242..SELECT
298b0 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   + - col0 + - co
298c0 6c 31 20 2a 20 31 34 20 44 49 56 20 2d 20 63 6f  l1 * 14 DIV - co
298d0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
298e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
298f0 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36 35 0d 0a 37 0d  --..-64..-65..7.
29900 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
29910 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
29920 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29930 74 20 6c 61 62 65 6c 2d 31 32 34 32 0d 0a 53 45  t label-1242..SE
29940 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  LECT + - col0 + 
29950 2d 20 63 6f 6c 31 20 2a 20 31 34 20 2f 20 2d 20  - col1 * 14 / - 
29960 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
29970 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
29980 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36 35 0d 0a  ----..-64..-65..
29990 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
299a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
299b0 54 49 4e 43 54 20 31 33 20 2a 20 63 6f 6c 30 20  TINCT 13 * col0 
299c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
299d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
299e0 0a 31 30 34 30 0d 0a 33 39 0d 0a 38 33 32 0d 0a  .1040..39..832..
299f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29a00 74 0d 0a 53 45 4c 45 43 54 20 31 30 20 2a 20 2d  t..SELECT 10 * -
29a10 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
29a20 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
29a30 31 37 30 0d 0a 2d 33 31 30 0d 0a 2d 35 39 30 0d  170..-310..-590.
29a40 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
29a50 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
29a60 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
29a70 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
29a80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29a90 32 34 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  245..SELECT + - 
29aa0 63 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f  col2 DIV cor0.co
29ab0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
29ac0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor0..----..-2..
29ad0 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
29ae0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29af0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
29b00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34  owsort label-124
29b10 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  5..SELECT + - co
29b20 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 46  l2 / cor0.col1 F
29b30 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
29b40 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30  ..----..-2..0..0
29b50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29b60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
29b70 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col1 + - col1 * 
29b80 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
29b90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
29ba0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d 32  ..----..-194..-2
29bb0 39 32 34 0d 0a 2d 37 35 35 33 0d 0a 0d 0a 71 75  924..-7553....qu
29bc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29bd0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
29be0 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53   + ( - col0 ) AS
29bf0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
29c00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  cor0..----..-7..
29c10 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79  -78..-79....only
29c20 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
29c30 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
29c40 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
29c50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29c60 74 20 6c 61 62 65 6c 2d 31 32 34 38 0d 0a 53 45  t label-1248..SE
29c70 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  LECT + - col0 * 
29c80 63 6f 6c 30 20 2b 20 2b 20 32 34 20 44 49 56 20  col0 + + 24 DIV 
29c90 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
29ca0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29cb0 2d 0d 0a 2d 34 36 0d 0a 2d 36 30 38 34 0d 0a 2d  -..-46..-6084..-
29cc0 36 32 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  6241....skipif m
29cd0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29ce0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
29cf0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34  owsort label-124
29d00 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  8..SELECT + - co
29d10 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 32 34  l0 * col0 + + 24
29d20 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   / cor0.col0 FRO
29d30 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
29d40 2d 2d 2d 2d 0d 0a 2d 34 36 0d 0a 2d 36 30 38 34  ----..-46..-6084
29d50 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79  ..-6241....query
29d60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29d70 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c  CT ALL - ( + col
29d80 32 20 29 20 2a 20 2d 20 35 37 20 2b 20 63 6f 6c  2 ) * - 57 + col
29d90 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
29da0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29db0 2d 0d 0a 31 35 30 38 0d 0a 31 35 36 36 0d 0a 32  -..1508..1566..2
29dc0 32 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  204....query I r
29dd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
29de0 49 53 54 49 4e 43 54 20 2b 20 36 30 20 2a 20 63  ISTINCT + 60 * c
29df0 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d  ol2 - - col2 * -
29e00 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
29e10 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
29e20 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
29e30 2d 2d 2d 0d 0a 32 34 32 31 39 0d 0a 32 36 38 32  ---..24219..2682
29e40 38 0d 0a 34 31 34 34 34 0d 0a 0d 0a 71 75 65 72  8..41444....quer
29e50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29e60 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
29e70 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 * + col1 AS 
29e80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
29e90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
29ea0 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a  040..-640..-78..
29eb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29ec0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 34 32  t..SELECT - + 42
29ed0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
29ee0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
29ef0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 37  0..----..-18..-7
29f00 0d 0a 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..47....query I 
29f10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29f20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
29f30 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20  * col0 - col2 * 
29f40 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  - col2 * col1 AS
29f50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
29f60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
29f70 33 32 32 0d 0a 36 31 39 38 30 35 0d 0a 39 34 32  322..619805..942
29f80 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  30....skipif pos
29f90 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
29fa0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
29fb0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
29fc0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
29fd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29fe0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20  SELECT col1 + + 
29ff0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  cor0.col1 * col0
2a000 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c   * cor0.col1 col
2a010 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
2a020 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 33 33 0d 0a 32  ..----..13533..2
2a030 30 35 34 0d 0a 36 34 31 30 0d 0a 0d 0a 71 75 65  054..6410....que
2a040 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a050 4c 45 43 54 20 2d 20 31 32 20 2b 20 63 6f 6c 31  LECT - 12 + col1
2a060 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2a070 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2a080 0d 0a 37 34 0d 0a 37 39 0d 0a 38 35 0d 0a 0d 0a  ..74..79..85....
2a090 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a0a0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
2a0b0 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   - + col0 FROM t
2a0c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2a0d0 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d  -..-34..-7..9...
2a0e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a0f0 0d 0a 53 45 4c 45 43 54 20 35 38 20 2b 20 63 6f  ..SELECT 58 + co
2a100 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2a110 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2a120 2d 2d 0d 0a 36 38 0d 0a 37 31 0d 0a 38 34 0d 0a  --..68..71..84..
2a130 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a140 74 0d 0a 53 45 4c 45 43 54 20 31 32 20 2a 20 63  t..SELECT 12 * c
2a150 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  or0.col2 + col2 
2a160 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2a170 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 38 0d 0a 33 35  0..----..338..35
2a180 31 0d 0a 34 39 34 0d 0a 0d 0a 71 75 65 72 79 20  1..494....query 
2a190 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a1a0 54 20 2d 20 34 31 20 41 53 20 63 6f 6c 31 20 46  T - 41 AS col1 F
2a1b0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a1c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 34 31  ..----..-41..-41
2a1d0 0d 0a 2d 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-41....query I
2a1e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a1f0 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 34 37 20 2a   - - col0 + 47 *
2a200 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
2a210 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2a220 0a 34 30 36 36 0d 0a 34 33 36 36 0d 0a 34 35 39  .4066..4366..459
2a230 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2a240 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
2a250 32 2e 63 6f 6c 30 20 2b 20 2d 20 39 37 20 2a 20  2.col0 + - 97 * 
2a260 34 34 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  44 FROM tab2, ta
2a270 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2a280 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2a290 6e 67 20 74 6f 20 39 37 66 30 39 62 64 65 37 39  ng to 97f09bde79
2a2a0 39 32 31 39 62 34 64 64 37 63 38 31 64 38 37 34  9219b4dd7c81d874
2a2b0 33 33 62 66 66 38 0d 0a 0d 0a 71 75 65 72 79 20  33bff8....query 
2a2c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a2d0 54 20 63 6f 6c 30 20 2b 20 2d 20 35 34 20 46 52  T col0 + - 54 FR
2a2e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2a2f0 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 33 30 0d  .----..-19..-30.
2a300 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .35....query I r
2a310 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2a320 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63  ol1 * - col1 * c
2a330 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2a340 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a350 2d 2d 2d 0d 0a 2d 36 33 36 30 35 36 0d 0a 2d 37  ---..-636056..-7
2a360 35 33 35 37 31 0d 0a 2d 39 31 32 36 37 33 0d 0a  53571..-912673..
2a370 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2a380 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2a390 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2a3a0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2a3b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2a3c0 36 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  64..SELECT ALL -
2a3d0 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 63   cor0.col2 DIV c
2a3e0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 2d  ol1 + + col1 - -
2a3f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2a400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d  cor0..----..172.
2a410 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 73 6b 69  .182..194....ski
2a420 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2a430 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2a440 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2a450 6c 2d 31 32 36 34 0d 0a 53 45 4c 45 43 54 20 41  l-1264..SELECT A
2a460 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f  LL - cor0.col2 /
2a470 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2d   col1 + + col1 -
2a480 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2a490 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  0 cor0..----..17
2a4a0 32 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71  2..182..194....q
2a4b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a4c0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63  SELECT ALL - + c
2a4d0 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d  ol1 - + col1 * -
2a4e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2a4f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2a500 0a 2d 2d 2d 2d 0d 0a 31 34 37 35 0d 0a 36 32 39  .----..1475..629
2a510 0d 0a 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..806....query I
2a520 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a530 20 44 49 53 54 49 4e 43 54 20 2b 20 34 36 20 2a   DISTINCT + 46 *
2a540 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 41   col0 + - col1 A
2a550 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2a560 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a570 32 39 31 0d 0a 33 35 32 39 0d 0a 33 36 31 37 0d  291..3529..3617.
2a580 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a590 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
2a5a0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63  ol1 * - col0 * c
2a5b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2a5c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
2a5d0 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39  652..51034..5859
2a5e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a5f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a600 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a610 72 74 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  rt..SELECT CAST 
2a620 28 20 38 37 20 41 53 20 52 45 41 4c 20 29 20 46  ( 87 AS REAL ) F
2a630 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2a640 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 38 37 0d 0a  ..----..87..87..
2a650 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
2a660 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2a670 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  L col2 + - col1 
2a680 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2a690 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34  2..----..-33..-4
2a6a0 0d 0a 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..21....skipif p
2a6b0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2a6c0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2a6d0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2a6e0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2a6f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a700 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
2a710 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
2a720 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a  ab1, tab0 cor0..
2a730 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2a740 61 73 68 69 6e 67 20 74 6f 20 38 62 34 39 37 39  ashing to 8b4979
2a750 39 39 34 32 61 39 65 33 35 33 61 33 64 32 37 39  9942a9e353a3d279
2a760 63 66 36 34 65 66 33 66 36 33 0d 0a 0d 0a 6f 6e  cf64ef3f63....on
2a770 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2a780 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2a790 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2a7a0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2a7b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a7c0 20 6c 61 62 65 6c 2d 31 32 37 31 0d 0a 53 45 4c   label-1271..SEL
2a7d0 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ECT + col1 * + c
2a7e0 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53 54 28  or0.col2 + CAST(
2a7f0 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53   - ( + col2 ) AS
2a800 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
2a810 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2a820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 35 0d  or0..----..2805.
2a830 0a 37 33 38 30 0d 0a 39 36 0d 0a 0d 0a 73 6b 69  .7380..96....ski
2a840 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2a850 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2a860 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2a870 6c 2d 31 32 37 31 0d 0a 53 45 4c 45 43 54 20 2b  l-1271..SELECT +
2a880 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63   col1 * + cor0.c
2a890 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 2d 20 28  ol2 + CAST ( - (
2a8a0 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 49 4e 54   + col2 ) AS INT
2a8b0 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46  EGER ) AS col1 F
2a8c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a8d0 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 35 0d 0a 37 33  ..----..2805..73
2a8e0 38 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  80..96....query 
2a8f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a900 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  T cor0.col2 + + 
2a910 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  tab0.col0 * + co
2a920 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  r0.col1 AS col1 
2a930 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
2a940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
2a950 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2a960 74 6f 20 61 38 36 33 35 36 31 62 38 34 37 32 39  to a863561b84729
2a970 31 37 30 32 31 63 35 38 33 65 38 65 65 36 63 38  17021c583e8ee6c8
2a980 39 33 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  93f....query I r
2a990 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2a9a0 49 53 54 49 4e 43 54 20 2d 20 37 38 20 2a 20 63  ISTINCT - 78 * c
2a9b0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol2 + - col2 FRO
2a9c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2a9d0 2d 2d 2d 2d 0d 0a 2d 32 30 35 34 0d 0a 2d 32 31  ----..-2054..-21
2a9e0 33 33 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65  33..-3002....que
2a9f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2aa00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2aa10 63 6f 72 31 2e 63 6f 6c 32 20 2a 20 39 31 20 46  cor1.col2 * 91 F
2aa20 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
2aa30 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20  S cor0, tab1 AS 
2aa40 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 34 39 31 34  cor1..----..4914
2aa50 0d 0a 35 31 38 37 0d 0a 38 37 33 36 0d 0a 0d 0a  ..5187..8736....
2aa60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2aa70 0a 53 45 4c 45 43 54 20 38 34 20 46 52 4f 4d 20  .SELECT 84 FROM 
2aa80 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 30  tab1, tab2, tab0
2aa90 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 0d 0a   AS cor0, tab0..
2aaa0 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20  ----..81 values 
2aab0 68 61 73 68 69 6e 67 20 74 6f 20 33 63 30 39 32  hashing to 3c092
2aac0 65 64 31 61 39 39 64 64 62 35 61 66 63 37 30 34  ed1a99ddb5afc704
2aad0 39 66 64 32 62 39 34 32 37 66 39 0d 0a 0d 0a 6f  9fd2b9427f9....o
2aae0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2aaf0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2ab00 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2ab10 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2ab20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ab30 74 20 6c 61 62 65 6c 2d 31 32 37 36 0d 0a 53 45  t label-1276..SE
2ab40 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  LECT + CAST( NUL
2ab50 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  L AS SIGNED ) * 
2ab60 2d 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63  - tab2.col0 AS c
2ab70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
2ab80 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2ab90 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
2aba0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2abb0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2abc0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2abd0 37 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  76..SELECT + CAS
2abe0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
2abf0 47 45 52 20 29 20 2a 20 2d 20 74 61 62 32 2e 63  GER ) * - tab2.c
2ac00 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2ac10 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
2ac20 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2ac30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ac40 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
2ac50 32 20 2b 20 2d 20 36 32 20 46 52 4f 4d 20 74 61  2 + - 62 FROM ta
2ac60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2ac70 0d 0a 2d 35 0d 0a 2d 38 0d 0a 33 34 0d 0a 0d 0a  ..-5..-8..34....
2ac80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2ac90 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2aca0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2acb0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2acc0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2acd0 72 74 20 6c 61 62 65 6c 2d 31 32 37 38 0d 0a 53  rt label-1278..S
2ace0 45 4c 45 43 54 20 43 41 53 54 28 20 2d 20 31 30  ELECT CAST( - 10
2acf0 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
2ad00 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2ad10 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 30 0d 0a  ----..-10..-10..
2ad20 2d 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -10....skipif my
2ad30 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2ad40 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2ad50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 38  wsort label-1278
2ad60 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
2ad70 2d 20 31 30 20 41 53 20 49 4e 54 45 47 45 52 20  - 10 AS INTEGER 
2ad80 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
2ad90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a  or0..----..-10..
2ada0 2d 31 30 0d 0a 2d 31 30 0d 0a 0d 0a 71 75 65 72  -10..-10....quer
2adb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2adc0 45 43 54 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a  ECT ( + col0 ) *
2add0 20 63 6f 6c 30 20 2b 20 2d 20 28 20 63 6f 72 30   col0 + - ( cor0
2ade0 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20  .col2 ) AS col2 
2adf0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2ae00 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 36 30 35  0..----..22..605
2ae10 38 0d 0a 36 32 30 33 0d 0a 0d 0a 71 75 65 72 79  8..6203....query
2ae20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ae30 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 39  CT DISTINCT - 79
2ae40 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2ae50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2ae60 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-79....query I
2ae70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ae80 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b   + col1 * col2 +
2ae90 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
2aea0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2aeb0 0a 2d 2d 2d 2d 0d 0a 31 35 39 33 0d 0a 36 36 33  .----..1593..663
2aec0 0d 0a 38 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..868....query I
2aed0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2aee0 20 44 49 53 54 49 4e 43 54 20 74 61 62 31 2e 63   DISTINCT tab1.c
2aef0 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2af00 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
2af10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
2af20 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  3..26....query I
2af30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2af40 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f   DISTINCT - ( co
2af50 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
2af60 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab2..----..-7
2af70 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75  ..-78..-79....qu
2af80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2af90 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63  ELECT col2 * + c
2afa0 6f 6c 32 20 2a 20 2b 20 31 33 20 2d 20 2d 20 28  ol2 * + 13 - - (
2afb0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
2afc0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2afd0 0a 31 31 39 39 30 34 0d 0a 33 37 39 36 32 0d 0a  .119904..37962..
2afe0 34 32 32 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  42294....query I
2aff0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b000 20 2d 20 2b 20 34 37 20 2b 20 63 6f 6c 32 20 2a   - + 47 + col2 *
2b010 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
2b020 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b030 0a 2d 2d 2d 2d 0d 0a 31 32 30 31 0d 0a 31 33 35  .----..1201..135
2b040 37 0d 0a 35 32 33 0d 0a 0d 0a 71 75 65 72 79 20  7..523....query 
2b050 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b060 54 20 2b 20 36 38 20 46 52 4f 4d 20 74 61 62 31  T + 68 FROM tab1
2b070 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  , tab0, tab0 AS 
2b080 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
2b090 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2b0a0 20 31 30 61 61 32 35 66 31 63 36 62 39 37 35 38   10aa25f1c6b9758
2b0b0 32 63 33 34 35 32 31 61 63 36 34 35 32 65 30 62  2c34521ac6452e0b
2b0c0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2b0d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
2b0e0 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d   col0 * col1 + -
2b0f0 20 36 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53   69 FROM tab0 AS
2b100 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 39   cor0..----..199
2b110 35 0d 0a 33 33 32 36 0d 0a 38 30 33 30 0d 0a 0d  5..3326..8030...
2b120 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2b130 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2b140 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2b150 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2b160 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2b170 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 38 0d 0a  ort label-1288..
2b180 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
2b190 63 6f 6c 31 20 2f 20 2d 20 43 41 53 54 28 20 4e  col1 / - CAST( N
2b1a0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
2b1b0 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  - col0 * - col1 
2b1c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2b1d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2b1e0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
2b1f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
2b200 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2b210 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2b220 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 38 0d 0a  ort label-1288..
2b230 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
2b240 63 6f 6c 31 20 2f 20 2d 20 43 41 53 54 20 28 20  col1 / - CAST ( 
2b250 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
2b260 29 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ) - col0 * - col
2b270 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2b280 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2b290 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2b2a0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ULL....skipif po
2b2b0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2b2c0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2b2d0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2b2e0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2b2f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b300 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d  .SELECT col1 * -
2b310 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 63   col2 - + col1 c
2b320 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2b330 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
2b340 36 31 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38 30 0d  61..-1430..-580.
2b350 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b360 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
2b370 32 20 2b 20 35 39 20 2d 20 63 6f 6c 31 20 2a 20  2 + 59 - col1 * 
2b380 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
2b390 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b3a0 32 30 39 30 0d 0a 33 34 35 33 0d 0a 38 30 37 36  2090..3453..8076
2b3b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b3c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2b3d0 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 - col1 AS col
2b3e0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2b3f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  or0..----..-20..
2b400 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72  -26..-52....quer
2b410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b420 45 43 54 20 41 4c 4c 20 37 34 20 2a 20 63 6f 6c  ECT ALL 74 * col
2b430 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2b440 2d 0d 0a 33 39 39 36 0d 0a 34 32 31 38 0d 0a 37  -..3996..4218..7
2b450 31 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  104....query I r
2b460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2b470 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
2b480 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  1 * col0 + col2 
2b490 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
2b4a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b4b0 31 34 36 30 0d 0a 32 35 31 0d 0a 34 37 30 36 0d  1460..251..4706.
2b4c0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2b4d0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2b4e0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2b4f0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2b500 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2b510 32 39 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  294..SELECT - + 
2b520 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 72 30 2e  col0 DIV + cor0.
2b530 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
2b540 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2b550 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
2b560 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2b570 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2b580 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b590 20 6c 61 62 65 6c 2d 31 32 39 34 0d 0a 53 45 4c   label-1294..SEL
2b5a0 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2f 20 2b  ECT - + col0 / +
2b5b0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
2b5c0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2b5d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
2b5e0 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
2b5f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b600 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20  ALL tab0.col1 * 
2b610 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2b620 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  M tab0..----..73
2b630 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a  96..8281..9409..
2b640 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b650 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 36 20 46  t..SELECT + 36 F
2b660 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
2b670 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
2b680 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2b690 6f 20 65 65 65 39 36 61 38 35 35 31 39 66 39 32  o eee96a85519f92
2b6a0 38 35 36 61 37 35 30 30 64 63 38 62 36 63 66 37  856a7500dc8b6cf7
2b6b0 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  52....query I ro
2b6c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2b6d0 6c 32 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 30  l2 * + tab0.col0
2b6e0 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
2b6f0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2b700 2d 0d 0a 2d 36 32 0d 0a 37 30 36 0d 0a 37 32 30  -..-62..706..720
2b710 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2b720 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2b730 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  ol1 + ( + col0 )
2b740 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2b750 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
2b760 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b770 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2b780 6c 31 20 2a 20 2d 20 31 35 20 2b 20 63 6f 6c 31  l1 * - 15 + col1
2b790 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41   * + cor0.col0 A
2b7a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
2b7b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b7c0 2d 32 34 38 0d 0a 31 30 38 38 0d 0a 33 37 31 37  -248..1088..3717
2b7d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b7e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2b7f0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
2b800 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
2b810 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2b820 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2b830 69 6e 67 20 74 6f 20 38 62 34 39 37 39 39 39 34  ing to 8b4979994
2b840 32 61 39 65 33 35 33 61 33 64 32 37 39 63 66 36  2a9e353a3d279cf6
2b850 34 65 66 33 66 36 33 0d 0a 0d 0a 71 75 65 72 79  4ef3f63....query
2b860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b870 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20  CT ALL + + col2 
2b880 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  - - col2 FROM ta
2b890 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2b8a0 0d 0a 31 36 34 0d 0a 32 0d 0a 36 36 0d 0a 0d 0a  ..164..2..66....
2b8b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b8c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2b8d0 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 35 30   - + col1 * + 50
2b8e0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2b8f0 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
2b900 31 35 35 30 0d 0a 2d 32 39 35 30 0d 0a 2d 38 35  1550..-2950..-85
2b910 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2b920 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2b930 6f 72 30 2e 63 6f 6c 30 20 2b 20 38 35 20 2a 20  or0.col0 + 85 * 
2b940 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2b950 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  S cor0..----..73
2b960 33 34 0d 0a 37 38 32 34 0d 0a 38 32 38 30 0d 0a  34..7824..8280..
2b970 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b980 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
2b990 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
2b9a0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  0, tab1 AS cor0,
2b9b0 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
2b9c0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2b9d0 61 73 68 69 6e 67 20 74 6f 20 37 66 34 61 39 62  ashing to 7f4a9b
2b9e0 66 32 34 64 36 34 38 33 33 37 30 36 64 66 62 64  f24d64833706dfbd
2b9f0 64 30 62 61 66 34 39 64 37 39 0d 0a 0d 0a 73 6b  d0baf49d79....sk
2ba00 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2ba10 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2ba20 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2ba30 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2ba40 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2ba50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2ba60 49 53 54 49 4e 43 54 20 34 31 20 2b 20 2b 20 36  ISTINCT 41 + + 6
2ba70 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  1 * + cor0.col1 
2ba80 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  + col1 col2 FROM
2ba90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2baa0 2d 2d 2d 0d 0a 35 33 37 33 0d 0a 35 36 38 33 0d  ---..5373..5683.
2bab0 0a 36 30 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .6055....onlyif 
2bac0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2bad0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2bae0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2baf0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2bb00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2bb10 6c 2d 31 33 30 36 0d 0a 53 45 4c 45 43 54 20 44  l-1306..SELECT D
2bb20 49 53 54 49 4e 43 54 20 2b 20 2d 20 43 41 53 54  ISTINCT + - CAST
2bb30 28 20 32 39 20 41 53 20 53 49 47 4e 45 44 20 29  ( 29 AS SIGNED )
2bb40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2bb50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 0d  r0..----..-29...
2bb60 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2bb70 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2bb80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2bb90 6c 61 62 65 6c 2d 31 33 30 36 0d 0a 53 45 4c 45  label-1306..SELE
2bba0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
2bbb0 43 41 53 54 20 28 20 32 39 20 41 53 20 49 4e 54  CAST ( 29 AS INT
2bbc0 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30  EGER ) FROM tab0
2bbd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bbe0 2d 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -29....query I r
2bbf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2bc00 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
2bc10 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
2bc20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2bc30 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d  --..109..67..80.
2bc40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2bc50 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
2bc60 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 31 20 2b  ol2 + ( - col1 +
2bc70 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   + col0 ) AS col
2bc80 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2bc90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a  or0..----..-29..
2bca0 2d 36 31 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  -61..80....query
2bcb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bcc0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
2bcd0 35 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  50 AS col2 FROM 
2bce0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2bcf0 2d 2d 0d 0a 35 30 0d 0a 0d 0a 71 75 65 72 79 20  --..50....query 
2bd00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bd10 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 37  T DISTINCT + + 7
2bd20 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30   + col1 * - col0
2bd30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2bd40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 33 0d  r0..----..-1033.
2bd50 0a 2d 36 33 33 0d 0a 2d 37 31 0d 0a 0d 0a 71 75  .-633..-71....qu
2bd60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bd70 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
2bd80 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 46  .col2 + + col2 F
2bd90 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2bda0 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 0d 0a 36 36 0d  ---..164..2..66.
2bdb0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2bdc0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2bdd0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2bde0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2bdf0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2be00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31 32  wsort label-1312
2be10 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28  ..SELECT + CAST(
2be20 20 36 36 20 41 53 20 53 49 47 4e 45 44 20 29 20   66 AS SIGNED ) 
2be30 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  - - col1 FROM ta
2be40 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2be50 0d 0a 31 35 32 0d 0a 31 35 37 0d 0a 31 36 33 0d  ..152..157..163.
2be60 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2be70 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2be80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2be90 74 20 6c 61 62 65 6c 2d 31 33 31 32 0d 0a 53 45  t label-1312..SE
2bea0 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 36 36  LECT + CAST ( 66
2beb0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20   AS INTEGER ) - 
2bec0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
2bed0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bee0 31 35 32 0d 0a 31 35 37 0d 0a 31 36 33 0d 0a 0d  152..157..163...
2bef0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bf00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
2bf10 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  or0.col0 + + col
2bf20 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 * col1 FROM ta
2bf30 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2bf40 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38  ..1422..224..468
2bf50 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2bf60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2bf70 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 74 61 62  ol0 * col0 + tab
2bf80 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
2bf90 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 30 0d 0a 36 30  ..----..1260..60
2bfa0 30 0d 0a 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79  0..8010....query
2bfb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2bfc0 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 37 35  CT + col1 + - 75
2bfd0 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 2d 20 63   * tab2.col1 - c
2bfe0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2bff0 2d 2d 2d 0d 0a 2d 31 33 33 37 0d 0a 2d 32 33 30  ---..-1337..-230
2c000 31 0d 0a 2d 34 34 34 34 0d 0a 0d 0a 73 6b 69 70  1..-4444....skip
2c010 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2c020 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2c030 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2c040 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2c050 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2c060 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c070 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  TINCT col2 * - c
2c080 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
2c090 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 0d  b2..----..-1444.
2c0a0 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a 0d 0a 71  .-676..-729....q
2c0b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c0c0 53 45 4c 45 43 54 20 2d 20 33 31 20 2b 20 2d 20  SELECT - 31 + - 
2c0d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
2c0e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 0d  or0..----..-127.
2c0f0 0a 2d 38 35 0d 0a 2d 38 38 0d 0a 0d 0a 71 75 65  .-85..-88....que
2c100 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c110 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c  LECT ALL + ( col
2c120 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  2 ) * - col1 AS 
2c130 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
2c140 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2c150 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d  838..-7462..-97.
2c160 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c170 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2c180 4e 43 54 20 31 37 20 2a 20 2b 20 63 6f 6c 32 20  NCT 17 * + col2 
2c190 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2c1a0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 32 0d 0a 39  0..----..1632..9
2c1b0 31 38 0d 0a 39 36 39 0d 0a 0d 0a 71 75 65 72 79  18..969....query
2c1c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c1d0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
2c1e0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
2c1f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2c200 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32   cor0..----..162
2c210 32 34 0d 0a 33 36 35 30 34 0d 0a 35 37 30 30 0d  24..36504..5700.
2c220 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c230 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 30  rt..SELECT + + 0
2c240 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2c250 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
2c260 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
2c270 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c280 54 20 2b 20 32 20 2b 20 2b 20 63 6f 6c 30 20 46  T + 2 + + col0 F
2c290 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2c2a0 2d 2d 2d 0d 0a 32 36 0d 0a 33 37 0d 0a 39 31 0d  ---..26..37..91.
2c2b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c2c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2c2d0 4e 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 2b  NCT - ( col2 ) +
2c2e0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2c2f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
2c300 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c310 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33  ..SELECT ALL - 3
2c320 37 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  7 - - cor0.col1 
2c330 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  * - col2 * + col
2c340 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
2c350 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 38 34 35 0d  ..----..-119845.
2c360 0a 2d 33 32 35 32 37 0d 0a 2d 37 35 38 35 33 0d  .-32527..-75853.
2c370 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2c380 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2c390 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2c3a0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2c3b0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2c3c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 35  wsort label-1325
2c3d0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63  ..SELECT - ( - c
2c3e0 6f 72 30 2e 63 6f 6c 31 20 29 20 2a 20 2b 20 43  or0.col1 ) * + C
2c3f0 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49 47  AST( col1 AS SIG
2c400 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  NED ) * col2 AS 
2c410 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2c420 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2c430 39 38 32 0d 0a 32 35 39 34 37 0d 0a 39 30 35 30  982..25947..9050
2c440 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  6....skipif mysq
2c450 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2c460 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2c470 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 35 0d 0a  ort label-1325..
2c480 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 72  SELECT - ( - cor
2c490 30 2e 63 6f 6c 31 20 29 20 2a 20 2b 20 43 41 53  0.col1 ) * + CAS
2c4a0 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  T ( col1 AS INTE
2c4b0 47 45 52 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  GER ) * col2 AS 
2c4c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2c4d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2c4e0 39 38 32 0d 0a 32 35 39 34 37 0d 0a 39 30 35 30  982..25947..9050
2c4f0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
2c500 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c510 54 49 4e 43 54 20 37 36 20 2a 20 63 6f 72 30 2e  TINCT 76 * cor0.
2c520 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
2c530 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2c540 2d 2d 2d 2d 0d 0a 31 32 39 32 0d 0a 32 33 35 36  ----..1292..2356
2c550 0d 0a 34 34 38 34 0d 0a 0d 0a 71 75 65 72 79 20  ..4484....query 
2c560 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c570 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  T - - col1 + col
2c580 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 * col1 FROM ta
2c590 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2c5a0 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31  ..2150..3492..81
2c5b0 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
2c5c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2c5d0 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  + col1 + - col1 
2c5e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2c5f0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  2 cor0..----..0.
2c600 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
2c610 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c620 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
2c630 20 2b 20 38 32 20 2a 20 63 6f 6c 30 20 2a 20 2b   + 82 * col0 * +
2c640 20 33 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   30 FROM tab1..-
2c650 2d 2d 2d 0d 0a 31 35 37 34 39 37 0d 0a 31 39 36  ---..157497..196
2c660 38 39 36 0d 0a 37 34 33 34 0d 0a 0d 0a 6f 6e 6c  896..7434....onl
2c670 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2c680 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2c690 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2c6a0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2c6b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2c6c0 6c 61 62 65 6c 2d 31 33 33 30 0d 0a 53 45 4c 45  label-1330..SELE
2c6d0 43 54 20 43 41 53 54 28 20 28 20 63 6f 6c 32 20  CT CAST( ( col2 
2c6e0 29 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20  ) AS SIGNED ) - 
2c6f0 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63 6f  - tab0.col2 * co
2c700 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
2c710 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a  --..2871..7544..
2c720 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  98....skipif mys
2c730 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2c740 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2c750 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 30 0d  sort label-1330.
2c760 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 28  .SELECT CAST ( (
2c770 20 63 6f 6c 32 20 29 20 41 53 20 49 4e 54 45 47   col2 ) AS INTEG
2c780 45 52 20 29 20 2d 20 2d 20 74 61 62 30 2e 63 6f  ER ) - - tab0.co
2c790 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 * col1 FROM t
2c7a0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d  ab0..----..2871.
2c7b0 0a 37 35 34 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65  .7544..98....que
2c7c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c7d0 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 2a  LECT tab1.col0 *
2c7e0 20 2d 20 37 37 20 41 53 20 63 6f 6c 30 20 46 52   - 77 AS col0 FR
2c7f0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
2c800 32 33 31 0d 0a 2d 34 39 32 38 0d 0a 2d 36 31 36  231..-4928..-616
2c810 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
2c820 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2c830 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2c840 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2c850 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2c860 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2c870 33 32 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  32..SELECT CAST(
2c880 20 35 39 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20   59 * - col2 AS 
2c890 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
2c8a0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2c8b0 0d 0a 2d 31 35 33 34 0d 0a 2d 31 35 39 33 0d 0a  ..-1534..-1593..
2c8c0 2d 32 32 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2242....skipif 
2c8d0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2c8e0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2c8f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2c900 33 32 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  32..SELECT CAST 
2c910 28 20 35 39 20 2a 20 2d 20 63 6f 6c 32 20 41 53  ( 59 * - col2 AS
2c920 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
2c930 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
2c940 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 31 35 39 33  --..-1534..-1593
2c950 0d 0a 2d 32 32 34 32 0d 0a 0d 0a 71 75 65 72 79  ..-2242....query
2c960 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c970 43 54 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d  CT tab0.col1 * -
2c980 20 34 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   48 AS col2 FROM
2c990 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31   tab0..----..-41
2c9a0 32 38 0d 0a 2d 34 33 36 38 0d 0a 2d 34 36 35 36  28..-4368..-4656
2c9b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c9c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2c9d0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
2c9e0 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 30   tab2, tab2 cor0
2c9f0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2ca00 20 68 61 73 68 69 6e 67 20 74 6f 20 37 62 35 39   hashing to 7b59
2ca10 33 38 31 32 34 32 35 33 37 39 38 34 32 36 66 62  38124253798426fb
2ca20 66 30 39 63 31 38 65 31 66 64 37 35 0d 0a 0d 0a  f09c18e1fd75....
2ca30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ca40 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
2ca50 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
2ca60 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
2ca70 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36  ----..118..34..6
2ca80 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2ca90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2caa0 20 2d 20 37 33 20 46 52 4f 4d 20 74 61 62 30 0d   - 73 FROM tab0.
2cab0 0a 2d 2d 2d 2d 0d 0a 2d 37 33 0d 0a 2d 37 33 0d  .----..-73..-73.
2cac0 0a 2d 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-73....query I 
2cad0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2cae0 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
2caf0 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 * + col0 AS c
2cb00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
2cb10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a  r0..----..1040..
2cb20 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  640..78....query
2cb30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cb40 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
2cb50 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32  r0.col2 + + col2
2cb60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2cb70 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2cb80 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
2cb90 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2cba0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2cbb0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2cbc0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2cbd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cbe0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b  .SELECT col0 * +
2cbf0 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
2cc00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2cc10 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39  --..35..7298..79
2cc20 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2cc30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2cc40 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41   + col1 + col0 A
2cc50 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2cc60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2cc70 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71  137..38..96....q
2cc80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cc90 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
2cca0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32  cor0.col1 * col2
2ccb0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
2ccc0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ccd0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 31 0d 0a 31  0..----..1341..1
2cce0 34 33 33 0d 0a 36 34 34 0d 0a 0d 0a 73 6b 69 70  433..644....skip
2ccf0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2cd00 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2cd10 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2cd20 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2cd30 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2cd40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2cd50 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 63   col1 + + col2 c
2cd60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2cd70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
2cd80 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79  .58..85....query
2cd90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cda0 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20  CT ALL + - col1 
2cdb0 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + - col1 AS col2
2cdc0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2cdd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d  r0..----..-20..-
2cde0 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79  26..-52....query
2cdf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ce00 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  CT - col1 + col2
2ce10 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   + cor0.col1 AS 
2ce20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2ce30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  S cor0..----..54
2ce40 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..57..96....quer
2ce50 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
2ce60 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
2ce70 32 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  2 AS cor0 WHERE 
2ce80 4e 55 4c 4c 20 3d 20 28 20 4e 55 4c 4c 20 29 20  NULL = ( NULL ) 
2ce90 4f 52 20 4e 4f 54 20 4e 55 4c 4c 20 3e 20 63 6f  OR NOT NULL > co
2cea0 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79  l1..----....only
2ceb0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2cec0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2ced0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2cee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cef0 74 20 6c 61 62 65 6c 2d 31 33 34 36 0d 0a 53 45  t label-1346..SE
2cf00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2cf10 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f  cor0.col1 DIV co
2cf20 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
2cf30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
2cf40 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
2cf50 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2cf60 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2cf70 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 36 0d 0a  ort label-1346..
2cf80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2cf90 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f  - cor0.col1 / co
2cfa0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
2cfb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
2cfc0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2cfd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
2cfe0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b   col2 * - col0 +
2cff0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
2d000 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2d010 31 38 32 0d 0a 2d 31 39 35 30 0d 0a 2d 32 39 32  182..-1950..-292
2d020 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
2d030 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2d040 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2d050 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2d060 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2d070 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d080 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  ELECT - tab2.col
2d090 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  1 * + col1 + + c
2d0a0 6f 6c 31 20 2a 20 63 6f 6c 31 20 63 6f 6c 31 20  ol1 * col1 col1 
2d0b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2d0c0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
2d0d0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2d0e0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2d0f0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2d100 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d110 74 20 6c 61 62 65 6c 2d 31 33 34 39 0d 0a 53 45  t label-1349..SE
2d120 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  LECT col1 + col1
2d130 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
2d140 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 33  ab2..----..18..3
2d150 32 0d 0a 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  2..60....skipif 
2d160 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2d170 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2d180 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2d190 34 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  49..SELECT col1 
2d1a0 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52  + col1 / col1 FR
2d1b0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2d1c0 38 0d 0a 33 32 0d 0a 36 30 0d 0a 0d 0a 71 75 65  8..32..60....que
2d1d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2d1e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2d1f0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
2d200 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
2d210 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31  ..----..165..371
2d220 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79  2..7760....query
2d230 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d240 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 74 61  CT - col2 * + ta
2d250 62 31 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  b1.col0 * + col1
2d260 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   + col1 * + col2
2d270 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b   - tab1.col0 * +
2d280 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2d290 0a 2d 2d 2d 2d 0d 0a 2d 32 38 38 36 0d 0a 2d 33  .----..-2886..-3
2d2a0 36 35 35 30 0d 0a 2d 39 39 36 33 32 0d 0a 0d 0a  6550..-99632....
2d2b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d2c0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
2d2d0 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f   col2 + col0 FRO
2d2e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2d2f0 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32 0d  ----..132..2862.
2d300 0a 37 35 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .7551....query I
2d310 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d320 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
2d330 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + + col0 * - co
2d340 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2d350 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37  tab0..----..-197
2d360 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38 30 30 38 0d  8..-3298..-8008.
2d370 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d380 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2d390 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol2 * col1 * col
2d3a0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2d3b0 2d 0d 0a 32 32 35 39 39 0d 0a 32 34 35 34 38 0d  -..22599..24548.
2d3c0 0a 33 39 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20  .39884....query 
2d3d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d3e0 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  T col2 + - col2 
2d3f0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
2d400 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2d410 2d 31 30 35 36 0d 0a 2d 36 36 34 32 0d 0a 30 0d  -1056..-6642..0.
2d420 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
2d430 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2d440 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45   * FROM tab2 WHE
2d450 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20  RE NOT NULL NOT 
2d460 49 4e 20 28 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  IN ( + col2 * co
2d470 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e  l2 )..----....on
2d480 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2d490 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2d4a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2d4b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2d4c0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 35 37 0d 0a  ort label-1357..
2d4d0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 44 49  SELECT + col1 DI
2d4e0 56 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62 30 2e  V col2 + + tab0.
2d4f0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2d500 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab0..----..13
2d510 32 0d 0a 32 36 0d 0a 39 30 0d 0a 0d 0a 73 6b 69  2..26..90....ski
2d520 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2d530 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2d540 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d550 6c 2d 31 33 35 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1357..SELECT +
2d560 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 2b 20 2b   col1 / col2 + +
2d570 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f   tab0.col0 AS co
2d580 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
2d590 2d 2d 0d 0a 31 33 32 0d 0a 32 36 0d 0a 39 30 0d  --..132..26..90.
2d5a0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2d5b0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2d5c0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2d5d0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2d5e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2d5f0 33 35 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  358..SELECT DIST
2d600 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 74 61  INCT + col0 * ta
2d610 62 31 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f  b1.col1 DIV + co
2d620 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46  l2 + tab1.col0 F
2d630 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2d640 34 0d 0a 37 35 0d 0a 39 30 0d 0a 0d 0a 73 6b 69  4..75..90....ski
2d650 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2d660 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2d670 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d680 6c 2d 31 33 35 38 0d 0a 53 45 4c 45 43 54 20 44  l-1358..SELECT D
2d690 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
2d6a0 20 74 61 62 31 2e 63 6f 6c 31 20 2f 20 2b 20 63   tab1.col1 / + c
2d6b0 6f 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol2 + tab1.col0 
2d6c0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2d6d0 0a 34 0d 0a 37 35 0d 0a 39 30 0d 0a 0d 0a 71 75  .4..75..90....qu
2d6e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d6f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2d700 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b   col0 * col2 + +
2d710 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
2d720 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2d730 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 39 36 39 0d  --..-158..-1969.
2d740 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20  .-2985....query 
2d750 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d760 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 63  T ALL - col1 + c
2d770 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
2d780 31 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 - col0 FROM ta
2d790 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2d7a0 0d 0a 2d 33 35 0d 0a 32 37 32 38 0d 0a 37 32 38  ..-35..2728..728
2d7b0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2d7c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
2d7d0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
2d7e0 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 + - col2 * col
2d7f0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2d800 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2d810 2d 0d 0a 2d 31 35 36 36 0d 0a 2d 34 32 31 38 0d  -..-1566..-4218.
2d820 0a 2d 38 39 32 38 0d 0a 0d 0a 71 75 65 72 79 20  .-8928....query 
2d830 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d840 54 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  T tab0.col0 AS c
2d850 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol1 FROM tab0 WH
2d860 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20  ERE NULL NOT IN 
2d870 28 20 74 61 62 30 2e 63 6f 6c 31 20 29 0d 0a 2d  ( tab0.col1 )..-
2d880 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
2d890 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2d8a0 4c 4c 20 2d 20 36 32 20 46 52 4f 4d 20 74 61 62  LL - 62 FROM tab
2d8b0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d 0a 2d 36  1..----..-62..-6
2d8c0 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79 20  2..-62....query 
2d8d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d8e0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
2d8f0 63 6f 6c 30 20 2a 20 74 61 62 31 2e 63 6f 6c 32  col0 * tab1.col2
2d900 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2d910 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
2d920 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
2d930 20 68 61 73 68 69 6e 67 20 74 6f 20 64 36 37 38   hashing to d678
2d940 61 62 61 64 65 38 62 66 37 30 61 30 64 63 66 64  abade8bf70a0dcfd
2d950 63 37 39 64 36 32 31 39 33 30 36 63 0d 0a 0d 0a  c79d6219306c....
2d960 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d970 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
2d980 30 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c  0 * - col0 - col
2d990 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2d9a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  or0..----..-35..
2d9b0 2d 34 31 30 36 0d 0a 2d 36 34 31 33 0d 0a 0d 0a  -4106..-6413....
2d9c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2d9d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2d9e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2d9f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2da00 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2da10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2da20 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f 6c   tab1.col0 + col
2da30 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0 col1 FROM tab1
2da40 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30  ..----..128..160
2da50 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..6....query I r
2da60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2da70 20 2b 20 36 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   + 61 + cor0.col
2da80 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  1 * - col1 FROM 
2da90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2daa0 2d 2d 0d 0a 2d 37 34 35 37 0d 0a 2d 38 33 34 32  --..-7457..-8342
2dab0 0d 0a 2d 39 34 37 30 0d 0a 0d 0a 71 75 65 72 79  ..-9470....query
2dac0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2dad0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
2dae0 62 32 2e 63 6f 6c 31 20 2b 20 2b 20 74 61 62 32  b2.col1 + + tab2
2daf0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
2db00 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab2..----..0
2db10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2db20 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2db30 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2db40 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2db50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2db60 31 33 36 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1369..SELECT - c
2db70 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 2d 20 63  ol0 DIV col0 - c
2db80 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
2db90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2dba0 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d  ---..-55..-58..-
2dbb0 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
2dbc0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2dbd0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2dbe0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 39 0d  sort label-1369.
2dbf0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f  .SELECT - col0 /
2dc00 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 41 53 20   col0 - col2 AS 
2dc10 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2dc20 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
2dc30 35 0d 0a 2d 35 38 0d 0a 2d 39 37 0d 0a 0d 0a 71  5..-58..-97....q
2dc40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2dc50 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
2dc60 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  * + tab1.col0 + 
2dc70 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52  - col1 * col0 FR
2dc80 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
2dc90 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
2dca0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2dcb0 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  T col1 * col0 + 
2dcc0 63 6f 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 31  col2 + tab1.col1
2dcd0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2dce0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 39 0d 0a  b1..----..1149..
2dcf0 31 35 38 0d 0a 37 30 37 0d 0a 0d 0a 71 75 65 72  158..707....quer
2dd00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dd10 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b  ECT ALL col1 * +
2dd20 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b   col0 * col0 + +
2dd30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
2dd40 0a 2d 2d 2d 2d 0d 0a 31 30 36 31 33 35 0d 0a 31  .----..106135..1
2dd50 35 34 36 0d 0a 33 35 38 39 38 32 0d 0a 0d 0a 71  546..358982....q
2dd60 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
2dd70 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
2dd80 74 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c 20  tab1 WHERE NULL 
2dd90 4e 4f 54 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c  NOT BETWEEN NULL
2dda0 20 41 4e 44 20 4e 55 4c 4c 20 41 4e 44 20 2b 20   AND NULL AND + 
2ddb0 63 6f 6c 32 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d  col2 <= NULL..--
2ddc0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
2ddd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2dde0 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20  STINCT - - col1 
2ddf0 2a 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  * + col2 - + col
2de00 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * + col0 FROM 
2de10 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2de20 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 2d 34 35 39 0d  --..-1128..-459.
2de30 0a 32 32 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .2262....query I
2de40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2de50 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f   ALL - col2 + co
2de60 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32  r0.col2 * + col2
2de70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2de80 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
2de90 38 36 32 0d 0a 33 31 39 32 0d 0a 39 31 32 30 0d  862..3192..9120.
2dea0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2deb0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2dec0 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c   col1 * tab0.col
2ded0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2dee0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36  ab0..----..-7396
2def0 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a  ..-8281..-9409..
2df00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2df10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2df20 43 54 20 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63  CT col2 * tab2.c
2df30 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2df40 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20   tab2 WHERE NOT 
2df50 28 20 4e 55 4c 4c 20 29 20 3e 20 28 20 2d 20 63  ( NULL ) > ( - c
2df60 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f  ol2 )..----....o
2df70 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2df80 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2df90 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2dfa0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2dfb0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 38 0d  sort label-1378.
2dfc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2dfd0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   + col0 * + col0
2dfe0 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * + col2 + - co
2dff0 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53  l1 DIV - col1 AS
2e000 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2e010 0a 2d 2d 2d 2d 0d 0a 32 33 33 34 37 33 0d 0a 34  .----..233473..4
2e020 38 37 0d 0a 36 31 34 34 30 31 0d 0a 0d 0a 73 6b  87..614401....sk
2e030 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2e040 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2e050 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e060 65 6c 2d 31 33 37 38 0d 0a 53 45 4c 45 43 54 20  el-1378..SELECT 
2e070 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
2e080 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  * + col0 * + col
2e090 32 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63  2 + - col1 / - c
2e0a0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2e0b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33   tab1..----..233
2e0c0 34 37 33 0d 0a 34 38 37 0d 0a 36 31 34 34 30 31  473..487..614401
2e0d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2e0e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
2e0f0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   + + col2 * col2
2e100 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
2e110 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 30 32  ab2..----..17602
2e120 0d 0a 31 39 37 31 30 0d 0a 35 34 39 31 30 0d 0a  ..19710..54910..
2e130 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e140 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
2e150 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31   * col0 - + col1
2e160 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2e170 0d 0a 31 39 37 38 0d 0a 33 32 39 38 0d 0a 38 30  ..1978..3298..80
2e180 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  08....query I ro
2e190 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
2e1a0 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  b2.col0 * - col0
2e1b0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 32   - col1 * - tab2
2e1c0 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d  .col1 FROM tab2.
2e1d0 0a 2d 2d 2d 2d 0d 0a 2d 32 36 30 33 0d 0a 2d 35  .----..-2603..-5
2e1e0 39 35 32 0d 0a 39 31 32 0d 0a 0d 0a 73 6b 69 70  952..912....skip
2e1f0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2e200 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2e210 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2e220 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2e230 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2e240 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2e250 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c   tab1.col2 * col
2e260 32 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  2 - col0 col1 FR
2e270 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
2e280 39 31 33 0d 0a 33 31 38 35 0d 0a 39 31 33 36 0d  913..3185..9136.
2e290 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e2a0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2e2b0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b   col1 * + col1 +
2e2c0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   + col0 * col0 A
2e2d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2e2e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 30 0d 0a 2d 36  ..----..-360..-6
2e2f0 38 32 30 0d 0a 2d 38 31 38 34 0d 0a 0d 0a 71 75  820..-8184....qu
2e300 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
2e310 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
2e320 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 2d 20  ab0 WHERE NOT - 
2e330 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 4e 4f 54 20  col2 * col1 NOT 
2e340 49 4e 20 28 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  IN ( col0 + col1
2e350 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d   + col1 )..----.
2e360 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
2e370 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2e380 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
2e390 31 20 57 48 45 52 45 20 4e 55 4c 4c 20 3c 3e 20  1 WHERE NULL <> 
2e3a0 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 0d  - col2 + - col0.
2e3b0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
2e3c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e3d0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
2e3e0 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
2e3f0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d  ab0..----..-119.
2e400 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75  .-173..-98....qu
2e410 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e420 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 72  ELECT col1 * cor
2e430 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20  0.col2 + col0 + 
2e440 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col1 * + col0 FR
2e450 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e460 0a 2d 2d 2d 2d 0d 0a 31 32 37 34 0d 0a 31 34 38  .----..1274..148
2e470 35 0d 0a 32 33 36 38 0d 0a 0d 0a 71 75 65 72 79  5..2368....query
2e480 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e490 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
2e4a0 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l0 + col0 + + co
2e4b0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
2e4c0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2e4d0 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e  .1..33..82....on
2e4e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2e4f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2e500 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2e510 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2e520 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 39 0d 0a  ort label-1389..
2e530 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e540 2b 20 32 36 20 44 49 56 20 63 6f 6c 32 20 41 53  + 26 DIV col2 AS
2e550 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
2e560 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
2e570 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2e580 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2e590 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2e5a0 72 74 20 6c 61 62 65 6c 2d 31 33 38 39 0d 0a 53  rt label-1389..S
2e5b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2e5c0 20 32 36 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f   26 / col2 AS co
2e5d0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2e5e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
2e5f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e600 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
2e610 63 6f 6c 30 20 2b 20 74 61 62 30 2e 63 6f 6c 31  col0 + tab0.col1
2e620 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2e630 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31  ..2150..3492..81
2e640 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
2e650 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2e660 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  col2 * + col1 * 
2e670 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63  + tab2.col0 AS c
2e680 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2e690 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 31 30  ---..119652..510
2e6a0 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 71 75 65 72  34..5859....quer
2e6b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e6c0 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63  ECT ALL col2 + c
2e6d0 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c  ol2 * col0 - col
2e6e0 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 * - col0 AS co
2e6f0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
2e700 2d 2d 0d 0a 34 30 35 0d 0a 34 30 38 32 0d 0a 36  --..405..4082..6
2e710 30 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  042....query III
2e720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e730 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30   ALL * FROM tab0
2e740 20 57 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f 6c   WHERE NOT - col
2e750 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  2 * - col2 + + c
2e760 6f 6c 31 20 2b 20 63 6f 6c 30 20 49 4e 20 28 20  ol1 + col0 IN ( 
2e770 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20  col0 )..----..9 
2e780 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2e790 6f 20 33 38 61 31 36 37 33 65 32 65 30 39 64 36  o 38a1673e2e09d6
2e7a0 39 34 63 38 63 65 63 34 35 63 37 39 37 30 33 34  94c8cec45c797034
2e7b0 61 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  a7....query I ro
2e7c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2e7d0 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 31  STINCT tab0.col1
2e7e0 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f   * tab0.col1 FRO
2e7f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  M tab0..----..73
2e800 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a  96..8281..9409..
2e810 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2e820 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2e830 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2e840 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2e850 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2e860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e870 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20  CT ALL col1 * - 
2e880 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col1 col1 FROM t
2e890 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36  ab0..----..-7396
2e8a0 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a  ..-8281..-9409..
2e8b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2e8c0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2e8d0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2e8e0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2e8f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2e900 39 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  96..SELECT ALL +
2e910 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 46   col1 DIV col0 F
2e920 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2e930 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d  ..----..0..0..4.
2e940 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2e950 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2e960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e970 74 20 6c 61 62 65 6c 2d 31 33 39 36 0d 0a 53 45  t label-1396..SE
2e980 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
2e990 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  / col0 FROM tab2
2e9a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e9b0 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  0..0..4....query
2e9c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e9d0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
2e9e0 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30  r0.col0 * + col0
2e9f0 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   * - cor0.col0 +
2ea00 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
2ea10 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2ea20 0a 33 37 30 0d 0a 34 37 34 35 37 38 0d 0a 34 39  .370..474578..49
2ea30 33 30 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49  3077....query II
2ea40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ea50 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f  T DISTINCT * FRO
2ea60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 57  M tab1 AS cor0 W
2ea70 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3e 20  HERE NOT NULL > 
2ea80 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  col1..----....qu
2ea90 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
2eaa0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
2eab0 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f  OM tab0 WHERE NO
2eac0 54 20 2b 20 63 6f 6c 31 20 3d 20 4e 55 4c 4c 0d  T + col1 = NULL.
2ead0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
2eae0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2eaf0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
2eb00 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   * col1 + col0 *
2eb10 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2eb20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 39 38  cor0..----..-598
2eb30 0d 0a 35 34 30 0d 0a 38 37 31 0d 0a 0d 0a 71 75  ..540..871....qu
2eb40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2eb50 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 41 53 20  ELECT - col2 AS 
2eb60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2eb70 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e 4f 54  S cor0 WHERE NOT
2eb80 20 28 20 4e 55 4c 4c 20 29 20 42 45 54 57 45 45   ( NULL ) BETWEE
2eb90 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c 0d  N NULL AND NULL.
2eba0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
2ebb0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
2ebc0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57  CT * FROM tab0 W
2ebd0 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e 4f  HERE NOT NULL NO
2ebe0 54 20 42 45 54 57 45 45 4e 20 63 6f 6c 32 20 2a  T BETWEEN col2 *
2ebf0 20 63 6f 6c 32 20 41 4e 44 20 4e 55 4c 4c 0d 0a   col2 AND NULL..
2ec00 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
2ec10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ec20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  - col0 + - col0 
2ec30 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
2ec40 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2ec50 2d 31 34 32 32 0d 0a 2d 32 32 34 0d 0a 2d 34 36  -1422..-224..-46
2ec60 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
2ec70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2ec80 4c 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  L - col0 FROM ta
2ec90 62 31 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20  b1 WHERE ( NULL 
2eca0 29 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41  ) BETWEEN NULL A
2ecb0 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d  ND NULL..----...
2ecc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ecd0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2ece0 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  - + col2 FROM ta
2ecf0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 0d 0a  b1..----..-109..
2ed00 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72  -67..-80....quer
2ed10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ed20 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ECT - col1 + col
2ed30 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  2 * + col1 + + c
2ed40 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
2ed50 2d 2d 2d 0d 0a 31 33 33 31 0d 0a 31 34 33 32 0d  ---..1331..1432.
2ed60 0a 36 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .617....query I 
2ed70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ed80 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 74 61 62  ALL - col1 * tab
2ed90 31 2e 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 46 52  1.col2 - col1 FR
2eda0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
2edb0 31 32 36 31 0d 0a 2d 31 34 33 30 0d 0a 2d 35 38  1261..-1430..-58
2edc0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2edd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2ede0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2edf0 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20 3e  WHERE NOT col1 >
2ee00 3d 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d  = ( NULL )..----
2ee10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ee20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2ee30 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 63 6f  col0 * col2 - co
2ee40 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
2ee50 2d 2d 0d 0a 31 38 32 0d 0a 31 39 35 30 0d 0a 32  --..182..1950..2
2ee60 39 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  923....onlyif my
2ee70 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2ee80 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2ee90 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2eea0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2eeb0 65 6c 2d 31 34 31 30 0d 0a 53 45 4c 45 43 54 20  el-1410..SELECT 
2eec0 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20  col2 DIV + col1 
2eed0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2eee0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37  1..----..2..5..7
2eef0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2ef00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2ef10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2ef20 72 74 20 6c 61 62 65 6c 2d 31 34 31 30 0d 0a 53  rt label-1410..S
2ef30 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 2b 20 63  ELECT col2 / + c
2ef40 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
2ef50 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   tab1..----..2..
2ef60 35 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5..7....query I 
2ef70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ef80 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
2ef90 2a 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20  * tab1.col1 + - 
2efa0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2efb0 2d 2d 2d 2d 0d 0a 33 36 0d 0a 36 37 33 0d 0a 38  ----..36..673..8
2efc0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2efd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
2efe0 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  ab2.col1 * col2 
2eff0 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  * col2 + + col0 
2f000 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2f010 32 20 57 48 45 52 45 20 74 61 62 32 2e 63 6f 6c  2 WHERE tab2.col
2f020 31 20 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  1 > NULL..----..
2f030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f040 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2f050 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 46 52  col2 / - col0 FR
2f060 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 55  OM tab2 WHERE NU
2f070 4c 4c 20 49 4e 20 28 20 2b 20 63 6f 6c 31 20 29  LL IN ( + col1 )
2f080 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
2f090 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f0a0 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d  T ALL - col1 + -
2f0b0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2f0c0 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f  OM tab0 WHERE NO
2f0d0 54 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  T - col2 / - col
2f0e0 31 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 31 20  1 NOT IN ( col1 
2f0f0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69  )..----....skipi
2f100 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2f110 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2f120 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2f130 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2f140 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2f150 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
2f160 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f   * col2 col1 FRO
2f170 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
2f180 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
2f190 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f1a0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 41 53  ..SELECT col2 AS
2f1b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2f1c0 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55 4c 4c  WHERE NOT ( NULL
2f1d0 20 29 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 4e   ) NOT BETWEEN N
2f1e0 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d  ULL AND NULL..--
2f1f0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
2f200 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2f210 63 6f 6c 31 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col1 + - tab1.co
2f220 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
2f230 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33  --..-54..-67..23
2f240 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f250 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2f260 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20  INCT - - col2 + 
2f270 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
2f280 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33   cor0..----..-33
2f290 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 6f 6e 6c 79  ..-4..21....only
2f2a0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2f2b0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2f2c0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2f2d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f2e0 74 20 6c 61 62 65 6c 2d 31 34 31 39 0d 0a 53 45  t label-1419..SE
2f2f0 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f  LECT col2 DIV co
2f300 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  r0.col0 AS col1 
2f310 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2f320 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33  0..----..0..0..3
2f330 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2f340 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2f350 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2f360 72 74 20 6c 61 62 65 6c 2d 31 34 31 39 0d 0a 53  rt label-1419..S
2f370 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f 72  ELECT col2 / cor
2f380 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
2f390 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2f3a0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33 0d  ..----..0..0..3.
2f3b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f3c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2f3d0 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  NCT col2 * - cor
2f3e0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
2f3f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f400 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35  -1248..-1404..-5
2f410 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
2f420 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2f430 38 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  81 * - col2 FROM
2f440 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2f450 2d 2d 2d 0d 0a 32 36 37 33 0d 0a 36 36 34 32 0d  ---..2673..6642.
2f460 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .81....query I r
2f470 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2f480 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20   ( + col0 ) * + 
2f490 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31 20  ( col0 ) + col1 
2f4a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2f4b0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 34 33 0d 0a 36  0..----..6143..6
2f4c0 32 35 38 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  258..80....onlyi
2f4d0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2f4e0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2f4f0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2f500 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f510 20 6c 61 62 65 6c 2d 31 34 32 33 0d 0a 53 45 4c   label-1423..SEL
2f520 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 44  ECT ALL - col2 D
2f530 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41  IV - cor0.col0 A
2f540 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
2f550 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f560 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70  0..1..18....skip
2f570 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2f580 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2f590 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2f5a0 2d 31 34 32 33 0d 0a 53 45 4c 45 43 54 20 41 4c  -1423..SELECT AL
2f5b0 4c 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72  L - col2 / - cor
2f5c0 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
2f5d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2f5e0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38  ..----..0..1..18
2f5f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f600 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 30 20 41  ort..SELECT 40 A
2f610 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2f620 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
2f630 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
2f640 61 73 68 69 6e 67 20 74 6f 20 62 31 65 38 66 66  ashing to b1e8ff
2f650 65 65 66 33 33 34 62 34 61 32 62 30 31 62 32 66  eef334b4a2b01b2f
2f660 39 31 65 36 34 39 63 32 64 33 0d 0a 0d 0a 71 75  91e649c2d3....qu
2f670 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f680 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2f690 20 36 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f   62 * col2 AS co
2f6a0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
2f6b0 2d 2d 0d 0a 33 33 34 38 0d 0a 33 35 33 34 0d 0a  --..3348..3534..
2f6c0 35 39 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5952....query I 
2f6d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f6e0 44 49 53 54 49 4e 43 54 20 2d 20 39 33 20 41 53  DISTINCT - 93 AS
2f6f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2f700 0a 2d 2d 2d 2d 0d 0a 2d 39 33 0d 0a 0d 0a 71 75  .----..-93....qu
2f710 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f720 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2f730 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c   tab1.col2 * col
2f740 31 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 - col0 FROM ta
2f750 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 38 0d 0a  b1..----..1168..
2f760 31 34 30 31 0d 0a 35 30 36 0d 0a 0d 0a 71 75 65  1401..506....que
2f770 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f780 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  LECT + col1 + + 
2f790 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 32 20 2a 20  col0 * ( col2 * 
2f7a0 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 32 20  col1 ) + - col2 
2f7b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2f7c0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 39 31 0d 0a 36  0..----..3491..6
2f7d0 36 34 31 32 37 0d 0a 36 38 31 36 35 0d 0a 0d 0a  64127..68165....
2f7e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f7f0 0a 53 45 4c 45 43 54 20 2d 20 33 20 2a 20 63 6f  .SELECT - 3 * co
2f800 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2f810 2d 2d 0d 0a 2d 31 31 34 0d 0a 2d 37 38 0d 0a 2d  --..-114..-78..-
2f820 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
2f830 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2f840 2b 20 35 34 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  + 54 * + col2 * 
2f850 2b 20 63 6f 6c 32 20 2d 20 28 20 63 6f 6c 31 20  + col2 - ( col1 
2f860 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2f870 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 34  or0..----..-1574
2f880 39 30 0d 0a 2d 31 37 35 34 35 36 0d 0a 2d 34 39  90..-175456..-49
2f890 37 36 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7677....onlyif m
2f8a0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2f8b0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2f8c0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2f8d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f8e0 62 65 6c 2d 31 34 33 31 0d 0a 53 45 4c 45 43 54  bel-1431..SELECT
2f8f0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   - col2 * + col1
2f900 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31   - col0 DIV col1
2f910 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2f920 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f930 0d 0a 2d 31 32 35 34 0d 0a 2d 31 34 30 34 0d 0a  ..-1254..-1404..
2f940 2d 35 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -576....skipif m
2f950 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2f960 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2f970 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33  owsort label-143
2f980 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  1..SELECT - col2
2f990 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30   * + col1 - col0
2f9a0 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   / col1 AS col0 
2f9b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2f9c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 34 0d 0a  0..----..-1254..
2f9d0 2d 31 34 30 34 0d 0a 2d 35 37 36 0d 0a 0d 0a 71  -1404..-576....q
2f9e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f9f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2fa00 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 2b 20  + tab0.col0 - + 
2fa10 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
2fa20 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  M tab0..----..-9
2fa30 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69  ..34..7....onlyi
2fa40 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2fa50 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2fa60 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2fa70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fa80 20 6c 61 62 65 6c 2d 31 34 33 33 0d 0a 53 45 4c   label-1433..SEL
2fa90 45 43 54 20 36 34 20 44 49 56 20 2b 20 63 6f 6c  ECT 64 DIV + col
2faa0 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  0 + - col1 * - c
2fab0 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol0 - col2 * col
2fac0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2fad0 2d 0d 0a 2d 36 31 31 0d 0a 33 30 36 38 0d 0a 36  -..-611..3068..6
2fae0 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
2faf0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2fb00 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2fb10 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 33 0d  sort label-1433.
2fb20 0a 53 45 4c 45 43 54 20 36 34 20 2f 20 2b 20 63  .SELECT 64 / + c
2fb30 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d  ol0 + - col1 * -
2fb40 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 63   col0 - col2 * c
2fb50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2fb60 2d 2d 2d 0d 0a 2d 36 31 31 0d 0a 33 30 36 38 0d  ---..-611..3068.
2fb70 0a 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .697....query I 
2fb80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fb90 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col0 + - tab1.co
2fba0 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 + col1 FROM t
2fbb0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34  ab1..----..3..64
2fbc0 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..80....query I 
2fbd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fbe0 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2b 20  - cor0.col1 - + 
2fbf0 31 35 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  15 FROM tab2, ta
2fc00 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
2fc10 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
2fc20 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 66 34  s hashing to 5f4
2fc30 64 63 39 64 62 62 38 65 38 32 65 64 34 33 61 30  dc9dbb8e82ed43a0
2fc40 35 31 62 34 37 63 32 62 34 35 61 39 63 0d 0a 0d  51b47c2b45a9c...
2fc50 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2fc60 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2fc70 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2fc80 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2fc90 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2fca0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 36 0d 0a  ort label-1436..
2fcb0 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
2fcc0 2a 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 72 30  * + CAST( - cor0
2fcd0 2e 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20  .col2 AS SIGNED 
2fce0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
2fcf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d  or0..----..2916.
2fd00 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a 73  .3249..9216....s
2fd10 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2fd20 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2fd30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2fd40 62 65 6c 2d 31 34 33 36 0d 0a 53 45 4c 45 43 54  bel-1436..SELECT
2fd50 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41   + - col2 * + CA
2fd60 53 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  ST ( - cor0.col2
2fd70 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
2fd80 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2fd90 0a 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 32 34  .----..2916..324
2fda0 39 0d 0a 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79  9..9216....query
2fdb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fdc0 43 54 20 2d 20 28 20 2d 20 63 6f 72 31 2e 63 6f  CT - ( - cor1.co
2fdd0 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
2fde0 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
2fdf0 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
2fe00 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
2fe10 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
2fe20 35 39 39 62 34 38 30 31 32 35 64 65 35 32 31 65  599b480125de521e
2fe30 66 65 64 37 31 62 35 62 32 34 31 33 63 37 64 0d  fed71b5b2413c7d.
2fe40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2fe50 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
2fe60 2a 20 34 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 43 AS col2 FRO
2fe70 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
2fe80 31 38 0d 0a 34 33 30 0d 0a 35 35 39 0d 0a 0d 0a  18..430..559....
2fe90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fea0 0a 53 45 4c 45 43 54 20 39 32 20 2b 20 2b 20 33  .SELECT 92 + + 3
2feb0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2fec0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d 0a  or0..----..122..
2fed0 31 32 32 0d 0a 31 32 32 0d 0a 0d 0a 71 75 65 72  122..122....quer
2fee0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fef0 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT - cor0.col2 
2ff00 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  + + col0 * + col
2ff10 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2ff20 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2ff30 2d 0d 0a 32 32 0d 0a 36 30 35 38 0d 0a 36 32 30  -..22..6058..620
2ff40 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
2ff50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2ff60 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  TINCT + - col0 *
2ff70 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   - col0 * + col1
2ff80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2ff90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 34  r0..----..234..4
2ffa0 30 39 36 30 0d 0a 38 33 32 30 30 0d 0a 0d 0a 71  0960..83200....q
2ffb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2ffc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2ffd0 63 6f 6c 32 20 2a 20 28 20 2b 20 63 6f 6c 30 20  col2 * ( + col0 
2ffe0 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
2fff0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  ab0..----..35..7
30000 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72  298..792....quer
30010 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30020 45 43 54 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63  ECT + ( + cor0.c
30030 6f 6c 32 20 29 20 2a 20 63 6f 6c 32 20 41 53 20  ol2 ) * col2 AS 
30040 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
30050 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d  or0..----..1444.
30060 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65  .676..729....que
30070 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30080 4c 45 43 54 20 2b 20 35 20 41 53 20 63 6f 6c 32  LECT + 5 AS col2
30090 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
300a0 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 35 0d 0a 35 0d 0a  .----..5..5..5..
300b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
300c0 74 0d 0a 53 45 4c 45 43 54 20 31 37 20 2a 20 28  t..SELECT 17 * (
300d0 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31   + col1 ) * col1
300e0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
300f0 0d 0a 31 32 35 37 33 32 0d 0a 31 34 30 37 37 37  ..125732..140777
30100 0d 0a 31 35 39 39 35 33 0d 0a 0d 0a 6f 6e 6c 79  ..159953....only
30110 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
30120 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
30130 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
30140 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
30150 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30160 61 62 65 6c 2d 31 34 34 36 0d 0a 53 45 4c 45 43  abel-1446..SELEC
30170 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28  T DISTINCT CAST(
30180 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
30190 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
301a0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  ab1..----..54..5
301b0 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..96....skipif 
301c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
301d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
301e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
301f0 34 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  46..SELECT DISTI
30200 4e 43 54 20 43 41 53 54 20 28 20 63 6f 6c 32 20  NCT CAST ( col2 
30210 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
30220 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
30230 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36  ----..54..57..96
30240 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
30250 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
30260 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
30270 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
30280 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
30290 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
302a0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 74 61  LECT - col0 + ta
302b0 62 31 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  b1.col0 * - col0
302c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
302d0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 34 31 36  .----..-12..-416
302e0 30 0d 0a 2d 36 34 38 30 0d 0a 0d 0a 71 75 65 72  0..-6480....quer
302f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30300 45 43 54 20 41 4c 4c 20 2d 20 28 20 28 20 2d 20  ECT ALL - ( ( - 
30310 63 6f 6c 30 20 29 20 29 20 46 52 4f 4d 20 74 61  col0 ) ) FROM ta
30320 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  b1..----..3..64.
30330 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .80....onlyif my
30340 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
30350 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
30360 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
30370 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30380 65 6c 2d 31 34 34 39 0d 0a 53 45 4c 45 43 54 20  el-1449..SELECT 
30390 2d 20 39 34 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  - 94 * + col2 + 
303a0 2b 20 63 6f 6c 31 20 44 49 56 20 74 61 62 30 2e  + col1 DIV tab0.
303b0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
303c0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
303d0 30 39 39 0d 0a 2d 37 37 30 37 0d 0a 2d 39 32 0d  099..-7707..-92.
303e0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
303f0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
30400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30410 74 20 6c 61 62 65 6c 2d 31 34 34 39 0d 0a 53 45  t label-1449..SE
30420 4c 45 43 54 20 2d 20 39 34 20 2a 20 2b 20 63 6f  LECT - 94 * + co
30430 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 74 61  l2 + + col1 / ta
30440 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  b0.col0 AS col2 
30450 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
30460 0a 2d 33 30 39 39 0d 0a 2d 37 37 30 37 0d 0a 2d  .-3099..-7707..-
30470 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
30480 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
30490 4c 20 31 30 20 46 52 4f 4d 20 74 61 62 31 20 41  L 10 FROM tab1 A
304a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
304b0 0d 0a 31 30 0d 0a 31 30 0d 0a 0d 0a 71 75 65 72  ..10..10....quer
304c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
304d0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20 63 6f  ECT ALL + - ( co
304e0 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
304f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
30500 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a  ----..-17..-31..
30510 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -59....query I r
30520 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30530 4c 4c 20 2b 20 37 36 20 2a 20 2d 20 63 6f 72 30  LL + 76 * - cor0
30540 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
30550 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
30560 0a 2d 2d 2d 2d 0d 0a 2d 36 35 33 36 0d 0a 2d 36  .----..-6536..-6
30570 39 31 36 0d 0a 2d 37 33 37 32 0d 0a 0d 0a 71 75  916..-7372....qu
30580 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30590 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
305a0 20 37 36 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20   76 + - col2 AS 
305b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
305c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
305d0 30 39 0d 0a 2d 31 35 38 0d 0a 2d 37 37 0d 0a 0d  09..-158..-77...
305e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
305f0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
30600 2b 20 34 37 20 2a 20 2b 20 63 6f 6c 31 20 46 52  + 47 * + col1 FR
30610 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
30620 2d 2d 0d 0a 34 30 37 35 0d 0a 34 33 35 39 0d 0a  --..4075..4359..
30630 34 35 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4560....query I 
30640 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30650 41 4c 4c 20 36 37 20 46 52 4f 4d 20 74 61 62 31  ALL 67 FROM tab1
30660 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
30670 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
30680 61 73 68 69 6e 67 20 74 6f 20 62 35 36 66 38 61  ashing to b56f8a
30690 34 66 31 66 63 65 62 63 39 38 30 32 34 38 31 32  4f1fcebc98024812
306a0 35 36 64 66 36 31 65 39 37 63 0d 0a 0d 0a 71 75  56df61e97c....qu
306b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
306c0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
306d0 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
306e0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
306f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
30700 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
30710 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30720 53 54 49 4e 43 54 20 2d 20 38 31 20 41 53 20 63  STINCT - 81 AS c
30730 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
30740 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 31   cor0..----..-81
30750 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30760 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
30770 31 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  12 + + col2 AS c
30780 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
30790 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 0d   cor0..----..38.
307a0 0a 33 39 0d 0a 35 30 0d 0a 0d 0a 71 75 65 72 79  .39..50....query
307b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
307c0 43 54 20 41 4c 4c 20 2d 20 32 31 20 2b 20 2b 20  CT ALL - 21 + + 
307d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
307e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 37  or0..----..65..7
307f0 30 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  0..76....query I
30800 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30810 20 2b 20 2d 20 38 35 20 41 53 20 63 6f 6c 30 20   + - 85 AS col0 
30820 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
30830 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 38  0..----..-85..-8
30840 35 0d 0a 2d 38 35 0d 0a 0d 0a 73 6b 69 70 69 66  5..-85....skipif
30850 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
30860 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
30870 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
30880 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
30890 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
308a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
308b0 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  NCT - + cor0.col
308c0 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  2 + col1 * + cor
308d0 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  0.col1 * - col0 
308e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
308f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 35  or0..----..-1775
30900 33 37 0d 0a 2d 33 32 39 33 31 36 0d 0a 2d 37 33  37..-329316..-73
30910 37 30 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7091....query I 
30920 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30930 41 4c 4c 20 2b 20 32 34 20 2b 20 2b 20 63 6f 6c  ALL + 24 + + col
30940 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 * + cor0.col1 
30950 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
30960 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 37 0d 0a 32  0..----..1367..2
30970 34 31 0d 0a 34 36 32 36 0d 0a 0d 0a 71 75 65 72  41..4626....quer
30980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30990 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d  ECT ALL col2 * -
309a0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
309b0 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  2 + + col0 FROM 
309c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
309d0 2d 2d 0d 0a 2d 32 38 35 39 0d 0a 2d 33 31 32 38  --..-2859..-3128
309e0 0d 0a 2d 39 30 34 30 0d 0a 0d 0a 71 75 65 72 79  ..-9040....query
309f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30a00 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
30a10 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l2 + - col0 * + 
30a20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col2 * + col1 FR
30a30 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
30a40 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 34 0d 0a 2d 36  .----..-3394..-6
30a50 36 34 30 33 36 0d 0a 2d 36 38 30 37 39 0d 0a 0d  64036..-68079...
30a60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30a70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
30a80 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63  ol0 * col1 * + c
30a90 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
30aa0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
30ab0 0d 0a 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a  ..-234..-40960..
30ac0 2d 38 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20  -83200....query 
30ad0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30ae0 54 20 2d 20 34 35 20 2b 20 2b 20 63 6f 6c 32 20  T - 45 + + col2 
30af0 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
30b00 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
30b10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a 31  r0..----..-44..1
30b20 30 34 34 0d 0a 36 36 37 39 0d 0a 0d 0a 71 75 65  044..6679....que
30b30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30b40 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
30b50 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col0 + + col2 * 
30b60 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
30b70 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
30b80 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35 0d 0a 2d  ..----..-1365..-
30b90 35 39 38 0d 0a 2d 37 32 32 0d 0a 0d 0a 6f 6e 6c  598..-722....onl
30ba0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
30bb0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
30bc0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
30bd0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
30be0 72 74 20 6c 61 62 65 6c 2d 31 34 36 38 0d 0a 53  rt label-1468..S
30bf0 45 4c 45 43 54 20 41 4c 4c 20 32 20 44 49 56 20  ELECT ALL 2 DIV 
30c00 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
30c10 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
30c20 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
30c30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
30c40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
30c50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30c60 65 6c 2d 31 34 36 38 0d 0a 53 45 4c 45 43 54 20  el-1468..SELECT 
30c70 41 4c 4c 20 32 20 2f 20 63 6f 6c 31 20 41 53 20  ALL 2 / col1 AS 
30c80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
30c90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
30ca0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
30cb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
30cc0 4c 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d  L - ( col2 ) * -
30cd0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
30ce0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
30cf0 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d  534..646..837...
30d00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30d10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39  ..SELECT ALL + 9
30d20 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
30d30 2d 0d 0a 39 31 0d 0a 39 31 0d 0a 39 31 0d 0a 0d  -..91..91..91...
30d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30d50 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
30d60 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
30d70 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62 32  tab0, tab2, tab2
30d80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
30d90 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
30da0 6f 20 37 35 39 39 62 34 38 30 31 32 35 64 65 35  o 7599b480125de5
30db0 32 31 65 66 65 64 37 31 62 35 62 32 34 31 33 63  21efed71b5b2413c
30dc0 37 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  7d....query I ro
30dd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30de0 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20  STINCT + + col1 
30df0 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
30e00 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
30e10 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
30e20 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
30e30 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
30e40 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
30e50 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
30e60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30e70 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 31 34 20  LECT ALL - + 14 
30e80 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  * col1 col2 FROM
30e90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
30ea0 2d 2d 2d 0d 0a 2d 31 34 30 0d 0a 2d 31 38 32 0d  ---..-140..-182.
30eb0 0a 2d 33 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-364....query I
30ec0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30ed0 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 36 33 20 41   - col2 + + 63 A
30ee0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
30ef0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30f00 32 35 0d 0a 33 36 0d 0a 33 37 0d 0a 0d 0a 71 75  25..36..37....qu
30f10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30f20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
30f30 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 28 20 63  or0.col2 * + ( c
30f40 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  or0.col0 ) + col
30f50 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  1 * col1 AS col1
30f60 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
30f70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 34 38 0d 0a  r0..----..3748..
30f80 37 38 34 39 0d 0a 38 33 38 0d 0a 0d 0a 71 75 65  7849..838....que
30f90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30fa0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  LECT - col0 * - 
30fb0 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f  cor0.col0 - - co
30fc0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
30fd0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 34 33 0d 0a 36  0..----..6143..6
30fe0 32 35 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  258..80....query
30ff0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31000 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  CT - - col1 + co
31010 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
31020 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
31030 2d 0d 0a 31 35 39 33 0d 0a 36 36 33 0d 0a 38 36  -..1593..663..86
31040 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
31050 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
31060 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30   - - col0 * col0
31070 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
31080 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31090 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 0d 0a 36 31 36  0..----..56..616
310a0 32 0d 0a 36 33 32 30 0d 0a 0d 0a 6f 6e 6c 79 69  2..6320....onlyi
310b0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
310c0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
310d0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
310e0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
310f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
31100 62 65 6c 2d 31 34 37 39 0d 0a 53 45 4c 45 43 54  bel-1479..SELECT
31110 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 43 41   ALL + col1 + CA
31120 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
31130 45 44 20 29 20 2a 20 2d 20 37 30 20 41 53 20 63  ED ) * - 70 AS c
31140 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
31150 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
31160 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
31170 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
31180 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
31190 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
311a0 6c 61 62 65 6c 2d 31 34 37 39 0d 0a 53 45 4c 45  label-1479..SELE
311b0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
311c0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
311d0 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 37 30 20  NTEGER ) * - 70 
311e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
311f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
31200 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
31210 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
31220 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
31230 20 2d 20 32 30 20 41 53 20 63 6f 6c 30 20 46 52   - 20 AS col0 FR
31240 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
31250 32 30 0d 0a 2d 32 30 0d 0a 2d 32 30 0d 0a 0d 0a  20..-20..-20....
31260 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
31270 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
31280 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
31290 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
312a0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
312b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
312c0 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   ALL col1 * - co
312d0 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
312e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
312f0 0a 2d 32 38 39 0d 0a 2d 33 34 38 31 0d 0a 2d 39  .-289..-3481..-9
31300 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
31310 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
31320 2b 20 63 6f 6c 32 20 2b 20 2d 20 34 37 20 46 52  + col2 + - 47 FR
31330 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
31340 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 0d 0a 2d 34 38  .----..-129..-48
31350 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-80....query I
31360 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31370 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20   ALL + + col0 + 
31380 2d 20 34 30 20 46 52 4f 4d 20 74 61 62 32 20 41  - 40 FROM tab2 A
31390 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
313a0 33 0d 0a 33 38 0d 0a 33 39 0d 0a 0d 0a 71 75 65  3..38..39....que
313b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
313c0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
313d0 2d 20 37 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72  - 7 + col1 + cor
313e0 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53  0.col2 * col0 AS
313f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
31400 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
31410 36 37 34 0d 0a 32 39 30 30 0d 0a 33 0d 0a 0d 0a  674..2900..3....
31420 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
31430 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
31440 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
31450 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
31460 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 35  wsort label-1485
31470 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
31480 54 20 63 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e  T col0 DIV cor0.
31490 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
314a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
314b0 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .6....skipif mys
314c0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
314d0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
314e0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 35 0d  sort label-1485.
314f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31500 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c   col0 / cor0.col
31510 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
31520 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d  or0..----..0..6.
31530 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31540 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
31550 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 34 39 20  ol1 * col0 * 49 
31560 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
31570 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31580 31 30 36 30 32 0d 0a 32 32 35 34 33 39 0d 0a 36  10602..225439..6
31590 35 37 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5790....query I 
315a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
315b0 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 35 33 20  ALL col0 * + 53 
315c0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20  + col1 * col1 * 
315d0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
315e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
315f0 2d 31 37 36 32 33 32 0d 0a 2d 33 32 37 34 36 30  -176232..-327460
31600 0d 0a 2d 37 33 32 32 39 32 0d 0a 0d 0a 71 75 65  ..-732292....que
31610 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31620 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
31630 63 6f 6c 32 20 2d 20 2d 20 39 38 20 46 52 4f 4d  col2 - - 98 FROM
31640 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
31650 0d 0a 31 36 0d 0a 36 35 0d 0a 39 37 0d 0a 0d 0a  ..16..65..97....
31660 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
31670 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
31680 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
31690 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
316a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 39  wsort label-1489
316b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
316c0 54 20 37 38 20 2b 20 2b 20 63 6f 6c 30 20 44 49  T 78 + + col0 DI
316d0 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  V + cor0.col1 + 
316e0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
316f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31700 31 30 39 0d 0a 31 33 38 0d 0a 39 39 0d 0a 0d 0a  109..138..99....
31710 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
31720 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
31730 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31740 61 62 65 6c 2d 31 34 38 39 0d 0a 53 45 4c 45 43  abel-1489..SELEC
31750 54 20 44 49 53 54 49 4e 43 54 20 37 38 20 2b 20  T DISTINCT 78 + 
31760 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 72 30 2e  + col0 / + cor0.
31770 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52  col1 + + col1 FR
31780 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
31790 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 31 33 38 0d  .----..109..138.
317a0 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .99....query I r
317b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
317c0 20 33 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   32 AS col0 FROM
317d0 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
317e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
317f0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
31800 66 38 66 39 33 31 31 39 39 38 33 62 39 36 32 66  f8f93119983b962f
31810 34 63 38 31 33 38 31 65 62 66 34 62 31 65 36 0d  4c81381ebf4b1e6.
31820 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31830 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 37  rt..SELECT + + 7
31840 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
31850 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
31860 2d 0d 0a 37 39 0d 0a 37 39 0d 0a 37 39 0d 0a 0d  -..79..79..79...
31870 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
31880 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
31890 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
318a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
318b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
318c0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 32 0d 0a  ort label-1492..
318d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
318e0 2d 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41  - CAST( - col2 A
318f0 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
31900 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
31910 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
31920 33 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66  36..57....skipif
31930 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
31940 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
31950 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
31960 34 39 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  492..SELECT DIST
31970 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 2d 20  INCT - CAST ( - 
31980 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
31990 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) + col0 FROM ta
319a0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
319b0 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d  ..171..36..57...
319c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
319d0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
319e0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
319f0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
31a00 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
31a10 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 33 0d 0a  ort label-1493..
31a20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31a30 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
31a40 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
31a50 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  0 * - col2 + + c
31a60 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
31a70 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
31a80 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
31a90 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
31aa0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
31ab0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31ac0 6c 2d 31 34 39 33 0d 0a 53 45 4c 45 43 54 20 44  l-1493..SELECT D
31ad0 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28  ISTINCT - CAST (
31ae0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
31af0 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20   ) * - col0 * - 
31b00 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col2 + + col2 AS
31b10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
31b20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
31b30 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
31b40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
31b50 4c 4c 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63  LL col2 + tab0.c
31b60 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 * + tab0.col
31b70 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
31b80 2d 0d 0a 32 30 39 37 0d 0a 33 33 39 36 0d 0a 38  -..2097..3396..8
31b90 31 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  181....query I r
31ba0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
31bb0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a   col2 + + col2 *
31bc0 20 2b 20 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a   + 8 FROM tab0..
31bd0 2d 2d 2d 2d 0d 0a 32 33 31 0d 0a 35 37 34 0d 0a  ----..231..574..
31be0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
31bf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31c00 54 49 4e 43 54 20 37 33 20 41 53 20 63 6f 6c 32  TINCT 73 AS col2
31c10 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
31c20 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
31c30 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d 0a 0d  or1..----..73...
31c40 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
31c50 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
31c60 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
31c70 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
31c80 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
31c90 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 37 0d 0a  ort label-1497..
31ca0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2d 20  SELECT + col2 - 
31cb0 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20 41  + CAST( + col0 A
31cc0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c  S SIGNED ) * col
31cd0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
31ce0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d  or0..----..-108.
31cf0 0a 2d 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d  .-3591..-7584...
31d00 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
31d10 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
31d20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31d30 6c 61 62 65 6c 2d 31 34 39 37 0d 0a 53 45 4c 45  label-1497..SELE
31d40 43 54 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 43 41  CT + col2 - + CA
31d50 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53 20 49  ST ( + col0 AS I
31d60 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32 20  NTEGER ) * col2 
31d70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
31d80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d  0..----..-108..-
31d90 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 71  3591..-7584....q
31da0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31db0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31dc0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col1 * - col0 * 
31dd0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  - cor0.col2 + + 
31de0 63 6f 6c 30 20 2b 20 28 20 63 6f 6c 31 20 2a 20  col0 + ( col1 * 
31df0 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  - col1 ) FROM ta
31e00 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
31e10 35 39 37 39 0d 0a 36 30 37 34 30 0d 0a 36 35 35  5979..60740..655
31e20 39 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  926....query I r
31e30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
31e40 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  LL + + col0 + co
31e50 6c 32 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29 20  l2 * - ( col0 ) 
31e60 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c  + col2 * + ( col
31e70 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  1 ) FROM tab0 AS
31e80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37   cor0..----..207
31e90 30 0d 0a 32 35 33 0d 0a 39 37 0d 0a 0d 0a 71 75  0..253..97....qu
31ea0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31eb0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b  ELECT ALL col1 +
31ec0 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
31ed0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32  ab1..----..20..2
31ee0 36 0d 0a 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..52....skipif 
31ef0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
31f00 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
31f10 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
31f20 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
31f30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31f40 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
31f50 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 32 20  col1 + + ( col2 
31f60 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  ) col2 FROM tab1
31f70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31f80 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71  109..67..80....q
31f90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31fa0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31fb0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  + cor0.col1 + co
31fc0 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  l2 * - col0 * - 
31fd0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
31fe0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
31ff0 2d 0d 0a 32 33 33 34 38 32 0d 0a 35 31 32 0d 0a  -..233482..512..
32000 36 31 34 34 31 33 0d 0a 0d 0a 71 75 65 72 79 20  614413....query 
32010 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32020 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 28 20 2b  T ALL col0 * ( +
32030 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 46   col2 ) + col0 F
32040 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
32050 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31  ..----..165..371
32060 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79  2..7760....query
32070 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32080 43 54 20 63 6f 6c 30 20 2a 20 33 35 20 2b 20 2d  CT col0 * 35 + -
32090 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
320a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
320b0 2d 2d 0d 0a 32 31 34 0d 0a 32 36 37 31 0d 0a 32  --..214..2671..2
320c0 37 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  748....query I r
320d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
320e0 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 33 39 20 2b  LL - col1 + 39 +
320f0 20 32 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   24 AS col2 FROM
32100 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32110 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 38 0d 0a 2d  ---..-23..-28..-
32120 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
32130 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
32140 37 30 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20  70 + - col1 + + 
32150 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col0 * col2 FROM
32160 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
32170 0d 0a 33 35 36 38 0d 0a 36 36 0d 0a 37 35 39 37  ..3568..66..7597
32180 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32190 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
321a0 38 39 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 72 30  89 * col0 + cor0
321b0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
321c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
321d0 0a 2d 2d 2d 2d 0d 0a 36 35 30 0d 0a 36 39 36 38  .----..650..6968
321e0 0d 0a 37 30 36 39 0d 0a 0d 0a 71 75 65 72 79 20  ..7069....query 
321f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32200 54 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 72  T + col1 - + cor
32210 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
32220 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
32230 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
32240 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32250 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28  rt..SELECT + - (
32260 20 2b 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31   + col2 ) + col1
32270 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32280 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
32290 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a  28..-47..-83....
322a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
322b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
322c0 20 2b 20 2d 20 38 31 20 41 53 20 63 6f 6c 31 20   + - 81 AS col1 
322d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
322e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 36  0..----..-55..-6
322f0 38 0d 0a 2d 37 31 0d 0a 0d 0a 71 75 65 72 79 20  8..-71....query 
32300 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32310 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 39 33 20  T + col2 * - 93 
32320 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
32330 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32340 0d 0a 2d 32 33 35 39 0d 0a 2d 32 34 38 30 0d 0a  ..-2359..-2480..
32350 2d 33 35 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -3517....query I
32360 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32370 20 44 49 53 54 49 4e 43 54 20 2b 20 38 33 20 2a   DISTINCT + 83 *
32380 20 28 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( + col1 ) FROM
32390 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
323a0 2d 2d 2d 0d 0a 31 30 37 39 0d 0a 32 31 35 38 0d  ---..1079..2158.
323b0 0a 38 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .830....query I 
323c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
323d0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20  + cor0.col1 + - 
323e0 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  col0 - cor0.col0
323f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
32400 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a  r0..----..-118..
32410 2d 31 34 37 0d 0a 32 30 0d 0a 0d 0a 6f 6e 6c 79  -147..20....only
32420 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
32430 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
32440 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
32450 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
32460 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32470 61 62 65 6c 2d 31 35 31 34 0d 0a 53 45 4c 45 43  abel-1514..SELEC
32480 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  T CAST( NULL AS 
32490 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 72 30 2e  SIGNED ) + cor0.
324a0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
324b0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
324c0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
324d0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
324e0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
324f0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
32500 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
32510 35 31 34 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  514..SELECT CAST
32520 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
32530 45 52 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  ER ) + cor0.col2
32540 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
32550 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
32560 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
32570 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
32580 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
32590 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  L cor0.col2 FROM
325a0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
325b0 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
325c0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
325d0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 66  es hashing to 7f
325e0 34 61 39 62 66 32 34 64 36 34 38 33 33 37 30 36  4a9bf24d64833706
325f0 64 66 62 64 64 30 62 61 66 34 39 64 37 39 0d 0a  dfbdd0baf49d79..
32600 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32610 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 31  t..SELECT - tab1
32620 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20  .col1 * col2 AS 
32630 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
32640 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34  ----..-1248..-14
32650 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72  04..-570....quer
32660 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32670 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
32680 20 32 30 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f   20 - col2 AS co
32690 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
326a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d  cor0..----..-18.
326b0 0a 2d 36 0d 0a 2d 37 0d 0a 0d 0a 71 75 65 72 79  .-6..-7....query
326c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
326d0 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
326e0 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  col1 * col0 AS c
326f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
32700 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
32710 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d  40..-640..-78...
32720 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32730 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
32740 54 20 2b 20 2d 20 35 39 20 2b 20 2b 20 63 6f 6c  T + - 59 + + col
32750 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
32760 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
32770 2d 0d 0a 2d 35 36 0d 0a 32 31 0d 0a 35 0d 0a 0d  -..-56..21..5...
32780 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
32790 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
327a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
327b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
327c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32  owsort label-152
327d0 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
327e0 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f  CT - col2 DIV co
327f0 6c 30 20 2b 20 2d 20 28 20 39 38 20 29 20 46 52  l0 + - ( 98 ) FR
32800 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32810 0a 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a 2d 39 39 0d  .----..-98..-99.
32820 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32830 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32850 74 20 6c 61 62 65 6c 2d 31 35 32 30 0d 0a 53 45  t label-1520..SE
32860 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
32870 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 2d 20  col2 / col0 + - 
32880 28 20 39 38 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 98 ) FROM tab0
32890 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
328a0 2d 39 38 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72  -98..-99....quer
328b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
328c0 45 43 54 20 41 4c 4c 20 2b 20 31 39 20 41 53 20  ECT ALL + 19 AS 
328d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
328e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
328f0 0d 0a 31 39 0d 0a 31 39 0d 0a 0d 0a 71 75 65 72  ..19..19....quer
32900 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32910 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 39 20  ECT DISTINCT 99 
32920 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
32930 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32940 0d 0a 31 30 32 0d 0a 31 36 33 0d 0a 31 37 39 0d  ..102..163..179.
32950 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32960 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
32970 20 30 20 2a 20 63 6f 6c 30 20 2d 20 28 20 2b 20   0 * col0 - ( + 
32980 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
32990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
329a0 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d  -17..-31..-59...
329b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
329c0 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
329d0 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63  0 * + col1 * ( c
329e0 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20  or0.col2 ) FROM 
329f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
32a00 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36 34 31  --..-3395..-6641
32a10 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a 71 75  18..-68112....qu
32a20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32a30 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
32a40 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  l2 + col2 * col1
32a50 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
32a60 0a 2d 2d 2d 2d 0d 0a 32 38 30 35 0d 0a 37 33 38  .----..2805..738
32a70 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  0..96....query I
32a80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32a90 20 44 49 53 54 49 4e 43 54 20 2d 20 34 30 20 2d   DISTINCT - 40 -
32aa0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
32ab0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
32ac0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32  cor0..----..-122
32ad0 0d 0a 2d 34 31 0d 0a 2d 37 33 0d 0a 0d 0a 71 75  ..-41..-73....qu
32ae0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32af0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
32b00 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  l2 + col2 * + co
32b10 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
32b20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
32b30 0a 31 30 38 0d 0a 33 35 39 31 0d 0a 37 35 38 34  .108..3591..7584
32b40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32b50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
32b60 39 33 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 37 39  93 * + col1 + 79
32b70 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
32b80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
32b90 0d 0a 38 30 37 37 0d 0a 38 35 34 32 0d 0a 39 31  ..8077..8542..91
32ba0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
32bb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32bc0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f  STINCT col0 * co
32bd0 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  l0 - + col0 * - 
32be0 32 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  29 FROM tab0 AS 
32bf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 30  cor0..----..1050
32c00 32 0d 0a 31 32 37 32 0d 0a 32 32 34 30 0d 0a 0d  2..1272..2240...
32c10 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
32c20 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
32c30 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
32c40 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
32c50 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
32c60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32c70 54 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 63 6f  T col0 - col1 co
32c80 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
32c90 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32  --..-2..-62..-62
32ca0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
32cb0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
32cc0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
32cd0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
32ce0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
32cf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32d00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
32d10 39 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  92 col0 FROM tab
32d20 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32d30 0a 2d 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-92....skipif p
32d40 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
32d50 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
32d60 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
32d70 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
32d80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32d90 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
32da0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  + cor0.col2 * co
32db0 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
32dc0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
32dd0 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31  .196..2106..3081
32de0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
32df0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
32e00 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
32e10 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
32e20 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
32e30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
32e40 4c 45 43 54 20 2d 20 37 35 20 63 6f 6c 31 20 46  LECT - 75 col1 F
32e50 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
32e60 2d 37 35 0d 0a 2d 37 35 0d 0a 2d 37 35 0d 0a 0d  -75..-75..-75...
32e70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32e80 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 72  ..SELECT - ( cor
32e90 30 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  0.col0 ) FROM ta
32ea0 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b2 AS cor0 CROSS
32eb0 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f   JOIN tab0 AS co
32ec0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
32ed0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 30  es hashing to 30
32ee0 30 30 33 33 37 64 64 33 66 31 31 65 39 63 66 64  00337dd3f11e9cfd
32ef0 35 61 33 31 32 62 30 31 65 66 33 66 38 62 0d 0a  5a312b01ef3f8b..
32f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32f10 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
32f20 6c 32 20 2b 20 2d 20 32 33 20 2a 20 2d 20 28 20  l2 + - 23 * - ( 
32f30 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46  col2 ) AS col1 F
32f40 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
32f50 2d 2d 2d 0d 0a 31 39 36 38 0d 0a 32 34 0d 0a 37  ---..1968..24..7
32f60 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
32f70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
32f80 63 6f 6c 32 20 2a 20 2d 20 33 33 20 2b 20 2b 20  col2 * - 33 + + 
32f90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
32fa0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
32fb0 37 35 0d 0a 31 33 30 0d 0a 32 37 39 37 0d 0a 0d  75..130..2797...
32fc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32fd0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
32fe0 63 6f 6c 30 20 2b 20 2b 20 37 33 20 41 53 20 63  col0 + + 73 AS c
32ff0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
33000 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d   cor0..----..-5.
33010 0a 2d 36 0d 0a 36 36 0d 0a 0d 0a 73 6b 69 70 69  .-6..66....skipi
33020 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
33030 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
33040 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
33050 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
33060 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
33070 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  ort..SELECT - ta
33080 62 32 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f  b2.col2 col0 FRO
33090 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
330a0 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 71  6..-27..-38....q
330b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
330c0 53 45 4c 45 43 54 20 2d 20 35 34 20 46 52 4f 4d  SELECT - 54 FROM
330d0 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
330e0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
330f0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
33100 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
33110 20 34 65 63 64 62 30 66 31 62 38 35 66 30 64 34   4ecdb0f1b85f0d4
33120 66 64 63 33 61 38 32 36 65 66 64 39 66 32 33 34  fdc3a826efd9f234
33130 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
33140 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
33150 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  0.col0 * col2 + 
33160 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
33170 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33180 31 30 38 0d 0a 33 35 39 31 0d 0a 37 35 38 34 0d  108..3591..7584.
33190 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
331a0 72 74 0d 0a 53 45 4c 45 43 54 20 32 33 20 2a 20  rt..SELECT 23 * 
331b0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  - col2 FROM tab0
331c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 38 36 0d 0a 2d  ..----..-1886..-
331d0 32 33 0d 0a 2d 37 35 39 0d 0a 0d 0a 71 75 65 72  23..-759....quer
331e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
331f0 45 43 54 20 2b 20 31 20 2a 20 2b 20 63 6f 6c 32  ECT + 1 * + col2
33200 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
33210 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
33220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35  or0..----..52..5
33230 34 0d 0a 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..76....skipif 
33240 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
33250 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
33260 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
33270 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
33280 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33290 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
332a0 43 54 20 2d 20 36 34 20 63 6f 6c 31 20 46 52 4f  CT - 64 col1 FRO
332b0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
332c0 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65  ----..-64....que
332d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
332e0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
332f0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col2 * - col2 AS
33300 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
33310 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
33320 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a  ..1089..6724....
33330 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
33340 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
33350 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
33360 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
33370 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
33380 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33390 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 31 20 29 20   ALL - ( col1 ) 
333a0 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  * + col1 col0 FR
333b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
333c0 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38  .----..-7396..-8
333d0 32 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75  281..-9409....qu
333e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
333f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
33400 20 28 20 30 20 29 20 41 53 20 63 6f 6c 30 20 46   ( 0 ) AS col0 F
33410 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
33420 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
33430 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33440 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32   + col0 + - col2
33450 20 2a 20 28 20 2d 20 37 39 20 29 20 46 52 4f 4d   * ( - 79 ) FROM
33460 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
33470 0d 0a 32 31 33 32 0d 0a 32 31 34 30 0d 0a 33 30  ..2132..2140..30
33480 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
33490 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
334a0 37 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  7 * col1 AS col2
334b0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
334c0 0d 0a 2d 36 30 32 0d 0a 2d 36 33 37 0d 0a 2d 36  ..-602..-637..-6
334d0 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  79....skipif pos
334e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
334f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
33500 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
33510 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
33520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33530 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
33540 2a 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  * col0 col1 FROM
33550 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33560 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
33570 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
33580 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33590 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ECT cor0.col2 * 
335a0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
335b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32   cor0..----..162
335c0 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a  ..3648..7680....
335d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
335e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 20 2a 20  .SELECT ALL 6 * 
335f0 35 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  50 + col2 AS col
33600 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
33610 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 31 0d 0a  or0..----..301..
33620 33 33 33 0d 0a 33 38 32 0d 0a 0d 0a 71 75 65 72  333..382....quer
33630 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33640 45 43 54 20 2b 20 38 30 20 2a 20 2b 20 63 6f 6c  ECT + 80 * + col
33650 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  2 + - col1 FROM 
33660 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
33670 2d 2d 0d 0a 2d 31 37 0d 0a 32 35 35 34 0d 0a 36  --..-17..2554..6
33680 34 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  469....query I r
33690 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
336a0 20 2b 20 39 38 20 41 53 20 63 6f 6c 30 20 46 52   + 98 AS col0 FR
336b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
336c0 0a 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a 2d 39 38 0d  .----..-98..-98.
336d0 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-98....query I 
336e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
336f0 44 49 53 54 49 4e 43 54 20 33 38 20 2b 20 2d 20  DISTINCT 38 + - 
33700 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
33710 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
33720 0d 0a 32 35 0d 0a 32 38 0d 0a 0d 0a 71 75 65 72  ..25..28....quer
33730 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33740 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30  ECT ALL - - col0
33750 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   * + col1 + col0
33760 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
33770 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38 0d 0a  r0..----..2088..
33780 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a 71 75  3430..8188....qu
33790 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
337a0 45 4c 45 43 54 20 2d 20 2d 20 32 35 20 2a 20 63  ELECT - - 25 * c
337b0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
337c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
337d0 0d 0a 31 33 35 30 0d 0a 31 34 32 35 0d 0a 32 34  ..1350..1425..24
337e0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
337f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
33800 2b 20 32 38 20 2b 20 2d 20 63 6f 6c 30 20 46 52  + 28 + - col0 FR
33810 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
33820 0a 2d 2d 2d 2d 0d 0a 2d 36 31 0d 0a 2d 37 0d 0a  .----..-61..-7..
33830 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
33840 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33850 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d   - cor0.col0 + -
33860 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
33870 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
33880 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
33890 2d 0d 0a 2d 31 36 35 0d 0a 2d 33 37 31 32 0d 0a  -..-165..-3712..
338a0 2d 37 37 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -7760....onlyif 
338b0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
338c0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
338d0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
338e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
338f0 61 62 65 6c 2d 31 35 35 39 0d 0a 53 45 4c 45 43  abel-1559..SELEC
33900 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37 30 20  T DISTINCT + 70 
33910 44 49 56 20 2d 20 35 36 20 2d 20 2b 20 63 6f 6c  DIV - 56 - + col
33920 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
33930 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a  or0..----..-55..
33940 2d 35 38 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70  -58..-97....skip
33950 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
33960 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
33970 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33980 2d 31 35 35 39 0d 0a 53 45 4c 45 43 54 20 44 49  -1559..SELECT DI
33990 53 54 49 4e 43 54 20 2b 20 37 30 20 2f 20 2d 20  STINCT + 70 / - 
339a0 35 36 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  56 - + col2 FROM
339b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
339c0 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d  ---..-55..-58..-
339d0 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  97....onlyif mys
339e0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
339f0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
33a00 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
33a10 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
33a20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
33a30 35 36 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  560..SELECT DIST
33a40 49 4e 43 54 20 2d 20 34 30 20 2a 20 63 6f 6c 32  INCT - 40 * col2
33a50 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   * CAST( NULL AS
33a60 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f   SIGNED ) + - co
33a70 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
33a80 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
33a90 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
33aa0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
33ab0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
33ac0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33ad0 2d 31 35 36 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1560..SELECT DI
33ae0 53 54 49 4e 43 54 20 2d 20 34 30 20 2a 20 63 6f  STINCT - 40 * co
33af0 6c 32 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l2 * CAST ( NULL
33b00 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
33b10 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
33b20 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
33b30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
33b40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33b50 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
33b60 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 + col0 AS col
33b70 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
33b80 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d  ..----..14..156.
33b90 0a 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .158....query I 
33ba0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33bb0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
33bc0 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  2 + col1 * - col
33bd0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
33be0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
33bf0 2d 0d 0a 2d 31 35 36 30 0d 0a 2d 36 38 34 0d 0a  -..-1560..-684..
33c00 2d 38 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -864....skipif p
33c10 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
33c20 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
33c30 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
33c40 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
33c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33c60 0d 0a 53 45 4c 45 43 54 20 33 39 20 2a 20 63 6f  ..SELECT 39 * co
33c70 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
33c80 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
33c90 0a 32 37 33 0d 0a 33 30 34 32 0d 0a 33 30 38 31  .273..3042..3081
33ca0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33cb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
33cc0 2b 20 37 37 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  + 77 + cor0.col2
33cd0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
33ce0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31  r0..----..103..1
33cf0 30 34 0d 0a 31 31 35 0d 0a 0d 0a 6f 6e 6c 79 69  04..115....onlyi
33d00 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
33d10 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
33d20 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
33d30 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
33d40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33d50 62 65 6c 2d 31 35 36 35 0d 0a 53 45 4c 45 43 54  bel-1565..SELECT
33d60 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54   DISTINCT - CAST
33d70 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
33d80 20 29 20 2f 20 2d 20 37 39 20 41 53 20 63 6f 6c   ) / - 79 AS col
33d90 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  1 FROM tab1, tab
33da0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
33db0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
33dc0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33dd0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33de0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
33df0 36 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  65..SELECT DISTI
33e00 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  NCT - CAST ( NUL
33e10 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f  L AS INTEGER ) /
33e20 20 2d 20 37 39 20 41 53 20 63 6f 6c 31 20 46 52   - 79 AS col1 FR
33e30 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
33e40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
33e50 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
33e60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
33e70 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 31  ol1 * col2 * - 1
33e80 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
33e90 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
33ea0 2d 0d 0a 31 30 33 33 36 0d 0a 31 33 33 39 32 0d  -..10336..13392.
33eb0 0a 32 34 35 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  .24544....onlyif
33ec0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
33ed0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
33ee0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
33ef0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
33f00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
33f10 65 6c 2d 31 35 36 37 0d 0a 53 45 4c 45 43 54 20  el-1567..SELECT 
33f20 2d 20 2d 20 39 35 20 2a 20 63 6f 6c 32 20 2a 20  - - 95 * col2 * 
33f30 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 4e  col1 + - CAST( N
33f40 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
33f50 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
33f60 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
33f70 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
33f80 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
33f90 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
33fa0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33fb0 31 35 36 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  1567..SELECT - -
33fc0 20 39 35 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c   95 * col2 * col
33fd0 31 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  1 + - CAST ( NUL
33fe0 4c 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d  L AS REAL ) FROM
33ff0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
34000 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
34010 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
34020 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34030 4c 20 38 38 20 2b 20 2b 20 33 30 20 41 53 20 63  L 88 + + 30 AS c
34040 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
34050 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   cor0..----..118
34060 0d 0a 31 31 38 0d 0a 31 31 38 0d 0a 0d 0a 73 6b  ..118..118....sk
34070 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
34080 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
34090 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
340a0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
340b0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
340c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
340d0 6f 6c 31 20 2a 20 37 30 20 63 6f 6c 30 20 46 52  ol1 * 70 col0 FR
340e0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
340f0 38 32 30 0d 0a 37 30 30 0d 0a 39 31 30 0d 0a 0d  820..700..910...
34100 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34110 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
34120 54 20 2b 20 39 34 20 46 52 4f 4d 20 74 61 62 31  T + 94 FROM tab1
34130 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20  , tab1 AS cor0, 
34140 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
34150 2d 2d 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20  --..94....query 
34160 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34170 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  T - - col0 * - c
34180 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 + + col1 FRO
34190 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
341a0 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32  ----..-1027..-52
341b0 0d 0a 2d 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-630....query 
341c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
341d0 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  T col0 * + col2 
341e0 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
341f0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 37 36  b2..----..114076
34200 0d 0a 35 31 30 33 0d 0a 35 32 37 32 38 0d 0a 0d  ..5103..52728...
34210 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34220 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
34230 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  T col1 * + col1 
34240 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
34250 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
34260 33 30 36 0d 0a 33 35 34 30 0d 0a 39 39 32 0d 0a  306..3540..992..
34270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34280 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34290 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  CT + col0 + col1
342a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
342b0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31  b0..----..110..1
342c0 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79  32..180....query
342d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
342e0 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63  CT tab1.col0 + c
342f0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 * + col1 AS 
34300 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
34310 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a 31 34 30 37  ----..1328..1407
34320 0d 0a 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..634....query I
34330 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34340 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   ALL col1 * col2
34350 20 2b 20 36 30 20 41 53 20 63 6f 6c 32 20 46 52   + 60 AS col2 FR
34360 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
34370 35 37 0d 0a 32 38 39 38 0d 0a 37 35 32 32 0d 0a  57..2898..7522..
34380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34390 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
343a0 6c 30 20 2b 20 32 31 20 2a 20 63 6f 6c 31 20 41  l0 + 21 * col1 A
343b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
343c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
343d0 31 33 31 37 0d 0a 34 33 36 0d 0a 36 35 38 0d 0a  1317..436..658..
343e0 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
343f0 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
34400 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  LECT * FROM tab1
34410 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
34420 4f 49 4e 20 74 61 62 32 2c 20 74 61 62 32 20 63  OIN tab2, tab2 c
34430 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or1, tab0 AS cor
34440 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c  2..----..972 val
34450 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65  ues hashing to e
34460 34 63 37 34 38 66 32 36 37 65 38 64 32 61 30 65  4c748f267e8d2a0e
34470 36 64 35 36 33 32 38 31 65 31 66 62 39 37 35 0d  6d563281e1fb975.
34480 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
34490 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
344a0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
344b0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
344c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
344d0 35 37 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  579..SELECT ALL 
344e0 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20  - col0 DIV col2 
344f0 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  + - col2 * col2 
34500 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
34510 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 36 0d 0a  0..----..-2916..
34520 2d 33 32 35 30 0d 0a 2d 39 32 31 36 0d 0a 0d 0a  -3250..-9216....
34530 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
34540 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
34550 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34560 61 62 65 6c 2d 31 35 37 39 0d 0a 53 45 4c 45 43  abel-1579..SELEC
34570 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2f 20 63  T ALL - col0 / c
34580 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  ol2 + - col2 * c
34590 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
345a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39   cor0..----..-29
345b0 31 36 0d 0a 2d 33 32 35 30 0d 0a 2d 39 32 31 36  16..-3250..-9216
345c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
345d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
345e0 28 20 28 20 74 61 62 32 2e 63 6f 6c 32 20 29 20  ( ( tab2.col2 ) 
345f0 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  ) FROM tab2, tab
34600 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor0..----..9 
34610 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
34620 6f 20 35 39 31 31 62 61 63 35 31 34 34 31 66 34  o 5911bac51441f4
34630 66 66 36 34 30 62 32 61 32 62 37 32 31 65 61 38  ff640b2a2b721ea8
34640 65 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  e3....query I ro
34650 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 32  wsort..SELECT 82
34660 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 20   FROM tab0 cor0 
34670 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
34680 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
34690 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
346a0 74 6f 20 66 33 31 38 66 64 39 64 61 63 32 64 65  to f318fd9dac2de
346b0 37 61 66 34 62 38 32 63 63 37 35 37 34 62 62 63  7af4b82cc7574bbc
346c0 61 32 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  a2c....query I r
346d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32  owsort..SELECT 2
346e0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
346f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34700 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
34710 20 74 6f 20 38 34 64 62 66 61 66 39 62 63 31 37   to 84dbfaf9bc17
34720 64 64 30 39 37 66 31 35 62 63 33 36 62 34 31 38  dd097f15bc36b418
34730 36 32 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6261....query I 
34740 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34750 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20  ( col2 ) + col0 
34760 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
34770 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a  .171..36..57....
34780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34790 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 31  .SELECT ALL + 41
347a0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
347b0 0d 0a 34 31 0d 0a 34 31 0d 0a 34 31 0d 0a 0d 0a  ..41..41..41....
347c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
347d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
347e0 20 33 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   32 FROM tab0 co
347f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 0d 0a  r0..----..32....
34800 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34810 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
34820 6c 30 20 2b 20 34 31 20 2a 20 63 6f 6c 32 20 41  l0 + 41 * col2 A
34830 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
34840 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34850 31 31 30 30 0d 0a 31 34 37 39 0d 0a 39 38 38 0d  1100..1479..988.
34860 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34870 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
34880 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  NCT cor0.col1 * 
34890 2d 20 35 33 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  - 53 + col0 FROM
348a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
348b0 2d 2d 2d 0d 0a 2d 31 36 33 36 0d 0a 2d 33 30 34  ---..-1636..-304
348c0 39 0d 0a 2d 38 32 32 0d 0a 0d 0a 71 75 65 72 79  9..-822....query
348d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
348e0 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20  CT + + ( + col1 
348f0 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ) * col0 AS col0
34900 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
34910 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30  .----..1040..640
34920 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ..78....query II
34930 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
34940 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
34950 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c  NCT * FROM tab0,
34960 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74   tab1 AS cor0, t
34970 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab0 AS cor1, tab
34980 30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37  0 cor2..----..97
34990 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
349a0 20 74 6f 20 38 34 32 30 32 30 36 64 36 39 33 32   to 8420206d6932
349b0 63 34 35 34 66 30 35 61 33 38 64 65 36 33 34 62  c454f05a38de634b
349c0 33 63 62 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3cb5....onlyif m
349d0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
349e0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
349f0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
34a00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34a10 62 65 6c 2d 31 35 39 30 0d 0a 53 45 4c 45 43 54  bel-1590..SELECT
34a20 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20   DISTINCT - ( + 
34a30 31 36 20 29 20 44 49 56 20 63 6f 6c 30 20 46 52  16 ) DIV col0 FR
34a40 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
34a50 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
34a60 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
34a70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
34a80 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
34a90 39 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  90..SELECT DISTI
34aa0 4e 43 54 20 2d 20 28 20 2b 20 31 36 20 29 20 2f  NCT - ( + 16 ) /
34ab0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
34ac0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
34ad0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34ae0 0d 0a 53 45 4c 45 43 54 20 2d 20 37 37 20 2a 20  ..SELECT - 77 * 
34af0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
34b00 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34 38 0d 0a 2d  ..----..-1848..-
34b10 32 36 39 35 0d 0a 2d 36 38 35 33 0d 0a 0d 0a 71  2695..-6853....q
34b20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34b30 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
34b40 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46  l1 * cor0.col0 F
34b50 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
34b60 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d  ..----..-2064..-
34b70 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71  3395..-8099....q
34b80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34b90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34ba0 35 36 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  56 * col2 * + co
34bb0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
34bc0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
34bd0 2d 2d 0d 0a 31 35 38 39 32 38 0d 0a 34 31 37 38  --..158928..4178
34be0 37 32 0d 0a 35 34 33 32 0d 0a 0d 0a 71 75 65 72  72..5432....quer
34bf0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34c00 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  ECT col0 * + col
34c10 32 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41 53  2 + tab2.col0 AS
34c20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
34c30 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 31 30 36  .----..196..2106
34c40 0d 0a 33 30 38 31 0d 0a 0d 0a 71 75 65 72 79 20  ..3081....query 
34c50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34c60 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
34c70 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 - - col2 AS co
34c80 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
34c90 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37  --..121..176..57
34ca0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
34cb0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
34cc0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
34cd0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
34ce0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
34cf0 31 35 39 36 0d 0a 53 45 4c 45 43 54 20 32 31 20  1596..SELECT 21 
34d00 44 49 56 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52  DIV col0 col2 FR
34d10 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
34d20 0d 0a 30 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..7....skipif
34d30 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
34d40 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
34d50 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
34d60 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
34d70 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
34d80 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
34d90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34da0 74 20 6c 61 62 65 6c 2d 31 35 39 36 0d 0a 53 45  t label-1596..SE
34db0 4c 45 43 54 20 32 31 20 2f 20 63 6f 6c 30 20 63  LECT 21 / col0 c
34dc0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
34dd0 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 37 0d 0a 0d 0a  ---..0..0..7....
34de0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34df0 0a 53 45 4c 45 43 54 20 2b 20 37 30 20 2b 20 2b  .SELECT + 70 + +
34e00 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
34e10 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
34e20 30 33 0d 0a 31 35 32 0d 0a 37 31 0d 0a 0d 0a 71  03..152..71....q
34e30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34e40 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
34e50 31 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  1 - col2 AS col2
34e60 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
34e70 0d 0a 2d 31 31 39 0d 0a 2d 31 37 33 0d 0a 2d 39  ..-119..-173..-9
34e80 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
34e90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
34ea0 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63  ol2 * col2 + + c
34eb0 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20  ol1 * tab1.col2 
34ec0 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + - col2 * + col
34ed0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
34ee0 2d 0d 0a 2d 31 35 36 34 38 0d 0a 2d 31 36 37 34  -..-15648..-1674
34ef0 0d 0a 2d 36 33 32 37 0d 0a 0d 0a 71 75 65 72 79  ..-6327....query
34f00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34f10 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
34f20 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2d  l0 + tab1.col1 -
34f30 20 37 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   72 FROM tab1..-
34f40 2d 2d 2d 0d 0a 2d 34 33 0d 0a 32 0d 0a 32 31 0d  ---..-43..2..21.
34f50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34f60 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
34f70 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
34f80 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
34f90 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34  ..----..49..6084
34fa0 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6241....query 
34fb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34fc0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63  T DISTINCT + ( c
34fd0 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46  ol2 ) + + col1 F
34fe0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34ff0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d  ..----..109..67.
35000 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
35010 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35020 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41  LL + cor0.col2 A
35030 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
35040 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  , tab2, tab1 AS 
35050 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
35060 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
35070 20 37 66 34 61 39 62 66 32 34 64 36 34 38 33 33   7f4a9bf24d64833
35080 37 30 36 64 66 62 64 64 30 62 61 66 34 39 64 37  706dfbdd0baf49d7
35090 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
350a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
350b0 35 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  5 * col0 FROM ta
350c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
350d0 0d 0a 2d 31 30 35 0d 0a 2d 32 32 34 30 0d 0a 2d  ..-105..-2240..-
350e0 32 38 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2800....query I 
350f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35100 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  + + col0 * cor0.
35110 63 6f 6c 30 20 2b 20 2d 20 35 31 20 2b 20 2d 20  col0 + - 51 + - 
35120 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
35130 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
35140 35 0d 0a 33 39 38 31 0d 0a 36 32 36 39 0d 0a 0d  5..3981..6269...
35150 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35160 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
35170 2b 20 31 34 20 46 52 4f 4d 20 74 61 62 30 20 63  + 14 FROM tab0 c
35180 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
35190 31 30 35 0d 0a 31 31 31 0d 0a 0d 0a 6f 6e 6c 79  105..111....only
351a0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
351b0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
351c0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
351d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
351e0 74 20 6c 61 62 65 6c 2d 31 36 30 37 0d 0a 53 45  t label-1607..SE
351f0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 72  LECT ALL + - cor
35200 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 44 49  0.col0 * col0 DI
35210 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  V - col1 FROM ta
35220 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
35230 0d 0a 31 32 0d 0a 36 0d 0a 38 37 0d 0a 0d 0a 73  ..12..6..87....s
35240 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
35250 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
35260 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35270 62 65 6c 2d 31 36 30 37 0d 0a 53 45 4c 45 43 54  bel-1607..SELECT
35280 20 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f   ALL + - cor0.co
35290 6c 30 20 2a 20 63 6f 6c 30 20 2f 20 2d 20 63 6f  l0 * col0 / - co
352a0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
352b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a  cor0..----..12..
352c0 36 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..87....query I
352d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
352e0 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   - + col0 * + co
352f0 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l2 + col2 + col0
35300 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
35310 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
35320 0d 0a 2d 31 35 35 0d 0a 2d 31 39 32 34 0d 0a 2d  ..-155..-1924..-
35330 32 38 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2885....query I 
35340 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35350 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
35360 2b 20 36 39 20 46 52 4f 4d 20 74 61 62 30 20 41  + 69 FROM tab0 A
35370 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
35380 37 37 0d 0a 35 36 35 38 0d 0a 36 39 0d 0a 0d 0a  77..5658..69....
35390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
353a0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
353b0 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol1 * col2 AS co
353c0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
353d0 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35 39 34 37  --..10982..25947
353e0 0d 0a 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72 79  ..90506....query
353f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35400 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  CT - + col2 + co
35410 6c 32 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 - col0 AS col
35420 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
35430 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d  or0..----..-3..-
35440 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79  64..-80....query
35450 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35460 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20 63 6f 6c  CT ALL + ( + col
35470 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  2 ) AS col0 FROM
35480 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
35490 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  33..82....query 
354a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
354b0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T + cor0.col2 * 
354c0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  + cor0.col0 * + 
354d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
354e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d  or0..----..3395.
354f0 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a  .664118..68112..
35500 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35510 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35520 43 54 20 2b 20 63 6f 6c 31 20 2a 20 32 34 20 41  CT + col1 * 24 A
35530 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
35540 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35550 31 34 31 36 0d 0a 34 30 38 0d 0a 37 34 34 0d 0a  1416..408..744..
35560 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35570 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
35580 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 * + col1 AS c
35590 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
355a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34   cor0..----..134
355b0 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a  3..217..4602....
355c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
355d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
355e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
355f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
35600 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
35610 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35620 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 35 32   ALL col1 * - 52
35630 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 63   + col2 + col2 c
35640 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
35650 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34   cor0..----..-44
35660 30 36 0d 0a 2d 34 35 36 38 0d 0a 2d 35 30 34 32  06..-4568..-5042
35670 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35680 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
35690 2b 20 63 6f 6c 32 20 2a 20 2b 20 34 31 20 41 53  + col2 * + 41 AS
356a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
356b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
356c0 30 36 36 0d 0a 31 31 30 37 0d 0a 31 35 35 38 0d  066..1107..1558.
356d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
356e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
356f0 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT + - cor0.col
35700 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  2 * cor0.col0 + 
35710 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
35720 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
35730 2d 0d 0a 2d 31 38 32 0d 0a 2d 31 39 35 30 0d 0a  -..-182..-1950..
35740 2d 32 39 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -2923....onlyif 
35750 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
35760 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
35770 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
35780 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35790 61 62 65 6c 2d 31 36 31 39 0d 0a 53 45 4c 45 43  abel-1619..SELEC
357a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
357b0 30 20 44 49 56 20 2d 20 35 35 20 41 53 20 63 6f  0 DIV - 55 AS co
357c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
357d0 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  --..0..1....skip
357e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
357f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
35800 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35810 2d 31 36 31 39 0d 0a 53 45 4c 45 43 54 20 44 49  -1619..SELECT DI
35820 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2f 20  STINCT - col0 / 
35830 2d 20 35 35 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 55 AS col2 FRO
35840 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
35850 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .1....skipif pos
35860 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
35870 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
35880 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
35890 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
358a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
358b0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
358c0 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20  - tab2.col2 * + 
358d0 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
358e0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 34  ab2..----..-2054
358f0 0d 0a 2d 32 31 36 0d 0a 2d 33 30 34 30 0d 0a 0d  ..-216..-3040...
35900 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35910 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
35920 54 20 2b 20 36 31 20 41 53 20 63 6f 6c 30 20 46  T + 61 AS col0 F
35930 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
35940 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  61....query I ro
35950 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 32  wsort..SELECT 82
35960 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
35970 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 0d 0a 31 34  2..----..113..14
35980 31 0d 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  1..99....query I
35990 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
359a0 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20   DISTINCT + ( + 
359b0 35 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  52 ) AS col0 FRO
359c0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32  M tab2..----..52
359d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
359e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
359f0 49 4e 43 54 20 2d 20 28 20 28 20 63 6f 6c 30 20  INCT - ( ( col0 
35a00 29 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ) ) FROM tab0 AS
35a10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
35a20 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75  ..-35..-89....qu
35a30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35a40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30  ELECT ALL + cor0
35a50 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63  .col0 + - cor0.c
35a60 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 * + col1 AS 
35a70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
35a80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
35a90 34 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38 33 30 0d  456..-567..-830.
35aa0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35ab0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
35ac0 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d  NCT - - col2 * -
35ad0 20 37 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   72 AS col1 FROM
35ae0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
35af0 0d 0a 2d 31 38 37 32 0d 0a 2d 31 39 34 34 0d 0a  ..-1872..-1944..
35b00 2d 32 37 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -2736....query I
35b10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35b20 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
35b30 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 * + cor0.col2
35b40 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
35b50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
35b60 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d  ..-1534..-646..-
35b70 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
35b80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35b90 4c 4c 20 2b 20 2d 20 39 35 20 46 52 4f 4d 20 74  LL + - 95 FROM t
35ba0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
35bb0 2d 39 35 0d 0a 2d 39 35 0d 0a 2d 39 35 0d 0a 0d  -95..-95..-95...
35bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35bd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37  ..SELECT ALL + 7
35be0 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  9 AS col2 FROM t
35bf0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
35c00 2d 0d 0a 37 39 0d 0a 37 39 0d 0a 37 39 0d 0a 0d  -..79..79..79...
35c10 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
35c20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
35c30 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
35c40 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
35c50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33  owsort label-163
35c60 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  0..SELECT + col1
35c70 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63   DIV + col0 AS c
35c80 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
35c90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
35ca0 32 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2..3....skipif m
35cb0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
35cc0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
35cd0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33  owsort label-163
35ce0 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  0..SELECT + col1
35cf0 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   / + col0 AS col
35d00 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
35d10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
35d20 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .3....query I ro
35d30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
35d40 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
35d50 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
35d60 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35d70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31  ..----..-110..-1
35d80 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65 72  32..-180....quer
35d90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35da0 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  ECT col1 + cor0.
35db0 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 31 20  col0 + + ( col1 
35dc0 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 72  + col0 ) * + cor
35dd0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  0.col2 AS col1 F
35de0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
35df0 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 35 0d 0a 34 32  ..----..1595..42
35e00 39 32 0d 0a 39 30 32 31 0d 0a 0d 0a 71 75 65 72  92..9021....quer
35e10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35e20 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT - - cor0.col
35e30 30 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 32  0 - + col0 * - 2
35e40 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  8 AS col2 FROM t
35e50 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
35e60 2d 0d 0a 31 30 31 35 0d 0a 32 35 38 31 0d 0a 36  -..1015..2581..6
35e70 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  96....skipif pos
35e80 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
35e90 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
35ea0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
35eb0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
35ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35ed0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35ee0 28 20 2d 20 63 6f 6c 32 20 29 20 63 6f 6c 32 20  ( - col2 ) col2 
35ef0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
35f00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  0..----..-26..-2
35f10 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20  7..-38....query 
35f20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35f30 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2d  T DISTINCT + ( -
35f40 20 63 6f 6c 31 20 29 20 2a 20 2b 20 74 61 62 30   col1 ) * + tab0
35f50 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d  .col2 FROM tab0.
35f60 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37  .----..-2838..-7
35f70 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72  462..-97....quer
35f80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35f90 45 43 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT ( + cor0.col
35fa0 31 20 29 20 2b 20 2b 20 39 39 20 46 52 4f 4d 20  1 ) + + 99 FROM 
35fb0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
35fc0 0a 31 30 39 0d 0a 31 31 32 0d 0a 31 32 35 0d 0a  .109..112..125..
35fd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35fe0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 33 31  t..SELECT + + 31
35ff0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
36000 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
36010 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 38 34 0d 0a 32  0..----..1984..2
36020 34 38 30 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  480..93....query
36030 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36040 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20  CT ALL + - col0 
36050 2b 20 63 6f 6c 31 20 2a 20 34 38 20 46 52 4f 4d  + col1 * 48 FROM
36060 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36070 2d 2d 2d 0d 0a 34 31 30 34 0d 0a 34 32 37 39 0d  ---..4104..4279.
36080 0a 34 36 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .4621....query I
36090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
360a0 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20   ALL - + col2 * 
360b0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  col1 + col1 + - 
360c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
360d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
360e0 0d 0a 2d 32 37 38 35 0d 0a 2d 37 34 35 33 0d 0a  ..-2785..-7453..
360f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36100 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
36110 63 6f 6c 32 20 2a 20 2d 20 28 20 63 6f 6c 31 20  col2 * - ( col1 
36120 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
36130 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
36140 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
36150 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -837....query I 
36160 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36170 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28  ALL - col2 * + (
36180 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63   cor0.col2 + - c
36190 6f 6c 32 20 29 20 2a 20 2d 20 28 20 63 6f 6c 30  ol2 ) * - ( col0
361a0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
361b0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
361c0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
361d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
361e0 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
361f0 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  0 + col1 * cor0.
36200 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
36210 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
36220 2d 2d 2d 2d 0d 0a 2d 32 33 35 36 0d 0a 2d 34 39  ----..-2356..-49
36230 34 0d 0a 36 34 38 0d 0a 0d 0a 71 75 65 72 79 20  4..648....query 
36240 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36250 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T - - cor0.col1 
36260 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  * cor0.col2 + - 
36270 35 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  55 FROM tab0 AS 
36280 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 38 33  cor0..----..2783
36290 0d 0a 34 32 0d 0a 37 34 30 37 0d 0a 0d 0a 6f 6e  ..42..7407....on
362a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
362b0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
362c0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
362d0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
362e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
362f0 20 6c 61 62 65 6c 2d 31 36 34 34 0d 0a 53 45 4c   label-1644..SEL
36300 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
36310 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol0 * CAST( NULL
36320 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b   AS SIGNED ) + +
36330 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
36340 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
36350 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
36360 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
36370 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
36380 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 34 34  wsort label-1644
36390 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
363a0 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 20  T - col0 * CAST 
363b0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
363c0 52 20 29 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f  R ) + + col0 FRO
363d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
363e0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
363f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36400 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b  ELECT - + col0 +
36410 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46   ( cor0.col0 ) F
36420 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
36430 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
36440 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
36450 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
36460 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
36470 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
36480 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
36490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
364a0 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
364b0 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  1 * + col0 + col
364c0 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  1 col2 FROM tab1
364d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
364e0 31 30 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a  104..1053..650..
364f0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
36500 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
36510 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
36520 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
36530 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
36540 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36550 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
36560 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 31  l1 * + col2 col1
36570 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
36580 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36  .----..2838..746
36590 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  2..97....query I
365a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
365b0 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 28 20 63 6f   - + col0 + ( co
365c0 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c  r0.col1 ) AS col
365d0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
365e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  or0..----..-54..
365f0 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79  -67..23....query
36600 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36610 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41  CT + cor0.col0 A
36620 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
36630 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
36640 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
36650 61 73 68 69 6e 67 20 74 6f 20 38 62 34 39 37 39  ashing to 8b4979
36660 39 39 34 32 61 39 65 33 35 33 61 33 64 32 37 39  9942a9e353a3d279
36670 63 66 36 34 65 66 33 66 36 33 0d 0a 0d 0a 71 75  cf64ef3f63....qu
36680 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36690 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
366a0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  or0.col0 + - cor
366b0 31 2e 63 6f 6c 30 20 2b 20 2d 20 35 32 20 46 52  1.col0 + - 52 FR
366c0 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
366d0 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
366e0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
366f0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
36700 38 65 66 62 63 61 39 31 30 36 37 30 39 35 62 64  8efbca91067095bd
36710 63 32 32 31 32 31 35 63 30 33 62 31 30 33 64 0d  c221215c03b103d.
36720 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36730 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 33  rt..SELECT + + 3
36740 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  2 * col0 AS col2
36750 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
36760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  r0..----..1120..
36770 32 38 34 38 0d 0a 37 36 38 0d 0a 0d 0a 71 75 65  2848..768....que
36780 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36790 4c 45 43 54 20 41 4c 4c 20 2d 20 38 31 20 2a 20  LECT ALL - 81 * 
367a0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
367b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
367c0 34 33 37 34 0d 0a 34 36 31 37 0d 0a 37 37 37 36  4374..4617..7776
367d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
367e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
367f0 49 4e 43 54 20 2b 20 2b 20 33 31 20 41 53 20 63  INCT + + 31 AS c
36800 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
36810 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 0d 0a  r0..----..31....
36820 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
36830 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
36840 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
36850 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
36860 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
36870 72 74 20 6c 61 62 65 6c 2d 31 36 35 34 0d 0a 53  rt label-1654..S
36880 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55  ELECT - CAST( NU
36890 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  LL AS SIGNED ) *
368a0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
368b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
368c0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
368d0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
368e0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
368f0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
36900 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
36910 31 36 35 34 0d 0a 53 45 4c 45 43 54 20 2d 20 43  1654..SELECT - C
36920 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
36930 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 41  TEGER ) * col0 A
36940 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
36950 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36960 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
36970 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
36980 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
36990 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
369a0 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b1 cor0 CROSS JO
369b0 49 4e 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  IN tab0, tab2 AS
369c0 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63   cor1, tab1 AS c
369d0 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76  or2..----..972 v
369e0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
369f0 20 39 33 36 34 65 66 37 35 34 35 62 30 37 63 36   9364ef7545b07c6
36a00 37 37 36 37 64 63 65 62 37 30 66 30 32 63 36 34  7767dceb70f02c64
36a10 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
36a20 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
36a30 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
36a40 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
36a50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36a60 2d 31 36 35 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1656..SELECT DI
36a70 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 36 20  STINCT col2 * 6 
36a80 44 49 56 20 28 20 2d 20 63 6f 6c 31 20 29 20 46  DIV ( - col1 ) F
36a90 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
36aa0 2d 31 32 0d 0a 2d 33 34 0d 0a 2d 34 34 0d 0a 0d  -12..-34..-44...
36ab0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
36ac0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
36ad0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
36ae0 6c 61 62 65 6c 2d 31 36 35 36 0d 0a 53 45 4c 45  label-1656..SELE
36af0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
36b00 20 2a 20 36 20 2f 20 28 20 2d 20 63 6f 6c 31 20   * 6 / ( - col1 
36b10 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
36b20 2d 0d 0a 2d 31 32 0d 0a 2d 33 34 0d 0a 2d 34 34  -..-12..-34..-44
36b30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
36b40 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
36b50 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
36b60 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
36b70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
36b80 31 36 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  1657..SELECT DIS
36b90 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  TINCT + col1 + c
36ba0 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 46 52 4f  ol2 DIV col2 FRO
36bb0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
36bc0 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39 38  ----..87..92..98
36bd0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
36be0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
36bf0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36c00 72 74 20 6c 61 62 65 6c 2d 31 36 35 37 0d 0a 53  rt label-1657..S
36c10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
36c20 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2f 20 63   col1 + col2 / c
36c30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
36c40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d   cor0..----..87.
36c50 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69  .92..98....onlyi
36c60 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
36c70 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
36c80 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
36c90 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
36ca0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
36cb0 62 65 6c 2d 31 36 35 38 0d 0a 53 45 4c 45 43 54  bel-1658..SELECT
36cc0 20 2b 20 43 41 53 54 28 20 33 20 41 53 20 53 49   + CAST( 3 AS SI
36cd0 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20 46 52  GNED ) + col1 FR
36ce0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
36cf0 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 33 34 0d 0a 36  .----..20..34..6
36d00 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
36d10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
36d20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
36d30 6f 72 74 20 6c 61 62 65 6c 2d 31 36 35 38 0d 0a  ort label-1658..
36d40 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20  SELECT + CAST ( 
36d50 33 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  3 AS INTEGER ) +
36d60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
36d70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
36d80 30 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65  0..34..62....que
36d90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36da0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20  LECT ALL col2 + 
36db0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
36dc0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
36dd0 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
36de0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
36df0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
36e00 30 20 2b 20 2b 20 32 35 20 41 53 20 63 6f 6c 30  0 + + 25 AS col0
36e10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
36e20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 34  r0..----..114..4
36e30 39 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  9..60....query I
36e40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36e50 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29   + ( cor0.col0 )
36e60 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36e70 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36e80 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71  ..7..78..79....q
36e90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36ea0 53 45 4c 45 43 54 20 2b 20 31 30 20 2a 20 2d 20  SELECT + 10 * - 
36eb0 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
36ec0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
36ed0 2d 0d 0a 2d 31 30 0d 0a 2d 33 33 30 0d 0a 2d 38  -..-10..-330..-8
36ee0 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
36ef0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
36f00 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
36f10 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
36f20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36f30 6c 2d 31 36 36 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1663..SELECT +
36f40 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a   col2 + - col2 *
36f50 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 44 49 56   col2 + col0 DIV
36f60 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
36f70 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
36f80 2d 2d 0d 0a 2d 31 30 35 35 0d 0a 2d 36 36 34 31  --..-1055..-6641
36f90 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
36fa0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
36fb0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
36fc0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 36 33  wsort label-1663
36fd0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
36fe0 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  + - col2 * col2 
36ff0 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53  + col0 / col0 AS
37000 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
37010 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35  cor0..----..-105
37020 35 0d 0a 2d 36 36 34 31 0d 0a 31 0d 0a 0d 0a 71  5..-6641..1....q
37030 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37040 53 45 4c 45 43 54 20 2d 20 36 30 20 2b 20 2b 20  SELECT - 60 + + 
37050 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
37060 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
37070 32 0d 0a 2d 33 33 0d 0a 2d 33 34 0d 0a 0d 0a 71  2..-33..-34....q
37080 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37090 53 45 4c 45 43 54 20 41 4c 4c 20 31 34 20 46 52  SELECT ALL 14 FR
370a0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
370b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
370c0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
370d0 20 38 33 65 35 37 37 39 64 32 34 38 37 64 31 32   83e5779d2487d12
370e0 34 39 35 65 37 64 38 31 36 63 37 39 37 32 36 34  495e7d816c797264
370f0 66 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  f....query IIIII
37100 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
37110 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
37120 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30 2c 20  ab2, tab1 cor0, 
37130 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72 31 0d  tab0, tab2 cor1.
37140 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65  .----..972 value
37150 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 36 30  s hashing to 960
37160 30 62 64 66 35 62 61 63 30 63 61 65 63 33 32 32  0bdf5bac0caec322
37170 39 65 38 37 31 37 30 63 63 34 30 62 33 0d 0a 0d  9e87170cc40b3...
37180 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37190 0d 0a 53 45 4c 45 43 54 20 2d 20 32 34 20 41 53  ..SELECT - 24 AS
371a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
371b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
371c0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
371d0 73 68 69 6e 67 20 74 6f 20 37 39 37 64 30 66 37  shing to 797d0f7
371e0 63 31 34 35 66 38 61 63 36 32 33 39 32 34 34 34  c145f8ac62392444
371f0 38 63 37 31 34 62 62 63 63 0d 0a 0d 0a 71 75 65  8c714bbcc....que
37200 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37210 4c 45 43 54 20 41 4c 4c 20 2d 20 36 32 20 46 52  LECT ALL - 62 FR
37220 4f 4d 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f  OM tab1 cor0 CRO
37230 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 63 6f 72  SS JOIN tab1 cor
37240 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
37250 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 30 65  s hashing to f0e
37260 39 33 66 36 66 66 35 66 63 33 63 66 35 30 61 31  93f6ff5fc3cf50a1
37270 34 65 32 37 36 32 30 36 64 61 64 35 63 0d 0a 0d  4e276206dad5c...
37280 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37290 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
372a0 54 20 2d 20 37 36 20 2b 20 2b 20 63 6f 6c 30 20  T - 76 + + col0 
372b0 2a 20 2b 20 63 6f 6c 30 20 2a 20 39 34 20 41 53  * + col0 * 94 AS
372c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
372d0 0a 2d 2d 2d 2d 0d 0a 31 31 35 30 37 34 0d 0a 35  .----..115074..5
372e0 34 30 36 38 0d 0a 37 34 34 34 39 38 0d 0a 0d 0a  4068..744498....
372f0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
37300 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
37310 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
37320 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
37330 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
37340 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37350 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   ALL - cor0.col1
37360 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
37370 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
37380 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  IN tab1 AS cor1.
37390 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
373a0 68 61 73 68 69 6e 67 20 74 6f 20 63 63 61 61 35  hashing to ccaa5
373b0 64 64 33 33 38 38 64 39 65 65 30 66 65 61 36 37  dd3388d9ee0fea67
373c0 36 66 61 33 35 32 39 39 66 65 35 0d 0a 0d 0a 71  6fa35299fe5....q
373d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
373e0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
373f0 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 36  0 * - col2 + - 6
37400 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
37410 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 35 39  ab0..----..-7359
37420 0d 0a 2d 38 35 33 0d 0a 2d 39 36 0d 0a 0d 0a 71  ..-853..-96....q
37430 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37440 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20  SELECT + col1 * 
37450 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53  + col2 * col0 AS
37460 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
37470 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 36 34  .----..3395..664
37480 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a 71 75  118..68112....qu
37490 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
374a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
374b0 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 2b   col2 * col1 * +
374c0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
374d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab0..----..3
374e0 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31  395..664118..681
374f0 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
37500 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
37510 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
37520 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a  ab1, tab1 cor0..
37530 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
37540 61 73 68 69 6e 67 20 74 6f 20 38 34 64 62 66 61  ashing to 84dbfa
37550 66 39 62 63 31 37 64 64 30 39 37 66 31 35 62 63  f9bc17dd097f15bc
37560 33 36 62 34 31 38 36 32 36 31 0d 0a 0d 0a 6f 6e  36b4186261....on
37570 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
37580 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
37590 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
375a0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
375b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
375c0 20 6c 61 62 65 6c 2d 31 36 37 35 0d 0a 53 45 4c   label-1675..SEL
375d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
375e0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
375f0 44 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  D ) FROM tab2, t
37600 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
37610 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
37620 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
37630 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
37640 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 37  owsort label-167
37650 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
37660 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
37670 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
37680 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72 30   tab2, tab1 cor0
37690 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
376a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
376b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
376c0 20 2b 20 39 37 20 2a 20 2d 20 74 61 62 31 2e 63   + 97 * - tab1.c
376d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
376e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
376f0 2d 0d 0a 2d 32 39 31 0d 0a 2d 36 32 30 38 0d 0a  -..-291..-6208..
37700 2d 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7760....query I
37710 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37720 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 31 31 20 46   + col0 + - 11 F
37730 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
37740 31 33 0d 0a 32 34 0d 0a 37 38 0d 0a 0d 0a 71 75  13..24..78....qu
37750 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37760 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
37770 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
37780 31 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 - col0 FROM ta
37790 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
377a0 0d 0a 32 32 35 39 32 0d 0a 32 34 34 36 39 0d 0a  ..22592..24469..
377b0 33 39 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  39806....query I
377c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
377d0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   + col2 * - col0
377e0 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
377f0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
37800 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30 33 34  .-119652..-51034
37810 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79  ..-5859....query
37820 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37830 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 28 20  CT ALL col1 - ( 
37840 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 29 20  - col0 * col2 ) 
37850 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
37860 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37870 0a 31 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33  .188..3658..7693
37880 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37890 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
378a0 2b 20 63 6f 6c 30 20 2a 20 28 20 2d 20 32 30 20  + col0 * ( - 20 
378b0 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
378c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
378d0 2d 0d 0a 2d 31 34 30 0d 0a 2d 31 35 36 30 0d 0a  -..-140..-1560..
378e0 2d 31 35 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -1580....skipif 
378f0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
37900 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
37910 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
37920 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
37930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37940 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
37950 43 54 20 2d 20 39 31 20 2b 20 74 61 62 30 2e 63  CT - 91 + tab0.c
37960 6f 6c 32 20 2a 20 2d 20 39 36 20 2a 20 37 31 20  ol2 * - 96 * 71 
37970 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
37980 2d 2d 2d 2d 0d 0a 2d 32 32 35 30 31 39 0d 0a 2d  ----..-225019..-
37990 35 35 39 30 30 33 0d 0a 2d 36 39 30 37 0d 0a 0d  559003..-6907...
379a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
379b0 0d 0a 53 45 4c 45 43 54 20 33 39 20 2b 20 63 6f  ..SELECT 39 + co
379c0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
379d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d  cor0..----..135.
379e0 0a 39 33 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  .93..96....onlyi
379f0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
37a00 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
37a10 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
37a20 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
37a30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37a40 62 65 6c 2d 31 36 38 34 0d 0a 53 45 4c 45 43 54  bel-1684..SELECT
37a50 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   - cor0.col0 * c
37a60 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 4e 55  ol1 + + CAST( NU
37a70 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
37a80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
37a90 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
37aa0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
37ab0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
37ac0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
37ad0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
37ae0 2d 31 36 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20  -1684..SELECT - 
37af0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31  cor0.col0 * col1
37b00 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   + + CAST ( NULL
37b10 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
37b20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
37b30 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
37b40 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
37b50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37b60 43 54 20 2b 20 33 34 20 2b 20 2d 20 63 6f 6c 31  CT + 34 + - col1
37b70 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
37b80 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 34 0d 0a 38  .----..21..24..8
37b90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37ba0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
37bb0 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 31 37 20 41   * col2 + + 17 A
37bc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
37bd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37be0 31 37 39 0d 0a 33 36 36 35 0d 0a 37 36 39 37 0d  179..3665..7697.
37bf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37c00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
37c10 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  2 * - col0 * col
37c20 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
37c30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d  or0..----..1225.
37c40 0a 31 39 30 30 38 0d 0a 36 34 39 35 32 32 0d 0a  .19008..649522..
37c50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37c60 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
37c70 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53  col0 * - col2 AS
37c80 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
37c90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
37ca0 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
37cb0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
37cc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
37cd0 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20 29 20 41  ol1 * ( col1 ) A
37ce0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
37cf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37d00 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39  7396..8281..9409
37d10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37d20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
37d30 6c 31 20 2b 20 36 35 20 2a 20 63 6f 6c 31 20 41  l1 + 65 * col1 A
37d40 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
37d50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37d60 31 36 36 34 0d 0a 36 34 30 0d 0a 38 33 32 0d 0a  1664..640..832..
37d70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37d80 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
37d90 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l1 + col1 AS col
37da0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
37db0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
37dc0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
37dd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
37de0 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  L + + cor0.col2 
37df0 2a 20 2d 20 34 31 20 41 53 20 63 6f 6c 30 20 46  * - 41 AS col0 F
37e00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
37e10 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 36 0d 0a 2d  ..----..-1066..-
37e20 31 31 30 37 0d 0a 2d 31 35 35 38 0d 0a 0d 0a 6f  1107..-1558....o
37e30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
37e40 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
37e50 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
37e60 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
37e70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37e80 74 20 6c 61 62 65 6c 2d 31 36 39 33 0d 0a 53 45  t label-1693..SE
37e90 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41  LECT - col0 * CA
37ea0 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
37eb0 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20  MAL ) FROM tab2 
37ec0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
37ed0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
37ee0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
37ef0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
37f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37f10 74 20 6c 61 62 65 6c 2d 31 36 39 33 0d 0a 53 45  t label-1693..SE
37f20 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41  LECT - col0 * CA
37f30 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
37f40 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  L ) FROM tab2 AS
37f50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
37f60 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
37f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37f80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
37f90 6f 6c 32 20 2a 20 2d 20 34 37 20 46 52 4f 4d 20  ol2 * - 47 FROM 
37fa0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37fb0 2d 2d 0d 0a 2d 32 35 33 38 0d 0a 2d 32 36 37 39  --..-2538..-2679
37fc0 0d 0a 2d 34 35 31 32 0d 0a 0d 0a 71 75 65 72 79  ..-4512....query
37fd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37fe0 43 54 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 31  CT - col2 - col1
37ff0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
38000 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
38010 31 30 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d  109..-67..-80...
38020 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
38030 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
38040 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
38050 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
38060 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
38070 6f 72 74 20 6c 61 62 65 6c 2d 31 36 39 36 0d 0a  ort label-1696..
38080 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c  SELECT - ( - col
38090 32 20 29 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 43  2 ) - - col2 * C
380a0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
380b0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20  NED ) FROM tab0 
380c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
380d0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
380e0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
380f0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
38100 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38110 74 20 6c 61 62 65 6c 2d 31 36 39 36 0d 0a 53 45  t label-1696..SE
38120 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 32 20  LECT - ( - col2 
38130 29 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53  ) - - col2 * CAS
38140 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
38150 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
38160 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
38170 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
38180 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
38190 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 35 20  rt..SELECT - 15 
381a0 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  * - col1 + col0 
381b0 2b 20 2b 20 36 39 20 2a 20 2b 20 63 6f 6c 32 20  + + 69 * + col2 
381c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
381d0 32 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33 35 0d 0a 32  2..----..2335..2
381e0 37 35 37 0d 0a 32 39 35 36 0d 0a 0d 0a 71 75 65  757..2956....que
381f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38200 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20  LECT + ( + col0 
38210 29 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  ) - col1 * col2 
38220 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
38230 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
38240 0a 2d 32 38 31 34 0d 0a 2d 36 32 0d 0a 2d 37 33  .-2814..-62..-73
38250 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
38260 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
38270 4c 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 34 38 20  L + - col2 * 48 
38280 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
38290 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
382a0 0a 2d 31 35 38 34 0d 0a 2d 33 39 33 36 0d 0a 2d  .-1584..-3936..-
382b0 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
382c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
382d0 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63  l0 - - col2 AS c
382e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
382f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31   cor0..----..121
38300 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65  ..176..57....que
38310 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
38320 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
38330 20 2a 20 2d 20 33 37 20 2b 20 37 30 20 46 52 4f   * - 37 + 70 FRO
38340 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
38350 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
38360 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
38370 38 61 63 62 34 65 62 30 61 33 31 61 61 30 30 30  8acb4eb0a31aa000
38380 30 64 33 63 39 33 32 31 36 39 30 32 36 34 36 39  0d3c932169026469
38390 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
383a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
383b0 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a  + + ( - col0 ) *
383c0 20 2d 20 35 32 20 2b 20 63 6f 6c 31 20 41 53 20   - 52 + col1 AS 
383d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
383e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
383f0 33 34 0d 0a 31 39 31 37 0d 0a 34 37 31 39 0d 0a  34..1917..4719..
38400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38410 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 32  t..SELECT - tab2
38420 2e 63 6f 6c 30 20 2a 20 2b 20 38 38 20 46 52 4f  .col0 * + 88 FRO
38430 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72  M tab2, tab1 cor
38440 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
38450 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
38460 20 68 61 73 68 69 6e 67 20 74 6f 20 63 37 64 64   hashing to c7dd
38470 65 62 37 61 35 39 36 35 36 38 32 63 31 34 64 39  eb7a5965682c14d9
38480 35 62 37 32 64 33 65 64 66 64 66 66 0d 0a 0d 0a  5b72d3edfdff....
38490 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
384a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 30  .SELECT ALL - 70
384b0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
384c0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  0 cor0..----..16
384d0 0d 0a 32 31 0d 0a 32 37 0d 0a 0d 0a 6f 6e 6c 79  ..21..27....only
384e0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
384f0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
38500 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
38510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38520 74 20 6c 61 62 65 6c 2d 31 37 30 35 0d 0a 53 45  t label-1705..SE
38530 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 28 20  LECT col0 DIV ( 
38540 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
38550 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d 0a 36 0d  ..----..0..6..6.
38560 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
38570 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
38580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38590 74 20 6c 61 62 65 6c 2d 31 37 30 35 0d 0a 53 45  t label-1705..SE
385a0 4c 45 43 54 20 63 6f 6c 30 20 2f 20 28 20 63 6f  LECT col0 / ( co
385b0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  l1 ) FROM tab1..
385c0 2d 2d 2d 2d 0d 0a 30 0d 0a 36 0d 0a 36 0d 0a 0d  ----..0..6..6...
385d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
385e0 0d 0a 53 45 4c 45 43 54 20 2d 20 36 38 20 2a 20  ..SELECT - 68 * 
385f0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
38600 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
38610 2d 31 36 33 32 0d 0a 2d 32 33 38 30 0d 0a 2d 36  -1632..-2380..-6
38620 30 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  052....query I r
38630 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
38640 4c 4c 20 39 33 20 41 53 20 63 6f 6c 30 20 46 52  LL 93 AS col0 FR
38650 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74  OM tab2, tab0, t
38660 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
38670 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
38680 68 69 6e 67 20 74 6f 20 38 35 65 66 31 39 31 62  hing to 85ef191b
38690 66 31 62 33 30 37 66 33 30 30 62 33 66 64 34 39  f1b307f300b3fd49
386a0 39 39 32 66 63 61 65 37 0d 0a 0d 0a 71 75 65 72  992fcae7....quer
386b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
386c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
386d0 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  2.col2 AS col0 F
386e0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
386f0 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
38700 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  cor1..----..26..
38710 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20  27..38....query 
38720 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38730 54 20 35 35 20 2a 20 2b 20 63 6f 6c 31 20 41 53  T 55 * + col1 AS
38740 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
38750 0a 2d 2d 2d 2d 0d 0a 34 37 33 30 0d 0a 35 30 30  .----..4730..500
38760 35 0d 0a 35 33 33 35 0d 0a 0d 0a 71 75 65 72 79  5..5335....query
38770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38780 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b  CT tab2.col2 * +
38790 20 74 61 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f   tab2.col1 AS co
387a0 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
387b0 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
387c0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
387d0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 30 66  s hashing to 00f
387e0 31 35 33 63 35 64 38 30 65 36 39 32 66 61 66 66  153c5d80e692faff
387f0 35 30 31 38 64 38 37 30 31 62 39 32 64 0d 0a 0d  5018d8701b92d...
38800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38810 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38820 54 20 2b 20 2d 20 31 20 2b 20 63 6f 6c 32 20 2a  T + - 1 + col2 *
38830 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
38840 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
38850 0a 2d 2d 2d 2d 0d 0a 31 35 33 33 0d 0a 36 34 35  .----..1533..645
38860 0d 0a 38 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..836....query I
38870 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38880 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   + + cor0.col2 *
38890 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
388a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
388b0 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
388c0 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
388d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
388e0 53 54 49 4e 43 54 20 31 38 20 2a 20 2b 20 63 6f  STINCT 18 * + co
388f0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
38900 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
38910 2d 2d 0d 0a 31 34 37 36 0d 0a 31 38 0d 0a 35 39  --..1476..18..59
38920 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
38930 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
38940 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
38950 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
38960 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
38970 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38980 45 4c 45 43 54 20 2d 20 33 20 2a 20 63 6f 6c 30  ELECT - 3 * col0
38990 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
389a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
389b0 31 30 35 0d 0a 2d 32 36 37 0d 0a 2d 37 32 0d 0a  105..-267..-72..
389c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
389d0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
389e0 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 28 20  l2 * col0 - - ( 
389f0 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  - col1 + + col1 
38a00 29 20 2a 20 2d 20 37 38 20 46 52 4f 4d 20 74 61  ) * - 78 FROM ta
38a10 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
38a20 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30  ..189..2028..300
38a30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
38a40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
38a50 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b  TINCT + col0 - +
38a60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
38a70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a  cor0..----..-9..
38a80 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49  34..7....query I
38a90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38aa0 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ALL + cor0.col0
38ab0 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 36 33 20 46   * col2 - - 63 F
38ac0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
38ad0 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36 31 0d 0a 38 35  ..----..7361..85
38ae0 35 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  5..98....onlyif 
38af0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
38b00 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
38b10 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
38b20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
38b30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
38b40 6c 2d 31 37 31 38 0d 0a 53 45 4c 45 43 54 20 41  l-1718..SELECT A
38b50 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LL + + col1 * + 
38b60 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 63  col1 * + CAST( c
38b70 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  ol2 + col0 AS SI
38b80 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
38b90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
38ba0 31 34 31 36 30 35 31 0d 0a 33 33 38 37 32 34 0d  1416051..338724.
38bb0 0a 34 32 31 35 37 32 0d 0a 0d 0a 73 6b 69 70 69  .421572....skipi
38bc0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
38bd0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
38be0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
38bf0 31 37 31 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1718..SELECT ALL
38c00 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
38c10 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 63 6f  l1 * + CAST ( co
38c20 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54  l2 + col0 AS INT
38c30 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30  EGER ) FROM tab0
38c40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
38c50 31 34 31 36 30 35 31 0d 0a