sqllogictest
Hex Artifact Content
Not logged in

Artifact 1c7214402c2517e89d0329d5828d21eaf4682fb4:


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 63 6f 72 30 2e  rt..SELECT cor0.
02e0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col1 + + col2 AS
02f0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
0300: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
0310: 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71  19..173..98....q
0320: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0330: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0340: 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  - col1 + + col2 
0350: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
0360: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
0370: 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 36 33 0d 0a 33  ---..111..163..3
0380: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
0390: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
03a0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
03b0: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b2 cor0..----..3
03c0: 0d 0a 33 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20  ..3..3....query 
03d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
03e0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 38  T DISTINCT - - 8
03f0: 38 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  8 + col1 FROM ta
0400: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
0410: 0d 0a 31 37 34 0d 0a 31 37 39 0d 0a 31 38 35 0d  ..174..179..185.
0420: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0430: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
0440: 4e 43 54 20 37 39 20 2a 20 2d 20 63 6f 6c 30 20  NCT 79 * - col0 
0450: 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  + ( col2 ) * col
0460: 31 20 2b 20 2d 20 31 34 20 46 52 4f 4d 20 74 61  1 + - 14 FROM ta
0470: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
0480: 0d 0a 2d 34 35 30 30 0d 0a 2d 35 30 38 36 0d 0a  ..-4500..-5086..
0490: 31 31 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1153....query I 
04a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
04b0: 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL - cor0.col0 
04c0: 2a 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 37 32 20  * + col0 - - 72 
04d0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
04e0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
04f0: 0a 2d 36 30 31 32 0d 0a 2d 36 31 36 39 0d 0a 32  .-6012..-6169..2
0500: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
0510: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
0520: 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  or0.col2 * + cor
0530: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
0540: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
0550: 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a  44..-676..-729..
0560: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0570: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 37  t..SELECT ALL 97
0580: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
0590: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 0d 0a 39 37  b1..----..97..97
05a0: 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
05b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
05c0: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  + cor0.col2 FROM
05d0: 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72 30   tab0, tab2 cor0
05e0: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
05f0: 20 68 61 73 68 69 6e 67 20 74 6f 20 35 39 31 31   hashing to 5911
0600: 62 61 63 35 31 34 34 31 66 34 66 66 36 34 30 62  bac51441f4ff640b
0610: 32 61 32 62 37 32 31 65 61 38 65 33 0d 0a 0d 0a  2a2b721ea8e3....
0620: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0630: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 38 20 46  .SELECT ALL 48 F
0640: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41  ROM tab2, tab0 A
0650: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
0660: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
0670: 6f 20 38 62 30 39 63 63 32 63 39 39 63 32 31 30  o 8b09cc2c99c210
0680: 32 30 33 36 31 36 32 64 30 36 33 65 30 65 35 61  2036162d063e0e5a
0690: 34 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  4b....query I ro
06a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
06b0: 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l1 * col2 * - co
06c0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
06d0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 31 31  tab0..----..-611
06e0: 38 38 34 0d 0a 2d 39 33 36 35 34 0d 0a 2d 39 37  884..-93654..-97
06f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0700: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
0710: 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  INCT - col1 * - 
0720: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
0730: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
0740: 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d  43..217..4602...
0750: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0760: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0770: 54 20 37 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  T 70 FROM tab0, 
0780: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
0790: 2d 2d 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  --..70....onlyif
07a0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
07b0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
07c0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
07d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
07e0: 6c 61 62 65 6c 2d 31 33 0d 0a 53 45 4c 45 43 54  label-13..SELECT
07f0: 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 63 6f   col2 * - ( + co
0800: 6c 31 20 29 20 2b 20 63 6f 6c 30 20 44 49 56 20  l1 ) + col0 DIV 
0810: 2d 20 63 6f 6c 31 20 2d 20 38 36 20 41 53 20 63  - col1 - 86 AS c
0820: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
0830: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
0840: 33 0d 0a 2d 32 39 32 34 0d 0a 2d 37 35 34 38 0d  3..-2924..-7548.
0850: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
0860: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
0870: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0880: 74 20 6c 61 62 65 6c 2d 31 33 0d 0a 53 45 4c 45  t label-13..SELE
0890: 43 54 20 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20  CT col2 * - ( + 
08a0: 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20 2f 20  col1 ) + col0 / 
08b0: 2d 20 63 6f 6c 31 20 2d 20 38 36 20 41 53 20 63  - col1 - 86 AS c
08c0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
08d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
08e0: 33 0d 0a 2d 32 39 32 34 0d 0a 2d 37 35 34 38 0d  3..-2924..-7548.
08f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0900: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 36 20  rt..SELECT + 76 
0910: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
0920: 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
0930: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
0940: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
0950: 6f 20 37 62 32 62 30 38 64 64 33 66 31 61 64 65  o 7b2b08dd3f1ade
0960: 66 30 32 38 64 33 66 34 30 65 66 37 63 37 31 36  f028d3f40ef7c716
0970: 64 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  da....query I ro
0980: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
0990: 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e  STINCT - + cor0.
09a0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col1 + + cor0.co
09b0: 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l1 * + cor0.col1
09c0: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
09d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 31   cor0..----..731
09e0: 30 0d 0a 38 31 39 30 0d 0a 39 33 31 32 0d 0a 0d  0..8190..9312...
09f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0a00: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
0a10: 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( + col1 ) * co
0a20: 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r0.col1 AS col2 
0a30: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
0a40: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d  0..----..-289..-
0a50: 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 71 75  3481..-961....qu
0a60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0a70: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  ELECT col1 * col
0a80: 31 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  1 - + col1 * - c
0a90: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
0aa0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39   cor0..----..179
0ab0: 38 0d 0a 35 30 31 35 0d 0a 39 33 35 0d 0a 0d 0a  8..5015..935....
0ac0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0ad0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
0ae0: 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 74   - tab2.col0 * t
0af0: 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ab2.col0 AS col2
0b00: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
0b10: 0d 0a 2d 31 38 0d 0a 2d 36 30 32 35 0d 0a 2d 36  ..-18..-6025..-6
0b20: 32 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  224....query I r
0b30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
0b40: 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
0b50: 6f 72 32 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f  or2.col0 ) AS co
0b60: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
0b70: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
0b80: 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
0b90: 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32  r1, tab0 AS cor2
0ba0: 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65  ..----..81 value
0bb0: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 38 61  s hashing to 38a
0bc0: 34 33 64 61 62 65 62 66 36 35 37 36 38 62 32 36  43dabebf65768b26
0bd0: 31 35 30 39 66 37 62 31 65 36 32 64 34 0d 0a 0d  1509f7b1e62d4...
0be0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0bf0: 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 38 35 20  ..SELECT + ( 85 
0c00: 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  ) FROM tab2, tab
0c10: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
0c20: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
0c30: 67 20 74 6f 20 61 61 66 61 38 65 35 63 66 62 39  g to aafa8e5cfb9
0c40: 65 30 32 63 65 61 38 37 31 37 38 33 33 65 37 35  e02cea8717833e75
0c50: 38 31 66 37 62 0d 0a 0d 0a 71 75 65 72 79 20 49  81f7b....query I
0c60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0c70: 20 33 39 20 2b 20 2b 20 35 32 20 41 53 20 63 6f   39 + + 52 AS co
0c80: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
0c90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 31 0d 0a  cor0..----..91..
0ca0: 39 31 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20  91..91....query 
0cb0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0cc0: 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b  T ALL + + col1 +
0cd0: 20 35 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f   52 * - col1 FRO
0ce0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
0cf0: 2d 2d 2d 2d 0d 0a 2d 34 33 38 36 0d 0a 2d 34 36  ----..-4386..-46
0d00: 34 31 0d 0a 2d 34 39 34 37 0d 0a 0d 0a 71 75 65  41..-4947....que
0d10: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0d20: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
0d30: 37 32 20 2a 20 39 32 20 41 53 20 63 6f 6c 31 20  72 * 92 AS col1 
0d40: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
0d50: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36 32 34 0d 0a  0..----..-6624..
0d60: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
0d70: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
0d80: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
0d90: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
0da0: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
0db0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 0d 0a 53  sort label-24..S
0dc0: 45 4c 45 43 54 20 43 41 53 54 28 20 2d 20 33 33  ELECT CAST( - 33
0dd0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63   AS SIGNED ) - c
0de0: 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 4e 55  ol1 * + CAST( NU
0df0: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
0e00: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
0e10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0e20: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
0e30: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
0e40: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
0e50: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
0e60: 72 74 20 6c 61 62 65 6c 2d 32 34 0d 0a 53 45 4c  rt label-24..SEL
0e70: 45 43 54 20 43 41 53 54 20 28 20 2d 20 33 33 20  ECT CAST ( - 33 
0e80: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 63  AS INTEGER ) - c
0e90: 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28 20 4e  ol1 * + CAST ( N
0ea0: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
0eb0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0ec0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
0ed0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
0ee0: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
0ef0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
0f00: 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 * col0 FROM ta
0f10: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
0f20: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
0f30: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
0f40: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
0f50: 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  + col2 * cor0.co
0f60: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
0f70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34  cor0..----..-144
0f80: 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a 0d  4..-676..-729...
0f90: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
0fa0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
0fb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0fc0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
0fd0: 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 52  CAST ( col1 AS R
0fe0: 45 41 4c 20 29 20 2a 20 2b 20 63 6f 6c 30 20 46  EAL ) * + col0 F
0ff0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1000: 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33  ..----..2064..33
1010: 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72  95..8099....quer
1020: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1030: 45 43 54 20 41 4c 4c 20 2d 20 2b 20 31 37 20 2b  ECT ALL - + 17 +
1040: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1050: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1060: 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 73 6b 69 70  4..-7..9....skip
1070: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1080: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1090: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
10a0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
10b0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
10c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
10d0: 6f 6c 32 20 2b 20 2d 20 37 31 20 2a 20 2b 20 63  ol2 + - 71 * + c
10e0: 6f 6c 32 20 2a 20 2b 20 33 34 20 63 6f 6c 31 20  ol2 * + 34 col1 
10f0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1100: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 33 30 32  0..----..-130302
1110: 0d 0a 2d 31 33 37 35 34 31 0d 0a 2d 32 33 31 36  ..-137541..-2316
1120: 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
1130: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1140: 53 54 49 4e 43 54 20 2d 20 36 39 20 2a 20 2d 20  STINCT - 69 * - 
1150: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
1160: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1170: 2d 2d 2d 2d 0d 0a 31 31 37 33 0d 0a 32 31 33 39  ----..1173..2139
1180: 0d 0a 34 30 37 31 0d 0a 0d 0a 71 75 65 72 79 20  ..4071....query 
1190: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11a0: 54 20 33 36 20 2a 20 63 6f 6c 32 20 2d 20 31 35  T 36 * col2 - 15
11b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11c0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 39 0d 0a  b1..----..1929..
11d0: 32 30 33 37 0d 0a 33 34 34 31 0d 0a 0d 0a 6f 6e  2037..3441....on
11e0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
11f0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1200: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1210: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1220: 6f 72 74 20 6c 61 62 65 6c 2d 33 32 0d 0a 53 45  ort label-32..SE
1230: 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30  LECT - tab2.col0
1240: 20 2d 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f   - - col1 DIV co
1250: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
1260: 2d 2d 0d 0a 2d 36 0d 0a 2d 37 37 0d 0a 2d 37 38  --..-6..-77..-78
1270: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1280: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1290: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
12a0: 72 74 20 6c 61 62 65 6c 2d 33 32 0d 0a 53 45 4c  rt label-32..SEL
12b0: 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20  ECT - tab2.col0 
12c0: 2d 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  - - col1 / col1 
12d0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
12e0: 0a 2d 36 0d 0a 2d 37 37 0d 0a 2d 37 38 0d 0a 0d  .-6..-77..-78...
12f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1300: 0d 0a 53 45 4c 45 43 54 20 2d 20 36 31 20 46 52  ..SELECT - 61 FR
1310: 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74  OM tab2, tab0, t
1320: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1330: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1340: 68 69 6e 67 20 74 6f 20 63 39 31 64 37 62 35 31  hing to c91d7b51
1350: 65 39 31 66 33 33 64 33 30 32 65 36 39 37 39 31  e91f33d302e69791
1360: 33 66 62 34 33 38 62 36 0d 0a 0d 0a 71 75 65 72  3fb438b6....quer
1370: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1380: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
1390: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
13a0: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
13b0: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
13c0: 68 61 73 68 69 6e 67 20 74 6f 20 38 62 34 39 37  hashing to 8b497
13d0: 39 39 39 34 32 61 39 65 33 35 33 61 33 64 32 37  99942a9e353a3d27
13e0: 39 63 66 36 34 65 66 33 66 36 33 0d 0a 0d 0a 71  9cf64ef3f63....q
13f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1400: 53 45 4c 45 43 54 20 2d 20 33 35 20 2b 20 2b 20  SELECT - 35 + + 
1410: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1420: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39  S cor0..----..19
1430: 0d 0a 32 32 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72  ..22..61....quer
1440: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1450: 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  ECT col2 * cor0.
1460: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
1470: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d  or0..----..2838.
1480: 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65  .7462..97....que
1490: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14a0: 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
14b0: 6c 31 20 2b 20 33 33 20 46 52 4f 4d 20 74 61 62  l1 + 33 FROM tab
14c0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
14d0: 0a 35 30 0d 0a 36 34 0d 0a 39 32 0d 0a 0d 0a 6f  .50..64..92....o
14e0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
14f0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1500: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1510: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1520: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1530: 74 20 6c 61 62 65 6c 2d 33 38 0d 0a 53 45 4c 45  t label-38..SELE
1540: 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 30 2e  CT ALL + + cor0.
1550: 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 4e  col2 * - CAST( N
1560: 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
1570: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1580: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1590: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
15a0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
15b0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
15c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
15d0: 65 6c 2d 33 38 0d 0a 53 45 4c 45 43 54 20 41 4c  el-38..SELECT AL
15e0: 4c 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  L + + cor0.col2 
15f0: 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * - CAST ( NULL 
1600: 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74  AS REAL ) FROM t
1610: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1620: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1630: 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
1640: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1650: 20 63 6f 6c 31 20 2b 20 2d 20 33 38 20 2a 20 2d   col1 + - 38 * -
1660: 20 33 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53   32 FROM tab1 AS
1670: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39   cor0..----..119
1680: 30 0d 0a 31 32 30 33 0d 0a 31 32 30 36 0d 0a 0d  0..1203..1206...
1690: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
16a0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
16b0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
16c0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
16d0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
16e0: 6f 72 74 20 6c 61 62 65 6c 2d 34 30 0d 0a 53 45  ort label-40..SE
16f0: 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20  LECT - - col1 + 
1700: 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41  + CAST( - col2 A
1710: 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
1720: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1730: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d  cor0..----..-21.
1740: 0a 33 33 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66  .33..4....skipif
1750: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1760: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1770: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
1780: 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  0..SELECT - - co
1790: 6c 31 20 2b 20 2b 20 43 41 53 54 20 28 20 2d 20  l1 + + CAST ( - 
17a0: 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
17b0: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
17c0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
17d0: 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d  -..-21..33..4...
17e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17f0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1800: 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  or0.col0 - - col
1810: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1820: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1830: 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a  -..128..160..6..
1840: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1850: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
1860: 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
1870: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
1880: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30  cor0..----..1040
1890: 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 6f 6e 6c  ..640..78....onl
18a0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
18b0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
18c0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
18d0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
18e0: 72 74 20 6c 61 62 65 6c 2d 34 33 0d 0a 53 45 4c  rt label-43..SEL
18f0: 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT - cor0.col1 
1900: 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20 28 20 63  DIV + col1 + ( c
1910: 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 28 20 63  or0.col0 * + ( c
1920: 6f 6c 30 20 29 20 29 20 46 52 4f 4d 20 74 61 62  ol0 ) ) FROM tab
1930: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1940: 0a 34 30 39 35 0d 0a 36 33 39 39 0d 0a 38 0d 0a  .4095..6399..8..
1950: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1960: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1970: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1980: 20 6c 61 62 65 6c 2d 34 33 0d 0a 53 45 4c 45 43   label-43..SELEC
1990: 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20  T - cor0.col1 / 
19a0: 2b 20 63 6f 6c 31 20 2b 20 28 20 63 6f 72 30 2e  + col1 + ( cor0.
19b0: 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 30 20  col0 * + ( col0 
19c0: 29 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ) ) FROM tab1 AS
19d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39   cor0..----..409
19e0: 35 0d 0a 36 33 39 39 0d 0a 38 0d 0a 0d 0a 71 75  5..6399..8....qu
19f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a00: 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 31 38 20  ELECT col2 * 18 
1a10: 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  * + col2 + col1 
1a20: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1a30: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 39 30 31 0d  0..----..165901.
1a40: 0a 35 32 35 31 34 0d 0a 35 38 34 39 32 0d 0a 0d  .52514..58492...
1a50: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a60: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1a70: 54 20 2d 20 63 6f 6c 30 20 2a 20 39 37 20 46 52  T - col0 * 97 FR
1a80: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1a90: 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 0d 0a 2d 36 32  .----..-291..-62
1aa0: 30 38 0d 0a 2d 37 37 36 30 0d 0a 0d 0a 71 75 65  08..-7760....que
1ab0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ac0: 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LECT - cor0.col0
1ad0: 20 2a 20 31 37 20 46 52 4f 4d 20 74 61 62 31 20   * 17 FROM tab1 
1ae0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1af0: 31 30 38 38 0d 0a 2d 31 33 36 30 0d 0a 2d 35 31  1088..-1360..-51
1b00: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1b10: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1b20: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1b30: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1b40: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1b50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b60: 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 30 20  LECT - ( - col0 
1b70: 29 20 2d 20 2b 20 31 35 20 63 6f 6c 31 20 46 52  ) - + 15 col1 FR
1b80: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1b90: 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 37 34 0d 0a 39  .----..20..74..9
1ba0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1bb0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1bc0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1bd0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1be0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1bf0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c00: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1c10: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f  + col0 * col2 co
1c20: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1c30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a  cor0..----..35..
1c40: 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65  7298..792....que
1c50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c60: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  LECT - col0 + + 
1c70: 63 6f 6c 32 20 2b 20 2b 20 36 34 20 2a 20 2d 20  col2 + + 64 * - 
1c80: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
1c90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1ca0: 36 31 33 0d 0a 2d 36 34 37 0d 0a 2d 38 31 36 0d  613..-647..-816.
1cb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1cc0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
1cd0: 30 2e 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20  0.col1 - col0 * 
1ce0: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
1cf0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1d00: 2d 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a 2d 34 39  ----..-1128..-49
1d10: 30 0d 0a 2d 37 38 33 30 0d 0a 0d 0a 71 75 65 72  0..-7830....quer
1d20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d30: 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d  ECT DISTINCT ( -
1d40: 20 63 6f 6c 30 20 29 20 2b 20 2d 20 39 37 20 46   col0 ) + - 97 F
1d50: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1d60: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31  ..----..-121..-1
1d70: 33 32 0d 0a 2d 31 38 36 0d 0a 0d 0a 6f 6e 6c 79  32..-186....only
1d80: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1d90: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1da0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1db0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1dc0: 74 20 6c 61 62 65 6c 2d 35 32 0d 0a 53 45 4c 45  t label-52..SELE
1dd0: 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20  CT + col0 DIV - 
1de0: 63 6f 6c 30 20 2d 20 2b 20 38 39 20 2a 20 63 6f  col0 - + 89 * co
1df0: 72 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31  r0.col0 DIV col1
1e00: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1e10: 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 33 0d  .----..-25..-33.
1e20: 0a 2d 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-88....skipif m
1e30: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1e40: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1e50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 0d  owsort label-52.
1e60: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f  .SELECT + col0 /
1e70: 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 38 39 20 2a   - col0 - + 89 *
1e80: 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c   cor0.col0 / col
1e90: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
1ea0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 33 33  ..----..-25..-33
1eb0: 0d 0a 2d 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-88....query I
1ec0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ed0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
1ee0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
1ef0: 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74  OM tab0, tab2, t
1f00: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1f10: 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..86..91..97...
1f20: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1f30: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1f40: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1f50: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1f60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 34 0d  owsort label-54.
1f70: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
1f80: 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f   - col1 DIV + co
1f90: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
1fa0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1fb0: 0a 2d 34 0d 0a 2d 36 35 0d 0a 2d 38 31 0d 0a 0d  .-4..-65..-81...
1fc0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1fd0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1fe0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ff0: 6c 61 62 65 6c 2d 35 34 0d 0a 53 45 4c 45 43 54  label-54..SELECT
2000: 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   - col0 + - col1
2010: 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   / + cor0.col1 F
2020: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2030: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 36 35 0d  ..----..-4..-65.
2040: 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-81....query I 
2050: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2060: 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  + + col2 * cor0.
2070: 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
2080: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2090: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
20a0: 2d 2d 0d 0a 31 33 36 35 0d 0a 35 39 38 0d 0a 37  --..1365..598..7
20b0: 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
20c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20d0: 53 54 49 4e 43 54 20 32 37 20 2a 20 2d 20 63 6f  STINCT 27 * - co
20e0: 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  l0 + - col1 + - 
20f0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2100: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2110: 31 30 0d 0a 2d 31 38 30 32 0d 0a 2d 32 32 35 33  10..-1802..-2253
2120: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2130: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2140: 2d 20 63 6f 6c 30 20 2a 20 39 32 20 46 52 4f 4d  - col0 * 92 FROM
2150: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   tab1..----..-27
2160: 36 0d 0a 2d 35 38 38 38 0d 0a 2d 37 33 36 30 0d  6..-5888..-7360.
2170: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2180: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2190: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
21a0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
21b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
21c0: 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  8..SELECT ALL - 
21d0: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49 56 20  col2 * col2 DIV 
21e0: 2d 20 33 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  - 32 FROM tab2..
21f0: 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 32 0d 0a 34 35  ----..21..22..45
2200: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2210: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2220: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2230: 72 74 20 6c 61 62 65 6c 2d 35 38 0d 0a 53 45 4c  rt label-58..SEL
2240: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
2250: 20 63 6f 6c 32 20 2f 20 2d 20 33 32 20 46 52 4f   col2 / - 32 FRO
2260: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 31  M tab2..----..21
2270: 0d 0a 32 32 0d 0a 34 35 0d 0a 0d 0a 6f 6e 6c 79  ..22..45....only
2280: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2290: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
22a0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
22b0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
22c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
22d0: 61 62 65 6c 2d 35 39 0d 0a 53 45 4c 45 43 54 20  abel-59..SELECT 
22e0: 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
22f0: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
2300: 29 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  ) + + col0 * - c
2310: 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
2320: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2330: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2340: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2350: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2360: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2370: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2380: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
2390: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
23a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23b0: 74 20 6c 61 62 65 6c 2d 35 39 0d 0a 53 45 4c 45  t label-59..SELE
23c0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41  CT DISTINCT - CA
23d0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
23e0: 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 30 20  EGER ) + + col0 
23f0: 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  * - col0 col0 FR
2400: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2410: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f  .----..NULL....o
2420: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2430: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2440: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2450: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2460: 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 0d 0a 53  sort label-60..S
2470: 45 4c 45 43 54 20 2b 20 33 32 20 44 49 56 20 63  ELECT + 32 DIV c
2480: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2490: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
24a0: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
24b0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
24c0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
24d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24e0: 61 62 65 6c 2d 36 30 0d 0a 53 45 4c 45 43 54 20  abel-60..SELECT 
24f0: 2b 20 33 32 20 2f 20 63 6f 6c 31 20 41 53 20 63  + 32 / col1 AS c
2500: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2510: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2520: 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  0..0....onlyif m
2530: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2540: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2550: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2560: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2570: 62 65 6c 2d 36 31 0d 0a 53 45 4c 45 43 54 20 44  bel-61..SELECT D
2580: 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c 31  ISTINCT - ( col1
2590: 20 29 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f   ) + col1 DIV co
25a0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
25b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39  0..----..-85..-9
25c0: 30 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  0..-96....skipif
25d0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
25e0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
25f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
2600: 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
2610: 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20  CT - ( col1 ) + 
2620: 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col1 / col1 FROM
2630: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2640: 0d 0a 2d 38 35 0d 0a 2d 39 30 0d 0a 2d 39 36 0d  ..-85..-90..-96.
2650: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2660: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
2670: 32 20 2a 20 37 39 20 46 52 4f 4d 20 74 61 62 32  2 * 79 FROM tab2
2680: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
2690: 35 34 0d 0a 2d 32 31 33 33 0d 0a 2d 33 30 30 32  54..-2133..-3002
26a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 34 20 2a  ort..SELECT 24 *
26c0: 20 36 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   61 AS col0 FROM
26d0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
26e0: 2d 2d 2d 0d 0a 31 34 36 34 0d 0a 31 34 36 34 0d  ---..1464..1464.
26f0: 0a 31 34 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .1464....onlyif 
2700: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2710: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2720: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2730: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2740: 61 62 65 6c 2d 36 34 0d 0a 53 45 4c 45 43 54 20  abel-64..SELECT 
2750: 2b 20 35 33 20 2a 20 2b 20 63 6f 6c 32 20 44 49  + 53 * + col2 DI
2760: 56 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  V + col2 FROM ta
2770: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2780: 0d 0a 35 33 0d 0a 35 33 0d 0a 35 33 0d 0a 0d 0a  ..53..53..53....
2790: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
27a0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
27b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27c0: 61 62 65 6c 2d 36 34 0d 0a 53 45 4c 45 43 54 20  abel-64..SELECT 
27d0: 2b 20 35 33 20 2a 20 2b 20 63 6f 6c 32 20 2f 20  + 53 * + col2 / 
27e0: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
27f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2800: 35 33 0d 0a 35 33 0d 0a 35 33 0d 0a 0d 0a 71 75  53..53..53....qu
2810: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2820: 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 31 39 20  ELECT col2 + 19 
2830: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2840: 0a 34 35 0d 0a 34 36 0d 0a 35 37 0d 0a 0d 0a 71  .45..46..57....q
2850: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2860: 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 31  SELECT tab2.col1
2870: 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   * col2 + - col0
2880: 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
2890: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 35 30  ab2..----..-4550
28a0: 0d 0a 2d 35 35 39 35 0d 0a 37 38 38 0d 0a 0d 0a  ..-5595..788....
28b0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
28c0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
28d0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
28e0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
28f0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 0d 0a  wsort label-67..
2900: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2910: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20  col0 * col2 DIV 
2920: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
2930: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2940: 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69  1..33..82....ski
2950: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2960: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2970: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2980: 6c 2d 36 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-67..SELECT DIS
2990: 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  TINCT col0 * col
29a0: 32 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 / + col0 AS co
29b0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
29c0: 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d  --..1..33..82...
29d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29e0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
29f0: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 38 35 20   cor0.col0 + 85 
2a00: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2a10: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 0d 0a 31 36  0..----..163..16
2a20: 34 0d 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  4..92....query I
2a30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a40: 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   - ( - col2 ) + 
2a50: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2a60: 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36  ----..52..54..76
2a70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2a90: 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  INCT - col0 * + 
2aa0: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col0 * + col0 AS
2ab0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
2ac0: 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 32 34 0d 0a 2d  .----..-13824..-
2ad0: 34 32 38 37 35 0d 0a 2d 37 30 34 39 36 39 0d 0a  42875..-704969..
2ae0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2af0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
2b00: 20 2d 20 32 39 20 41 53 20 63 6f 6c 31 20 46 52   - 29 AS col1 FR
2b10: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2b20: 2d 2d 0d 0a 2d 32 32 0d 0a 34 39 0d 0a 35 30 0d  --..-22..49..50.
2b30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b40: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2b50: 4e 43 54 20 33 36 20 2b 20 31 36 20 2a 20 2b 20  NCT 36 + 16 * + 
2b60: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
2b70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  S cor0..----..30
2b80: 38 0d 0a 35 33 32 0d 0a 39 38 30 0d 0a 0d 0a 6f  8..532..980....o
2b90: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2ba0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2bb0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2bc0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2bd0: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 0d 0a 53  sort label-73..S
2be0: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56  ELECT + col0 DIV
2bf0: 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   ( col1 ) AS col
2c00: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2c10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
2c20: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
2c30: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2c40: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2c50: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 0d 0a 53  sort label-73..S
2c60: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 28  ELECT + col0 / (
2c70: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20   col1 ) AS col1 
2c80: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2c90: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2ca0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2cb0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2cc0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2cd0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2ce0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2cf0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 0d  owsort label-74.
2d00: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41  .SELECT ALL + CA
2d10: 53 54 28 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  ST( ( - cor0.col
2d20: 32 20 29 20 41 53 20 53 49 47 4e 45 44 20 29 20  2 ) AS SIGNED ) 
2d30: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2d40: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33  0..----..-1..-33
2d50: 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-82....skipif 
2d60: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2d70: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2d80: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34  rowsort label-74
2d90: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43  ..SELECT ALL + C
2da0: 41 53 54 20 28 20 28 20 2d 20 63 6f 72 30 2e 63  AST ( ( - cor0.c
2db0: 6f 6c 32 20 29 20 41 53 20 49 4e 54 45 47 45 52  ol2 ) AS INTEGER
2dc0: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
2dd0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
2de0: 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72  -33..-82....quer
2df0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e00: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
2e10: 20 34 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   46 AS col0 FROM
2e20: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2e30: 0d 0a 2d 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-46....onlyif 
2e40: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2e50: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2e60: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2e70: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2e80: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e90: 6c 2d 37 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-76..SELECT DIS
2ea0: 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 2d 20  TINCT - CAST( - 
2eb0: 33 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  32 AS SIGNED ) F
2ec0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2ed0: 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 0d 0a 73 6b  ..----..32....sk
2ee0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2ef0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2f00: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f10: 65 6c 2d 37 36 0d 0a 53 45 4c 45 43 54 20 44 49  el-76..SELECT DI
2f20: 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20  STINCT - CAST ( 
2f30: 2d 20 33 32 20 41 53 20 49 4e 54 45 47 45 52 20  - 32 AS INTEGER 
2f40: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
2f50: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 0d  or0..----..32...
2f60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f70: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 34  ..SELECT ALL ( 4
2f80: 33 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  3 ) * col2 AS co
2f90: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2fa0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 38  cor0..----..1118
2fb0: 0d 0a 31 31 36 31 0d 0a 31 36 33 34 0d 0a 0d 0a  ..1161..1634....
2fc0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2fd0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2fe0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2ff0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
3000: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
3010: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3020: 20 32 34 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   24 col0 FROM ta
3030: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor0..----..2
3040: 34 0d 0a 32 34 0d 0a 32 34 0d 0a 0d 0a 71 75 65  4..24..24....que
3050: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3060: 4c 45 43 54 20 41 4c 4c 20 34 35 20 2b 20 2d 20  LECT ALL 45 + - 
3070: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col2 * col2 FROM
3080: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
3090: 0d 0a 2d 31 33 39 39 0d 0a 2d 36 33 31 0d 0a 2d  ..-1399..-631..-
30a0: 36 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  684....onlyif my
30b0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
30c0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
30d0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
30e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
30f0: 65 6c 2d 38 30 0d 0a 53 45 4c 45 43 54 20 41 4c  el-80..SELECT AL
3100: 4c 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20  L - ( cor0.col1 
3110: 29 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  ) DIV + col1 FRO
3120: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
3130: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31  ----..-1..-1..-1
3140: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
3150: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
3160: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
3170: 72 74 20 6c 61 62 65 6c 2d 38 30 0d 0a 53 45 4c  rt label-80..SEL
3180: 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 72 30  ECT ALL - ( cor0
3190: 2e 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 31  .col1 ) / + col1
31a0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
31b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
31c0: 0d 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..-1....onlyif m
31d0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
31e0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
31f0: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
3200: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
3210: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3220: 2d 38 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  -81..SELECT CAST
3230: 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ( + cor0.col2 AS
3240: 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31   SIGNED ) * col1
3250: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
3260: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  r0..----..1534..
3270: 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69 70  646..837....skip
3280: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
3290: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
32a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
32b0: 2d 38 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  -81..SELECT CAST
32c0: 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ( + cor0.col2 A
32d0: 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
32e0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
32f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  cor0..----..1534
3300: 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75  ..646..837....qu
3310: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3320: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
3330: 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 + cor0.col2 
3340: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
3350: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
3360: 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d  .119..173..98...
3370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
3380: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
3390: 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T - + cor0.col1 
33a0: 2a 20 2b 20 31 34 20 2a 20 2d 20 63 6f 6c 31 20  * + 14 * - col1 
33b0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
33c0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
33d0: 0a 31 30 33 35 34 34 0d 0a 31 31 35 39 33 34 0d  .103544..115934.
33e0: 0a 31 33 31 37 32 36 0d 0a 0d 0a 71 75 65 72 79  .131726....query
33f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3400: 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20  CT ALL ( + col1 
3410: 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32  + col0 ) AS col2
3420: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
3430: 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
3440: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3450: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
3460: 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f   cor1.col0 AS co
3470: 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
3480: 62 31 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  b1 cor0, tab0 AS
3490: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor1..----..24.
34a0: 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79  .35..89....query
34b0: 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f   IIIIIIIIIIII ro
34c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
34d0: 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61  STINCT * FROM ta
34e0: 62 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20 63  b0, tab1, tab2 c
34f0: 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
3500: 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c  1..----..972 val
3510: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66  ues hashing to f
3520: 39 61 64 66 32 36 66 32 30 64 63 38 66 63 63 34  9adf26f20dc8fcc4
3530: 33 63 32 64 65 31 38 61 35 66 64 34 38 35 39 0d  3c2de18a5fd4859.
3540: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3550: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
3560: 4e 43 54 20 28 20 74 61 62 30 2e 63 6f 6c 31 20  NCT ( tab0.col1 
3570: 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  ) FROM tab0, tab
3580: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
3590: 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39  .----..86..91..9
35a0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
35b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
35c0: 20 33 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   37 AS col1 FROM
35d0: 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
35e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
35f0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61  ues hashing to a
3600: 31 30 62 30 33 65 37 32 38 36 30 62 39 34 39 62  10b03e72860b949b
3610: 64 66 66 35 33 38 32 37 37 30 30 61 39 61 38 0d  dff53827700a9a8.
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 41 4c 4c 20 2d  rt..SELECT ALL -
3640: 20 63 6f 6c 32 20 2b 20 38 38 20 41 53 20 63 6f   col2 + 88 AS co
3650: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
3660: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 0d 0a  cor0..----..50..
3670: 36 31 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20  61..62....query 
3680: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3690: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 28  T DISTINCT + + (
36a0: 20 63 6f 6c 31 20 29 20 2b 20 2d 20 35 33 20 2a   col1 ) + - 53 *
36b0: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
36c0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
36d0: 0a 32 38 38 38 0d 0a 33 30 33 31 0d 0a 35 31 30  .2888..3031..510
36e0: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
36f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
3700: 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 31  1 + + col0 * - 1
3710: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
3720: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3730: 2d 0d 0a 2d 32 30 32 0d 0a 2d 33 32 33 0d 0a 2d  -..-202..-323..-
3740: 39 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  977....query I r
3750: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
3760: 49 53 54 49 4e 43 54 20 2d 20 38 38 20 2a 20 2d  ISTINCT - 88 * -
3770: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
3780: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
3790: 34 39 36 0d 0a 32 37 32 38 0d 0a 35 31 39 32 0d  496..2728..5192.
37a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37b0: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
37c0: 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  0.col2 * + col1 
37d0: 2b 20 28 20 28 20 63 6f 6c 32 20 29 20 29 20 46  + ( ( col2 ) ) F
37e0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
37f0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 30 35 0d 0a 2d  ..----..-2805..-
3800: 37 33 38 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  7380..-96....que
3810: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3820: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
3830: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  + - cor0.col1 * 
3840: 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col2 * cor0.col0
3850: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
3860: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
3870: 0a 2d 31 31 39 35 33 34 0d 0a 2d 35 31 30 30 30  .-119534..-51000
3880: 0d 0a 2d 35 37 39 37 0d 0a 0d 0a 71 75 65 72 79  ..-5797....query
3890: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38a0: 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  CT - + col2 + + 
38b0: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
38c0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
38d0: 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35  ----..-20..41..5
38e0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
38f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
3900: 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 31 20  TINCT tab0.col1 
3910: 2a 20 2d 20 31 35 20 41 53 20 63 6f 6c 30 20 46  * - 15 AS col0 F
3920: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
3930: 2d 31 32 39 30 0d 0a 2d 31 33 36 35 0d 0a 2d 31  -1290..-1365..-1
3940: 34 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  455....onlyif my
3950: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
3960: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
3970: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
3980: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
3990: 65 6c 2d 39 37 0d 0a 53 45 4c 45 43 54 20 2d 20  el-97..SELECT - 
39a0: 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 46 52  col2 DIV col1 FR
39b0: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
39c0: 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-2..0..0....
39d0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
39e0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
39f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3a00: 61 62 65 6c 2d 39 37 0d 0a 53 45 4c 45 43 54 20  abel-97..SELECT 
3a10: 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52  - col2 / col1 FR
3a20: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
3a30: 2d 2d 0d 0a 2d 32 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-2..0..0....
3a40: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
3a50: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
3a60: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
3a70: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
3a80: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
3a90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3aa0: 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   - - col2 * col1
3ab0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
3ac0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
3ad0: 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
3ae0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3af0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
3b00: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 36 32 20 46  cor0.col2 * 62 F
3b10: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
3b20: 2d 2d 2d 0d 0a 31 31 37 31 38 0d 0a 31 32 35 37  ---..11718..1257
3b30: 33 36 0d 0a 31 38 36 31 32 34 0d 0a 0d 0a 71 75  36..186124....qu
3b40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3b50: 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  ELECT - - col0 *
3b60: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
3b70: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
3b80: 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37  ----..-1225..-57
3b90: 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72  6..-7921....quer
3ba0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3bb0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
3bc0: 6f 6c 30 20 2a 20 36 31 20 2a 20 2d 20 31 32 20  ol0 * 61 * - 12 
3bd0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
3be0: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 39 36 0d 0a  1..----..-2196..
3bf0: 2d 34 36 38 34 38 0d 0a 2d 35 38 35 36 30 0d 0a  -46848..-58560..
3c00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3c10: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 39  t..SELECT ALL 49
3c20: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
3c30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3c40: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
3c50: 20 74 6f 20 63 62 34 30 37 38 33 63 30 66 66 66   to cb40783c0fff
3c60: 37 32 65 38 38 30 32 63 64 66 30 36 38 32 65 37  72e8802cdf0682e7
3c70: 63 62 35 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  cb55....onlyif m
3c80: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
3c90: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
3ca0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
3cb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
3cc0: 62 65 6c 2d 31 30 33 0d 0a 53 45 4c 45 43 54 20  bel-103..SELECT 
3cd0: 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d  ALL - - col2 * -
3ce0: 20 35 39 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20   59 + cor0.col1 
3cf0: 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  DIV cor0.col1 FR
3d00: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
3d10: 2d 2d 0d 0a 2d 31 39 34 36 0d 0a 2d 34 38 33 37  --..-1946..-4837
3d20: 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-58....skipif 
3d30: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
3d40: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
3d50: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
3d60: 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  3..SELECT ALL - 
3d70: 2d 20 63 6f 6c 32 20 2a 20 2d 20 35 39 20 2b 20  - col2 * - 59 + 
3d80: 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 72 30  cor0.col1 / cor0
3d90: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
3da0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34  cor0..----..-194
3db0: 36 0d 0a 2d 34 38 33 37 0d 0a 2d 35 38 0d 0a 0d  6..-4837..-58...
3dc0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
3dd0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
3de0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
3df0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
3e00: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34  owsort label-104
3e10: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
3e20: 32 20 2b 20 28 20 63 6f 6c 31 20 29 20 44 49 56  2 + ( col1 ) DIV
3e30: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
3e40: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
3e50: 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d 38 31 0d  .----..-30..-81.
3e60: 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
3e70: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
3e80: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
3e90: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 0d 0a  sort label-104..
3ea0: 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
3eb0: 2b 20 28 20 63 6f 6c 31 20 29 20 2f 20 63 6f 6c  + ( col1 ) / col
3ec0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
3ed0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3ee0: 2d 0d 0a 2d 33 30 0d 0a 2d 38 31 0d 0a 31 0d 0a  -..-30..-81..1..
3ef0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3f00: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
3f10: 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20   + ( - col2 ) * 
3f20: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
3f30: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
3f40: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 35 0d 0a 2d  ..----..-1475..-
3f50: 36 32 39 0d 0a 2d 38 30 36 0d 0a 0d 0a 71 75 65  629..-806....que
3f60: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3f70: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
3f80: 6c 30 20 2b 20 2d 20 28 20 2b 20 63 6f 72 30 2e  l0 + - ( + cor0.
3f90: 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 30 20  col2 ) + - col0 
3fa0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
3fb0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33  0..----..-1..-33
3fc0: 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-82....onlyif 
3fd0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
3fe0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
3ff0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
4000: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4010: 61 62 65 6c 2d 31 30 37 0d 0a 53 45 4c 45 43 54  abel-107..SELECT
4020: 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   - col0 + - col1
4030: 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   DIV - col1 FROM
4040: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
4050: 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33 34 0d 0a 2d  ---..-23..-34..-
4060: 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  88....skipif mys
4070: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
4080: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
4090: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37 0d 0a  sort label-107..
40a0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
40b0: 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20  - col1 / - col1 
40c0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
40d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33  0..----..-23..-3
40e0: 34 0d 0a 2d 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  4..-88....onlyif
40f0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
4100: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
4110: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
4120: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4130: 6c 61 62 65 6c 2d 31 30 38 0d 0a 53 45 4c 45 43  label-108..SELEC
4140: 54 20 63 6f 6c 30 20 2a 20 2b 20 34 37 20 2b 20  T col0 * + 47 + 
4150: 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20  col0 DIV - col1 
4160: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
4170: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
4180: 0a 31 34 31 0d 0a 33 30 30 32 0d 0a 33 37 35 34  .141..3002..3754
4190: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
41a0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
41b0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
41c0: 72 74 20 6c 61 62 65 6c 2d 31 30 38 0d 0a 53 45  rt label-108..SE
41d0: 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b 20 34 37  LECT col0 * + 47
41e0: 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31   + col0 / - col1
41f0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
4200: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
4210: 0d 0a 31 34 31 0d 0a 33 30 30 32 0d 0a 33 37 35  ..141..3002..375
4220: 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
4230: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
4240: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
4250: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
4260: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
4270: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
4280: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
4290: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 63   col0 * + col0 c
42a0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
42b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d   cor0..----..49.
42c0: 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 6f  .6084..6241....o
42d0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
42e0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
42f0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
4300: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
4310: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 0d 0a  sort label-110..
4320: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20  SELECT col1 + - 
4330: 28 20 63 6f 6c 31 20 29 20 44 49 56 20 2d 20 63  ( col1 ) DIV - c
4340: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
4350: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
4360: 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32 37 0d  ---..11..14..27.
4370: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
4380: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
4390: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
43a0: 74 20 6c 61 62 65 6c 2d 31 31 30 0d 0a 53 45 4c  t label-110..SEL
43b0: 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 28 20 63  ECT col1 + - ( c
43c0: 6f 6c 31 20 29 20 2f 20 2d 20 63 6f 6c 31 20 41  ol1 ) / - col1 A
43d0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
43e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
43f0: 31 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 6f 6e  11..14..27....on
4400: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
4410: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
4420: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
4430: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
4440: 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31 0d 0a 53  ort label-111..S
4450: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
4460: 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20 44 49   + - ( col1 ) DI
4470: 56 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  V + col0 AS col0
4480: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
4490: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d  r0..----..-57..-
44a0: 36 32 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69  62..-96....skipi
44b0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
44c0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
44d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
44e0: 31 31 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  111..SELECT ALL 
44f0: 2d 20 63 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c  - col2 + - ( col
4500: 31 20 29 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20  1 ) / + col0 AS 
4510: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
4520: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
4530: 37 0d 0a 2d 36 32 0d 0a 2d 39 36 0d 0a 0d 0a 71  7..-62..-96....q
4540: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4550: 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20  SELECT - - col1 
4560: 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + + col2 * - col
4570: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
4580: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 30  or0..----..-2890
4590: 0d 0a 2d 33 32 33 39 0d 0a 2d 39 32 30 33 0d 0a  ..-3239..-9203..
45a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
45b0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
45c0: 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 + col1 AS col
45d0: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
45e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a  or0..----..119..
45f0: 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79  173..98....query
4600: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4610: 43 54 20 63 6f 6c 30 20 2a 20 2d 20 34 33 20 46  CT col0 * - 43 F
4620: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4630: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 32 0d 0a 2d  ..----..-1032..-
4640: 31 35 30 35 0d 0a 2d 33 38 32 37 0d 0a 0d 0a 71  1505..-3827....q
4650: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4660: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
4670: 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  - ( - cor0.col0 
4680: 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
4690: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  or0..----..24..3
46a0: 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
46b0: 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72  IIIIIIIIIIIIII r
46c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
46d0: 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41  LL * FROM tab2 A
46e0: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
46f0: 4e 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  N tab0, tab1 AS 
4700: 63 6f 72 31 2c 20 74 61 62 32 2c 20 74 61 62 32  cor1, tab2, tab2
4710: 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor2..----..364
4720: 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  5 values hashing
4730: 20 74 6f 20 61 30 35 63 30 30 34 36 39 35 64 36   to a05c004695d6
4740: 34 34 62 64 63 37 64 30 37 35 34 32 64 32 39 65  44bdc7d07542d29e
4750: 32 30 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2010....onlyif m
4760: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
4770: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
4780: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
4790: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
47a0: 62 65 6c 2d 31 31 37 0d 0a 53 45 4c 45 43 54 20  bel-117..SELECT 
47b0: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
47c0: 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  DIV - col1 AS co
47d0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
47e0: 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
47f0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
4800: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
4810: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
4820: 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
4830: 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f  CT + col0 / - co
4840: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
4850: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab0..----..0...
4860: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4870: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
4880: 2a 20 63 6f 6c 30 20 2b 20 2d 20 28 20 38 36 20  * col0 + - ( 86 
4890: 29 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 46 52  ) + tab2.col2 FR
48a0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
48b0: 31 33 39 31 0d 0a 2d 32 37 36 0d 0a 2d 34 36 36  1391..-276..-466
48c0: 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
48d0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
48e0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
48f0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
4900: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4910: 2d 31 31 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -119..SELECT DIS
4920: 54 49 4e 43 54 20 28 20 74 61 62 30 2e 63 6f 6c  TINCT ( tab0.col
4930: 31 20 29 20 44 49 56 20 2d 20 28 20 2b 20 63 6f  1 ) DIV - ( + co
4940: 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l1 ) FROM tab0..
4950: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ----..-1....skip
4960: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
4970: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
4980: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
4990: 2d 31 31 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -119..SELECT DIS
49a0: 54 49 4e 43 54 20 28 20 74 61 62 30 2e 63 6f 6c  TINCT ( tab0.col
49b0: 31 20 29 20 2f 20 2d 20 28 20 2b 20 63 6f 6c 31  1 ) / - ( + col1
49c0: 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
49d0: 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  --..-1....query 
49e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
49f0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 36 20  T DISTINCT + 26 
4a00: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
4a10: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 0d 0a 71  1..----..26....q
4a20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4a30: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
4a40: 35 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  53 AS col2 FROM 
4a50: 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62 31  tab0, tab1, tab1
4a60: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4a70: 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
4a80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
4a90: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  col2 * col1 + + 
4aa0: 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  ( - col1 ) AS co
4ab0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
4ac0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34  cor0..----..-194
4ad0: 0d 0a 2d 32 39 32 34 0d 0a 2d 37 35 35 33 0d 0a  ..-2924..-7553..
4ae0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4af0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
4b00: 6c 30 20 2b 20 28 20 2d 20 31 37 20 29 20 2a 20  l0 + ( - 17 ) * 
4b10: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
4b20: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4b30: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 34 0d 0a 2d  ..----..-1424..-
4b40: 33 38 34 0d 0a 2d 35 36 30 0d 0a 0d 0a 71 75 65  384..-560....que
4b50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4b60: 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LECT + cor0.col2
4b70: 20 2a 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f   * - ( - cor0.co
4b80: 6c 30 20 2a 20 63 6f 6c 32 20 29 20 2b 20 2d 20  l0 * col2 ) + - 
4b90: 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col2 + + col2 * 
4ba0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
4bb0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
4bc0: 2d 2d 2d 2d 0d 0a 31 31 34 36 38 34 0d 0a 35 34  ----..114684..54
4bd0: 32 33 36 0d 0a 35 39 31 33 0d 0a 0d 0a 71 75 65  236..5913....que
4be0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4bf0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  LECT - col1 * co
4c00: 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l1 + + col2 AS c
4c10: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
4c20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33   cor0..----..-43
4c30: 0d 0a 2d 36 32 32 0d 0a 2d 37 33 0d 0a 0d 0a 71  ..-622..-73....q
4c40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4c50: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36 39 20  SELECT ALL - 69 
4c60: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
4c70: 0a 2d 36 39 0d 0a 2d 36 39 0d 0a 2d 36 39 0d 0a  .-69..-69..-69..
4c80: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
4c90: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
4ca0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
4cb0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
4cc0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
4cd0: 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
4ce0: 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT + cor0.col2 +
4cf0: 20 31 34 20 44 49 56 20 37 20 63 6f 6c 30 20 46   14 DIV 7 col0 F
4d00: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4d10: 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33 35 0d 0a 38  ..----..3..35..8
4d20: 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
4d30: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
4d40: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
4d50: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
4d60: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
4d70: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
4d80: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
4d90: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4da0: 65 6c 2d 31 32 37 0d 0a 53 45 4c 45 43 54 20 44  el-127..SELECT D
4db0: 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
4dc0: 6f 6c 32 20 2b 20 31 34 20 2f 20 37 20 63 6f 6c  ol2 + 14 / 7 col
4dd0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
4de0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 33 35  or0..----..3..35
4df0: 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..84....query I 
4e00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4e10: 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  + col2 + - col1 
4e20: 2a 20 2b 20 38 35 20 2a 20 2b 20 63 6f 6c 32 20  * + 85 * + col2 
4e30: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
4e40: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
4e50: 30 35 39 38 34 0d 0a 2d 31 31 39 32 38 36 0d 0a  05984..-119286..
4e60: 2d 34 38 33 39 33 0d 0a 0d 0a 71 75 65 72 79 20  -48393....query 
4e70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4e80: 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a  T ALL + + col2 *
4e90: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
4ea0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  0 cor0..----..35
4eb0: 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71  ..7298..792....q
4ec0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4ed0: 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
4ee0: 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  l1 * col1 + col0
4ef0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
4f00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 35 39 0d 0a  r0..----..3559..
4f10: 33 36 38 0d 0a 39 36 38 0d 0a 0d 0a 71 75 65 72  368..968....quer
4f20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4f30: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
4f40: 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 31   col2 * ( - col1
4f50: 20 2a 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d   * + col2 ) FROM
4f60: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
4f70: 2d 2d 2d 0d 0a 2d 36 31 31 38 38 34 0d 0a 2d 39  ---..-611884..-9
4f80: 33 36 35 34 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65  3654..-97....que
4f90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4fa0: 4c 45 43 54 20 2d 20 33 38 20 46 52 4f 4d 20 74  LECT - 38 FROM t
4fb0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
4fc0: 2d 0d 0a 2d 33 38 0d 0a 2d 33 38 0d 0a 2d 33 38  -..-38..-38..-38
4fd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4fe0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 39  ort..SELECT + 89
4ff0: 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20   * + ( + col0 ) 
5000: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5010: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33 36 0d 0a 33  0..----..2136..3
5020: 31 31 35 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65  115..7921....que
5030: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5040: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
5050: 2b 20 2b 20 37 38 20 2a 20 2b 20 63 6f 6c 30 20  + + 78 * + col0 
5060: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
5070: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
5080: 0a 35 31 39 0d 0a 36 30 35 38 0d 0a 36 31 32 34  .519..6058..6124
5090: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
50a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
50b0: 38 35 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  85 ) AS col2 FRO
50c0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
50d0: 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 38 35 0d 0a  ----..-85..-85..
50e0: 2d 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -85....query I r
50f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
5100: 6f 6c 31 20 2a 20 2d 20 32 35 20 46 52 4f 4d 20  ol1 * - 25 FROM 
5110: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
5120: 2d 2d 0d 0a 2d 31 34 37 35 0d 0a 2d 34 32 35 0d  --..-1475..-425.
5130: 0a 2d 37 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .-775....query I
5140: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5150: 20 41 4c 4c 20 31 30 20 46 52 4f 4d 20 74 61 62   ALL 10 FROM tab
5160: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  2 cor0..----..10
5170: 0d 0a 31 30 0d 0a 31 30 0d 0a 0d 0a 71 75 65 72  ..10..10....quer
5180: 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49  y IIIIIIIIIIIIII
5190: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
51a0: 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  T * FROM tab2, t
51b0: 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
51c0: 32 20 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61  2 cor1, tab0, ta
51d0: 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b1 AS cor2..----
51e0: 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
51f0: 73 68 69 6e 67 20 74 6f 20 64 38 36 35 63 36 38  shing to d865c68
5200: 62 38 36 65 36 36 38 39 38 65 65 61 63 32 38 66  b86e66898eeac28f
5210: 34 35 30 65 34 38 65 37 30 0d 0a 0d 0a 73 6b 69  450e48e70....ski
5220: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
5230: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
5240: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
5250: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
5260: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
5270: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5280: 4c 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c  L + + col0 - col
5290: 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0 col0 FROM tab0
52a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
52b0: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
52c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
52d0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34 32  CT DISTINCT + 42
52e0: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
52f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
5300: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 32 0d 0a 31  0..----..1092..1
5310: 31 33 34 0d 0a 31 35 39 36 0d 0a 0d 0a 71 75 65  134..1596....que
5320: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5330: 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2d  LECT cor0.col0 -
5340: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
5350: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
5360: 0a 31 34 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d  .14..156..158...
5370: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5380: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33  ..SELECT ALL - 3
5390: 36 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  6 + cor0.col1 * 
53a0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
53b0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
53c0: 2d 2d 2d 2d 0d 0a 32 35 33 0d 0a 33 34 34 35 0d  ----..253..3445.
53d0: 0a 39 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .925....query I 
53e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
53f0: 36 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  61 AS col0 FROM 
5400: 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
5410: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
5420: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 37  es hashing to 07
5430: 31 34 39 39 30 35 61 37 32 62 64 38 37 35 35 33  149905a72bd87553
5440: 33 38 31 66 33 34 64 31 39 65 64 32 39 30 0d 0a  381f34d19ed290..
5450: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5460: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
5470: 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
5480: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
5490: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
54a0: 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65  .169..676....que
54b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
54c0: 4c 45 43 54 20 37 36 20 2a 20 63 6f 6c 30 20 46  LECT 76 * col0 F
54d0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
54e0: 0d 0a 2d 2d 2d 2d 0d 0a 35 33 32 0d 0a 35 39 32  ..----..532..592
54f0: 38 0d 0a 36 30 30 34 0d 0a 0d 0a 71 75 65 72 79  8..6004....query
5500: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5510: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
5520: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63  col2 + col1 AS c
5530: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
5540: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33  r0..----..-21..3
5550: 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3..4....query I 
5560: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5570: 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72  + - col1 + - cor
5580: 30 2e 63 6f 6c 31 20 2a 20 2d 20 28 20 63 6f 6c  0.col1 * - ( col
5590: 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
55a0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
55b0: 2d 2d 2d 0d 0a 31 35 36 0d 0a 36 35 30 0d 0a 39  ---..156..650..9
55c0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
55d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
55e0: 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  TINCT + - cor0.c
55f0: 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f  ol0 - - col1 FRO
5600: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
5610: 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 0d 0a 71  ----..2..62....q
5620: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5630: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
5640: 2b 20 34 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  + 4 * col0 FROM 
5650: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
5660: 2d 2d 0d 0a 32 38 0d 0a 33 31 32 0d 0a 33 31 36  --..28..312..316
5670: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
5680: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
5690: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
56a0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
56b0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
56c0: 31 35 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  150..SELECT ALL 
56d0: 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 72  - col2 DIV - cor
56e0: 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
56f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5700: 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70  0..1..18....skip
5710: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
5720: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
5730: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
5740: 2d 31 35 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -150..SELECT ALL
5750: 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30   - col2 / - cor0
5760: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
5770: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
5780: 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69  ..1..18....skipi
5790: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
57a0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
57b0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
57c0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
57d0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
57e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
57f0: 38 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  83 col0 FROM tab
5800: 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d 0a 38 33 0d  0..----..83..83.
5810: 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .83....query I r
5820: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
5830: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63   col2 + col1 * c
5840: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
5850: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
5860: 0d 0a 34 33 0d 0a 36 32 32 0d 0a 37 33 0d 0a 0d  ..43..622..73...
5870: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
5880: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
5890: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
58a0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
58b0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33  owsort label-153
58c0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
58d0: 32 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 28  2 + col2 DIV - (
58e0: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20   col1 ) AS col2 
58f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
5900: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d  0..----..26..27.
5910: 0a 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .36....skipif my
5920: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
5930: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
5940: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 0d  wsort label-153.
5950: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
5960: 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 28 20 63 6f   + col2 / - ( co
5970: 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
5980: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
5990: 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 36  ----..26..27..36
59a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
59b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
59c0: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  INCT - col2 * co
59d0: 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30  r0.col1 + + cor0
59e0: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
59f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
5a00: 31 31 36 38 0d 0a 2d 31 34 30 31 0d 0a 2d 35 30  1168..-1401..-50
5a10: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
5a20: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5a30: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  TINCT + col1 + c
5a40: 6f 72 30 2e 63 6f 6c 30 20 2b 20 28 20 2d 20 63  or0.col0 + ( - c
5a50: 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 2a 20 33  ol0 ) * col0 * 3
5a60: 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
5a70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 37  or0..----..-1947
5a80: 34 0d 0a 2d 32 36 39 31 33 34 0d 0a 2d 34 31 35  4..-269134..-415
5a90: 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
5aa0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
5ab0: 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col2 * cor0.col0
5ac0: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
5ad0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5ae0: 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d 0a 2d 37  .-159..-3584..-7
5af0: 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  600....query I r
5b00: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
5b10: 4c 4c 20 39 35 20 41 53 20 63 6f 6c 32 20 46 52  LL 95 AS col2 FR
5b20: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
5b30: 0a 2d 2d 2d 2d 0d 0a 39 35 0d 0a 39 35 0d 0a 39  .----..95..95..9
5b40: 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
5b50: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
5b60: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
5b70: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
5b80: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
5b90: 2d 31 35 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -158..SELECT DIS
5ba0: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  TINCT - col2 * -
5bb0: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63   col0 + + cor0.c
5bc0: 6f 6c 32 20 2a 20 31 33 20 44 49 56 20 2d 20 63  ol2 * 13 DIV - c
5bd0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
5be0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 0d 0a 33  r0..----..-72..3
5bf0: 36 33 37 0d 0a 37 36 36 35 0d 0a 0d 0a 73 6b 69  637..7665....ski
5c00: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
5c10: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
5c20: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5c30: 6c 2d 31 35 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-158..SELECT DI
5c40: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
5c50: 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e  - col0 + + cor0.
5c60: 63 6f 6c 32 20 2a 20 31 33 20 2f 20 2d 20 63 6f  col2 * 13 / - co
5c70: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
5c80: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 0d 0a 33 36  0..----..-72..36
5c90: 33 37 0d 0a 37 36 36 35 0d 0a 0d 0a 71 75 65 72  37..7665....quer
5ca0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5cb0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
5cc0: 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 * + col2 * col
5cd0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
5ce0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
5cf0: 2d 0d 0a 31 33 32 33 0d 0a 31 35 38 31 38 34 0d  -..1323..158184.
5d00: 0a 32 33 37 31 35 38 0d 0a 0d 0a 71 75 65 72 79  .237158....query
5d10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5d20: 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  CT + col1 + col1
5d30: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
5d40: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
5d50: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32  0..----..1360..2
5d60: 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72  48..4661....quer
5d70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5d80: 45 43 54 20 2d 20 31 31 20 2a 20 2b 20 63 6f 6c  ECT - 11 * + col
5d90: 31 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  1 + - col2 + col
5da0: 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
5db0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 0d 0a 2d 31  ..----..-103..-1
5dc0: 35 39 0d 0a 2d 33 33 37 0d 0a 0d 0a 6f 6e 6c 79  59..-337....only
5dd0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
5de0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
5df0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
5e00: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
5e10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
5e20: 61 62 65 6c 2d 31 36 32 0d 0a 53 45 4c 45 43 54  abel-162..SELECT
5e30: 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54   DISTINCT - CAST
5e40: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
5e50: 20 29 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ) / cor0.col2 A
5e60: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
5e70: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
5e80: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
5e90: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
5ea0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
5eb0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
5ec0: 65 6c 2d 31 36 32 0d 0a 53 45 4c 45 43 54 20 44  el-162..SELECT D
5ed0: 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28  ISTINCT - CAST (
5ee0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
5ef0: 20 29 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ) / cor0.col2 A
5f00: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
5f10: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
5f20: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
5f30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5f40: 45 4c 45 43 54 20 2b 20 37 31 20 46 52 4f 4d 20  ELECT + 71 FROM 
5f50: 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
5f60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
5f70: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 31  es hashing to c1
5f80: 61 61 63 65 35 64 35 66 65 32 37 37 32 31 63 63  aace5d5fe27721cc
5f90: 39 32 35 35 35 32 35 31 33 63 38 35 63 30 0d 0a  925552513c85c0..
5fa0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
5fb0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
5fc0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
5fd0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
5fe0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
5ff0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6000: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 33 39 20 2a  CT + col0 * 39 *
6010: 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   - col2 col0 FRO
6020: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
6030: 2d 2d 2d 2d 0d 0a 2d 31 31 37 30 37 38 0d 0a 2d  ----..-117078..-
6040: 37 33 37 31 0d 0a 2d 37 39 30 39 32 0d 0a 0d 0a  7371..-79092....
6050: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6060: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
6070: 20 39 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   96 AS col1 FROM
6080: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
6090: 2d 2d 2d 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  ---..96....query
60a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
60b0: 43 54 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2b 20  CT col2 + - ( + 
60c0: 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20 2d 20  col1 ) * col0 - 
60d0: 2b 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f  + col0 * tab2.co
60e0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
60f0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36  tab2..----..-106
6100: 36 30 0d 0a 2d 32 33 39 0d 0a 2d 37 35 34 36 0d  60..-239..-7546.
6110: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6120: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
6130: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  + col1 * col1 + 
6140: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
6150: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34  M tab0..----..74
6160: 35 33 0d 0a 38 34 35 32 0d 0a 39 34 34 35 0d 0a  53..8452..9445..
6170: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6180: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6190: 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  CT - col1 + - co
61a0: 6c 30 20 2b 20 31 34 20 46 52 4f 4d 20 74 61 62  l0 + 14 FROM tab
61b0: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 36  1..----..-15..-6
61c0: 30 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20  0..-79....query 
61d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
61e0: 54 20 44 49 53 54 49 4e 43 54 20 37 20 41 53 20  T DISTINCT 7 AS 
61f0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
6200: 2d 2d 2d 2d 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  ----..7....query
6210: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6220: 43 54 20 2b 20 38 37 20 2b 20 74 61 62 31 2e 63  CT + 87 + tab1.c
6230: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
6240: 2d 2d 2d 0d 0a 31 34 31 0d 0a 31 34 34 0d 0a 31  ---..141..144..1
6250: 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
6260: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
6270: 6c 31 20 2b 20 35 36 20 46 52 4f 4d 20 74 61 62  l1 + 56 FROM tab
6280: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d 0a 31 34  0..----..142..14
6290: 37 0d 0a 31 35 33 0d 0a 0d 0a 71 75 65 72 79 20  7..153....query 
62a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
62b0: 54 20 31 34 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 14 AS col0 FRO
62c0: 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61  M tab1, tab2, ta
62d0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
62e0: 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
62f0: 69 6e 67 20 74 6f 20 34 30 39 63 31 37 39 30 62  ing to 409c1790b
6300: 37 30 32 35 34 30 64 64 39 64 63 30 36 37 63 31  702540dd9dc067c1
6310: 39 36 35 62 37 63 30 0d 0a 0d 0a 71 75 65 72 79  965b7c0....query
6320: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6330: 43 54 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20  CT ALL ( col1 ) 
6340: 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * - col2 AS col1
6350: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
6360: 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a  ..-1248..-1404..
6370: 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -570....query I 
6380: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6390: 32 35 20 2b 20 35 20 2a 20 63 6f 6c 31 20 2a 20  25 + 5 * col1 * 
63a0: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
63b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 35 35 0d 0a 2d  ..----..-3355..-
63c0: 34 37 35 0d 0a 2d 38 32 30 0d 0a 0d 0a 71 75 65  475..-820....que
63d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
63e0: 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20  LECT + ( + col0 
63f0: 29 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  ) - - col2 FROM 
6400: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d  tab0..----..171.
6410: 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69  .36..57....skipi
6420: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
6430: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
6440: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
6450: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
6460: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
6470: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
6480: 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20 29 20  col1 * ( col1 ) 
6490: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
64a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
64b0: 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71  0..169..676....q
64c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
64d0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
64e0: 2d 20 2d 20 28 20 2b 20 32 31 20 29 20 46 52 4f  - - ( + 21 ) FRO
64f0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
6500: 2d 2d 2d 2d 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72  ----..21....quer
6510: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6520: 45 43 54 20 63 6f 72 31 2e 63 6f 6c 31 20 2b 20  ECT cor1.col1 + 
6530: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
6540: 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
6550: 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
6560: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
6570: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 33  es hashing to 83
6580: 63 66 30 33 39 39 61 36 64 37 33 31 31 31 32 39  cf0399a6d7311129
6590: 31 30 62 65 37 31 33 63 39 32 66 61 34 34 0d 0a  10be713c92fa44..
65a0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
65b0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
65c0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
65d0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
65e0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
65f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6600: 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  CT - - col2 + - 
6610: 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 63 6f  ( cor0.col2 ) co
6620: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
6630: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
6640: 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
6650: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
6660: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
6670: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
6680: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
6690: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
66a0: 31 38 30 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  180..SELECT CAST
66b0: 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
66c0: 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61   ) FROM tab0, ta
66d0: 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b0 AS cor0, tab0
66e0: 20 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41   AS cor1, tab0 A
66f0: 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor2..----..81
6700: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
6710: 74 6f 20 63 62 33 33 63 33 30 64 36 66 35 32 62  to cb33c30d6f52b
6720: 62 62 32 34 33 33 38 61 32 39 33 63 37 34 30 66  bb24338a293c740f
6730: 32 39 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  29c....skipif my
6740: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
6750: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
6760: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 30 0d  wsort label-180.
6770: 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e  .SELECT CAST ( N
6780: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
6790: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
67a0: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
67b0: 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20  S cor1, tab0 AS 
67c0: 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76  cor2..----..81 v
67d0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
67e0: 20 63 62 33 33 63 33 30 64 36 66 35 32 62 62 62   cb33c30d6f52bbb
67f0: 32 34 33 33 38 61 32 39 33 63 37 34 30 66 32 39  24338a293c740f29
6800: 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  c....skipif post
6810: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
6820: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
6830: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
6840: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
6850: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6860: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
6870: 20 74 61 62 31 2e 63 6f 6c 31 20 63 6f 6c 30 20   tab1.col1 col0 
6880: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
6890: 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a  .-10..-13..-26..
68a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
68b0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
68c0: 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  l0 * - col2 + - 
68d0: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
68e0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
68f0: 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 37 33 38 30  ----..-36..-7380
6900: 0d 0a 2d 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20  ..-825....query 
6910: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6920: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
6930: 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 + col2 FROM 
6940: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
6950: 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71  .-34..-7..9....q
6960: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6970: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6980: 2d 20 63 6f 6c 31 20 2a 20 35 39 20 2b 20 2b 20  - col1 * 59 + + 
6990: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col2 * + col0 FR
69a0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
69b0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 33 0d 0a 2d 31  .----..-1453..-1
69c0: 36 34 30 0d 0a 31 39 39 39 0d 0a 0d 0a 71 75 65  640..1999....que
69d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
69e0: 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  LECT col2 * col0
69f0: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41   + - cor0.col0 A
6a00: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
6a10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6a20: 31 38 32 0d 0a 31 39 35 30 0d 0a 32 39 32 33 0d  182..1950..2923.
6a30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6a40: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
6a50: 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  NCT + col0 * - c
6a60: 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  or0.col0 + cor0.
6a70: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
6a80: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 34  or0..----..-1224
6a90: 0d 0a 2d 35 34 33 0d 0a 2d 37 38 33 39 0d 0a 0d  ..-543..-7839...
6aa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6ab0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
6ac0: 30 20 2a 20 32 34 20 46 52 4f 4d 20 74 61 62 31  0 * 24 FROM tab1
6ad0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   cor0..----..153
6ae0: 36 0d 0a 31 39 32 30 0d 0a 37 32 0d 0a 0d 0a 71  6..1920..72....q
6af0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6b00: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6b10: 2d 20 63 6f 6c 31 20 2d 20 33 33 20 46 52 4f 4d  - col1 - 33 FROM
6b20: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
6b30: 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 32 34 0d  ---..-119..-124.
6b40: 0a 2d 31 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-130....query I
6b50: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6b60: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
6b70: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
6b80: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
6b90: 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d  04..-117..-34...
6ba0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6bb0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
6bc0: 20 63 6f 6c 30 20 2a 20 28 20 2d 20 31 39 20 29   col0 * ( - 19 )
6bd0: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
6be0: 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31 34 38 32  .----..133..1482
6bf0: 0d 0a 31 35 30 31 0d 0a 0d 0a 71 75 65 72 79 20  ..1501....query 
6c00: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
6c10: 54 20 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c  T col2 + ( - col
6c20: 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  0 ) FROM tab0 co
6c30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d  r0..----..-34..-
6c40: 37 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7..9....query I 
6c50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6c60: 2d 20 2d 20 63 6f 6c 32 20 2b 20 37 20 2a 20 63  - - col2 + 7 * c
6c70: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
6c80: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
6c90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 35 0d 0a 36  r0..----..635..6
6ca0: 38 30 0d 0a 37 31 39 0d 0a 0d 0a 71 75 65 72 79  80..719....query
6cb0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6cc0: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
6cd0: 2d 20 37 39 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  - 79 * col0 FROM
6ce0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
6cf0: 2d 2d 2d 0d 0a 2d 35 38 30 0d 0a 2d 36 31 38 38  ---..-580..-6188
6d00: 0d 0a 2d 36 32 37 39 0d 0a 0d 0a 71 75 65 72 79  ..-6279....query
6d10: 20 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d   IIIIII rowsort.
6d20: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
6d30: 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61   * FROM tab1, ta
6d40: 62 31 20 41 53 20 63 6f 72 30 20 57 48 45 52 45  b1 AS cor0 WHERE
6d50: 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 63   NULL NOT IN ( c
6d60: 6f 72 30 2e 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  or0.col1 )..----
6d70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6d80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
6d90: 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 2b  - ( - col1 ) * +
6da0: 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
6db0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
6dc0: 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
6dd0: 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
6de0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
6df0: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
6e00: 2b 20 39 37 20 46 52 4f 4d 20 74 61 62 30 20 63  + 97 FROM tab0 c
6e10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 30 31 0d  or0..----..3201.
6e20: 0a 37 39 35 34 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c  .7954..97....onl
6e30: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
6e40: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
6e50: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
6e60: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
6e70: 72 74 20 6c 61 62 65 6c 2d 31 39 37 0d 0a 53 45  rt label-197..SE
6e80: 4c 45 43 54 20 2d 20 37 31 20 2b 20 63 6f 6c 31  LECT - 71 + col1
6e90: 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 30 20 46   DIV col0 col0 F
6ea0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
6eb0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 37 0d 0a 2d 37 31  ..----..-67..-71
6ec0: 0d 0a 2d 37 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-71....skipif 
6ed0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
6ee0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
6ef0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
6f00: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
6f10: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
6f20: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
6f30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6f40: 20 6c 61 62 65 6c 2d 31 39 37 0d 0a 53 45 4c 45   label-197..SELE
6f50: 43 54 20 2d 20 37 31 20 2b 20 63 6f 6c 31 20 2f  CT - 71 + col1 /
6f60: 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
6f70: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
6f80: 2d 2d 0d 0a 2d 36 37 0d 0a 2d 37 31 0d 0a 2d 37  --..-67..-71..-7
6f90: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
6fa0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
6fb0: 54 49 4e 43 54 20 2b 20 28 20 63 6f 72 30 2e 63  TINCT + ( cor0.c
6fc0: 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41  ol0 ) * - col1 A
6fd0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
6fe0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6ff0: 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
7000: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7010: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
7020: 2e 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c  .col2 * cor0.col
7030: 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
7040: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
7050: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
7060: 67 20 74 6f 20 62 32 65 35 62 30 32 35 62 31 63  g to b2e5b025b1c
7070: 37 32 35 36 36 31 32 34 38 62 30 66 32 39 61 61  725661248b0f29aa
7080: 65 66 39 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ef908....query I
7090: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
70a0: 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2b 20   ALL ( col1 ) + 
70b0: 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col0 + - cor0.co
70c0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
70d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor0..----..7..7
70e0: 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  8..79....query I
70f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7100: 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31   + + col0 * col1
7110: 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   + col2 + - col0
7120: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
7130: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 33 0d 0a  r0..----..2073..
7140: 33 33 36 31 0d 0a 38 30 39 32 0d 0a 0d 0a 71 75  3361..8092....qu
7150: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7160: 45 4c 45 43 54 20 39 35 20 2a 20 2b 20 63 6f 6c  ELECT 95 * + col
7170: 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  1 * cor0.col0 + 
7180: 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f  cor0.col2 + + co
7190: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
71a0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
71b0: 0a 36 30 38 36 37 0d 0a 37 34 39 30 0d 0a 39 38  .60867..7490..98
71c0: 39 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  909....query I r
71d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
71e0: 49 53 54 49 4e 43 54 20 28 20 28 20 63 6f 6c 30  ISTINCT ( ( col0
71f0: 20 29 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f   ) ) AS col0 FRO
7200: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
7210: 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
7220: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7230: 0d 0a 53 45 4c 45 43 54 20 2b 20 32 31 20 2a 20  ..SELECT + 21 * 
7240: 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab0.col1 AS col
7250: 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
7260: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
7270: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
7280: 67 20 74 6f 20 63 31 34 33 36 61 65 34 65 63 30  g to c1436ae4ec0
7290: 34 64 61 31 32 36 61 62 61 36 38 31 36 63 33 35  4da126aba6816c35
72a0: 32 38 33 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  28313....onlyif 
72b0: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
72c0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
72d0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
72e0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
72f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7300: 6c 2d 32 30 35 0d 0a 53 45 4c 45 43 54 20 43 41  l-205..SELECT CA
7310: 53 54 28 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20  ST( + tab1.col2 
7320: 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
7330: 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
7340: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
7350: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
7360: 30 63 61 30 61 31 63 63 33 33 37 61 37 37 31 34  0ca0a1cc337a7714
7370: 61 38 39 39 30 61 37 36 34 63 66 64 62 31 37 0d  a8990a764cfdb17.
7380: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
7390: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
73a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
73b0: 74 20 6c 61 62 65 6c 2d 32 30 35 0d 0a 53 45 4c  t label-205..SEL
73c0: 45 43 54 20 43 41 53 54 20 28 20 2b 20 74 61 62  ECT CAST ( + tab
73d0: 31 2e 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  1.col2 AS INTEGE
73e0: 52 20 29 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  R ) FROM tab1, t
73f0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
7400: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
7410: 69 6e 67 20 74 6f 20 38 30 63 61 30 61 31 63 63  ing to 80ca0a1cc
7420: 33 33 37 61 37 37 31 34 61 38 39 39 30 61 37 36  337a7714a8990a76
7430: 34 63 66 64 62 31 37 0d 0a 0d 0a 71 75 65 72 79  4cfdb17....query
7440: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7450: 43 54 20 2d 20 2b 20 37 32 20 41 53 20 63 6f 6c  CT - + 72 AS col
7460: 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
7470: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
7480: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
7490: 67 20 74 6f 20 61 64 35 32 31 31 34 34 63 39 37  g to ad521144c97
74a0: 36 66 66 32 35 65 37 37 63 64 66 31 30 61 38 34  6ff25e77cdf10a84
74b0: 64 31 64 63 36 0d 0a 0d 0a 71 75 65 72 79 20 49  d1dc6....query I
74c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
74d0: 20 2d 20 2b 20 36 31 20 2a 20 2b 20 63 6f 6c 31   - + 61 * + col1
74e0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
74f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
7500: 0d 0a 2d 31 35 38 36 0d 0a 2d 36 31 30 0d 0a 2d  ..-1586..-610..-
7510: 37 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  793....query I r
7520: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
7530: 49 53 54 49 4e 43 54 20 2d 20 31 32 20 2d 20 2b  ISTINCT - 12 - +
7540: 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
7550: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
7560: 0a 2d 32 39 0d 0a 2d 34 33 0d 0a 2d 37 31 0d 0a  .-29..-43..-71..
7570: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7580: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  t..SELECT cor0.c
7590: 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ol1 + col1 * - c
75a0: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
75b0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
75c0: 2d 2d 2d 0d 0a 2d 32 37 32 0d 0a 2d 33 34 32 32  ---..-272..-3422
75d0: 0d 0a 2d 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-930....query 
75e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
75f0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72  T DISTINCT - cor
7600: 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  0.col1 * - col1 
7610: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
7620: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7630: 31 33 35 32 30 0d 0a 32 30 32 38 0d 0a 36 34 30  13520..2028..640
7640: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
7650: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
7660: 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 30 20 29  TINCT ( + col0 )
7670: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
7680: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  b1..----..3..64.
7690: 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
76a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
76b0: 4c 4c 20 32 33 20 46 52 4f 4d 20 74 61 62 31 20  LL 23 FROM tab1 
76c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a  cor0..----..23..
76d0: 32 33 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79 20  23..23....query 
76e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
76f0: 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63  T ALL - col1 * c
7700: 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
7710: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
7720: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32  0..----..-119652
7730: 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d  ..-51034..-5859.
7740: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7750: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
7760: 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
7770: 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  1 * - col1 AS co
7780: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
7790: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36  0..----..-43..-6
77a0: 32 32 0d 0a 2d 37 33 0d 0a 0d 0a 71 75 65 72 79  22..-73....query
77b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
77c0: 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT + + cor0.col1
77d0: 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53   * ( - col2 ) AS
77e0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
77f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
7800: 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37  1534..-646..-837
7810: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
7820: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
7830: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
7840: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
7850: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
7860: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7870: 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31  LECT - tab1.col1
7880: 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46   + - col0 col2 F
7890: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
78a0: 2d 32 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d  -29..-74..-93...
78b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
78c0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
78d0: 63 6f 6c 30 20 2b 20 33 35 20 2a 20 2d 20 38 39  col0 + 35 * - 89
78e0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
78f0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 37 0d  b2..----..-1087.
7900: 0a 2d 31 31 33 0d 0a 2d 32 39 32 36 0d 0a 0d 0a  .-113..-2926....
7910: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
7920: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
7930: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
7940: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
7950: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
7960: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7970: 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   - + cor0.col1 +
7980: 20 2d 20 32 38 20 63 6f 6c 31 20 46 52 4f 4d 20   - 28 col1 FROM 
7990: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
79a0: 2d 2d 0d 0a 2d 31 31 34 0d 0a 2d 31 31 39 0d 0a  --..-114..-119..
79b0: 2d 31 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -125....query I 
79c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
79d0: 44 49 53 54 49 4e 43 54 20 2b 20 36 33 20 46 52  DISTINCT + 63 FR
79e0: 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  OM tab1, tab0 AS
79f0: 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
7a00: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 0d  or1..----..63...
7a10: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
7a20: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
7a30: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
7a40: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
7a50: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
7a60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7a70: 54 20 2d 20 28 20 63 6f 6c 31 20 2a 20 2d 20 63  T - ( col1 * - c
7a80: 6f 6c 31 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  ol1 ) col2 FROM 
7a90: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d  tab2..----..289.
7aa0: 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 6f 6e  .3481..961....on
7ab0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
7ac0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
7ad0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
7ae0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
7af0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
7b00: 20 6c 61 62 65 6c 2d 32 32 31 0d 0a 53 45 4c 45   label-221..SELE
7b10: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
7b20: 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
7b30: 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30 2c  MAL ) FROM tab0,
7b40: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
7b50: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
7b60: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
7b70: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
7b80: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7b90: 6c 2d 32 32 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-221..SELECT DI
7ba0: 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20  STINCT + CAST ( 
7bb0: 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 46  NULL AS REAL ) F
7bc0: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
7bd0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
7be0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
7bf0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
7c00: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
7c10: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
7c20: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
7c30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7c40: 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 37 34  SELECT col1 * 74
7c50: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
7c60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 34  cor0..----..1924
7c70: 0d 0a 37 34 30 0d 0a 39 36 32 0d 0a 0d 0a 71 75  ..740..962....qu
7c80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7c90: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 36 35  ELECT ALL - + 65
7ca0: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20   FROM tab1 cor0 
7cb0: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20  CROSS JOIN tab1 
7cc0: 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
7cd0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
7ce0: 74 6f 20 37 34 34 35 33 31 35 37 35 63 31 62 36  to 744531575c1b6
7cf0: 34 36 31 65 64 32 39 31 36 64 34 39 34 30 65 34  461ed2916d4940e4
7d00: 64 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  d23....query I r
7d10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
7d20: 38 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  8 + + col0 AS co
7d30: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
7d40: 2d 2d 0d 0a 31 31 36 0d 0a 31 31 37 0d 0a 34 35  --..116..117..45
7d50: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
7d60: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
7d70: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
7d80: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
7d90: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
7da0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7db0: 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 63  LECT cor0.col0 c
7dc0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
7dd0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
7de0: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
7df0: 69 6e 67 20 74 6f 20 39 35 62 39 36 63 61 31 64  ing to 95b96ca1d
7e00: 62 65 32 65 33 39 61 30 66 61 37 38 66 35 30 64  be2e39a0fa78f50d
7e10: 33 37 34 66 35 31 61 0d 0a 0d 0a 71 75 65 72 79  374f51a....query
7e20: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7e30: 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31  CT ALL cor0.col1
7e40: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a   * - cor0.col0 *
7e50: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   + cor0.col2 FRO
7e60: 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
7e70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
7e80: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
7e90: 61 64 62 30 37 64 66 34 33 30 30 38 34 63 30 33  adb07df430084c03
7ea0: 31 30 31 31 65 31 37 64 63 31 62 31 33 63 38 33  1011e17dc1b13c83
7eb0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7ec0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
7ed0: 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 63 6f 6c  col1 * - ( - col
7ee0: 32 20 2a 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f  2 * + col0 ) FRO
7ef0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36  M tab1..----..36
7f00: 34 38 30 0d 0a 34 32 31 32 0d 0a 39 39 38 34 30  480..4212..99840
7f10: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
7f20: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
7f30: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
7f40: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
7f50: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7f60: 32 32 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  228..SELECT - - 
7f70: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20  col1 DIV col1 + 
7f80: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
7f90: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
7fa0: 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a  ..----..55..58..
7fb0: 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
7fc0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
7fd0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
7fe0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 38 0d 0a  sort label-228..
7ff0: 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20  SELECT - - col1 
8000: 2f 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  / col1 + + col2 
8010: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
8020: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8030: 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a 0d 0a 71  .55..58..97....q
8040: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8050: 53 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 29 20  SELECT ( col1 ) 
8060: 2a 20 2b 20 31 36 20 2b 20 2b 20 63 6f 6c 32 20  * + 16 + + col2 
8070: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
8080: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 39 0d 0a 31  0..----..1409..1
8090: 35 33 38 0d 0a 31 35 35 33 0d 0a 0d 0a 73 6b 69  538..1553....ski
80a0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
80b0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
80c0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
80d0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
80e0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
80f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 35  wsort..SELECT 25
8100: 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20 63 6f   * ( - col0 ) co
8110: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
8120: 2d 2d 0d 0a 2d 31 37 35 0d 0a 2d 31 39 35 30 0d  --..-175..-1950.
8130: 0a 2d 31 39 37 35 0d 0a 0d 0a 71 75 65 72 79 20  .-1975....query 
8140: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8150: 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e  T DISTINCT tab0.
8160: 63 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f  col1 * + tab0.co
8170: 6c 30 20 2a 20 32 30 20 46 52 4f 4d 20 74 61 62  l0 * 20 FROM tab
8180: 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
8190: 0a 2d 2d 2d 2d 0d 0a 31 36 31 39 38 30 0d 0a 34  .----..161980..4
81a0: 31 32 38 30 0d 0a 36 37 39 30 30 0d 0a 0d 0a 71  1280..67900....q
81b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
81c0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 74  SELECT ALL + ( t
81d0: 61 62 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f  ab0.col1 ) AS co
81e0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
81f0: 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a  --..86..91..97..
8200: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
8210: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
8220: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
8230: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
8240: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
8250: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8260: 43 54 20 2b 20 28 20 2b 20 74 61 62 32 2e 63 6f  CT + ( + tab2.co
8270: 6c 32 20 29 20 2b 20 2d 20 74 61 62 32 2e 63 6f  l2 ) + - tab2.co
8280: 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  l2 * col0 + - co
8290: 6c 32 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32  l2 * + tab2.col2
82a0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
82b0: 0a 2d 2d 2d 2d 0d 0a 2d 32 36 37 38 0d 0a 2d 34  .----..-2678..-4
82c0: 34 30 38 0d 0a 2d 38 39 31 0d 0a 0d 0a 73 6b 69  408..-891....ski
82d0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
82e0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
82f0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
8300: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
8310: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
8320: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
8330: 4c 20 2d 20 2b 20 32 30 20 63 6f 6c 31 20 46 52  L - + 20 col1 FR
8340: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
8350: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 30 0d  .----..-20..-20.
8360: 0a 2d 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-20....onlyif m
8370: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
8380: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
8390: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
83a0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
83b0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
83c0: 2d 32 33 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -235..SELECT + c
83d0: 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 43  ol1 + col1 / + C
83e0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
83f0: 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 30  IMAL ) FROM tab0
8400: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8410: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
8420: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
8430: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
8440: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
8450: 72 74 20 6c 61 62 65 6c 2d 32 33 35 0d 0a 53 45  rt label-235..SE
8460: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  LECT + col1 + co
8470: 6c 31 20 2f 20 2b 20 43 41 53 54 20 28 20 4e 55  l1 / + CAST ( NU
8480: 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f  LL AS REAL ) FRO
8490: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
84a0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
84b0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
84c0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
84d0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
84e0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
84f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
8500: 6c 61 62 65 6c 2d 32 33 36 0d 0a 53 45 4c 45 43  label-236..SELEC
8510: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
8520: 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49 56 20 38  ol2 * col2 DIV 8
8530: 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  3 AS col2 FROM t
8540: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8550: 2d 0d 0a 2d 31 33 0d 0a 2d 38 31 0d 0a 30 0d 0a  -..-13..-81..0..
8560: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
8570: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
8580: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8590: 20 6c 61 62 65 6c 2d 32 33 36 0d 0a 53 45 4c 45   label-236..SELE
85a0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
85b0: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2f 20 38 33  col2 * col2 / 83
85c0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
85d0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
85e0: 0d 0a 2d 31 33 0d 0a 2d 38 31 0d 0a 30 0d 0a 0d  ..-13..-81..0...
85f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8600: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
8610: 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  * + col0 * + col
8620: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
8630: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38  or0..----..-1188
8640: 32 35 0d 0a 2d 34 39 35 33 36 0d 0a 2d 37 32 30  25..-49536..-720
8650: 38 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  811....query I r
8660: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31  owsort..SELECT 1
8670: 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41   * col1 + col0 A
8680: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
8690: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
86a0: 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75  29..74..93....qu
86b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
86c0: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  ELECT - col2 * c
86d0: 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
86e0: 32 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  2 - - col2 AS co
86f0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
8700: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 39  cor0..----..-359
8710: 30 34 0d 0a 2d 35 35 31 32 38 36 0d 0a 30 0d 0a  04..-551286..0..
8720: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8730: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
8740: 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  cor0.col1 + - co
8750: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
8760: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39  cor0..----..-109
8770: 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e  ..-67..-80....on
8780: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
8790: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
87a0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
87b0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
87c0: 6f 72 74 20 6c 61 62 65 6c 2d 32 34 31 0d 0a 53  ort label-241..S
87d0: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 44  ELECT + + col0 D
87e0: 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  IV + col1 FROM t
87f0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8800: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
8810: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
8820: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
8830: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8840: 65 6c 2d 32 34 31 0d 0a 53 45 4c 45 43 54 20 2b  el-241..SELECT +
8850: 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31   + col0 / + col1
8860: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
8870: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
8880: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
8890: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
88a0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
88b0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
88c0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
88d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
88e0: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b  ELECT - col1 * +
88f0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63   col1 * col0 + c
8900: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol2 * - col0 col
8910: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
8920: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 32  or0..----..-1782
8930: 39 36 0d 0a 2d 33 32 39 33 35 30 0d 0a 2d 37 34  96..-329350..-74
8940: 34 33 30 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4307....onlyif m
8950: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
8960: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
8970: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
8980: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8990: 62 65 6c 2d 32 34 33 0d 0a 53 45 4c 45 43 54 20  bel-243..SELECT 
89a0: 2b 20 2b 20 33 39 20 2b 20 2d 20 63 6f 6c 32 20  + + 39 + - col2 
89b0: 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d 20 39  + - col0 DIV - 9
89c0: 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  6 FROM tab1 AS c
89d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a  or0..----..-15..
89e0: 2d 31 38 0d 0a 2d 35 37 0d 0a 0d 0a 73 6b 69 70  -18..-57....skip
89f0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
8a00: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
8a10: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
8a20: 2d 32 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  -243..SELECT + +
8a30: 20 33 39 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d   39 + - col2 + -
8a40: 20 63 6f 6c 30 20 2f 20 2d 20 39 36 20 46 52 4f   col0 / - 96 FRO
8a50: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
8a60: 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 31 38 0d 0a  ----..-15..-18..
8a70: 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -57....query I r
8a80: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
8a90: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d   col0 * col1 + -
8aa0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
8ab0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8ac0: 0a 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33 32 39  .----..1978..329
8ad0: 38 0d 0a 38 30 30 38 0d 0a 0d 0a 6f 6e 6c 79 69  8..8008....onlyi
8ae0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
8af0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
8b00: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
8b10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8b20: 20 6c 61 62 65 6c 2d 32 34 35 0d 0a 53 45 4c 45   label-245..SELE
8b30: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT - col0 * col2
8b40: 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   DIV - cor0.col1
8b50: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a   + col1 * col2 *
8b60: 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32   + col0 - - col2
8b70: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
8b80: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
8b90: 0d 0a 33 33 39 36 0d 0a 36 36 34 32 38 30 0d 0a  ..3396..664280..
8ba0: 36 38 31 35 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  68154....skipif 
8bb0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
8bc0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
8bd0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34  rowsort label-24
8be0: 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  5..SELECT - col0
8bf0: 20 2a 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 72 30   * col2 / - cor0
8c00: 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63  .col1 + col1 * c
8c10: 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2d  ol2 * + col0 - -
8c20: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
8c30: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8c40: 0a 2d 2d 2d 2d 0d 0a 33 33 39 36 0d 0a 36 36 34  .----..3396..664
8c50: 32 38 30 0d 0a 36 38 31 35 34 0d 0a 0d 0a 71 75  280..68154....qu
8c60: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8c70: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d  ELECT - col0 + -
8c80: 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
8c90: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
8ca0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  or0..----..-7..-
8cb0: 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69  78..-79....onlyi
8cc0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
8cd0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
8ce0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
8cf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8d00: 20 6c 61 62 65 6c 2d 32 34 37 0d 0a 53 45 4c 45   label-247..SELE
8d10: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 44 49  CT ALL - col0 DI
8d20: 56 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  V + col2 AS col1
8d30: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8d40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d  r0..----..-1..0.
8d50: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
8d60: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
8d70: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
8d80: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 37 0d 0a  sort label-247..
8d90: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
8da0: 30 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 / + col2 AS co
8db0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
8dc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
8dd0: 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
8de0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8df0: 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ALL - col0 * col
8e00: 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  1 + col0 * + col
8e10: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
8e20: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8e30: 2d 0d 0a 2d 31 36 38 0d 0a 31 34 38 32 0d 0a 34  -..-168..1482..4
8e40: 38 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  898....query I r
8e50: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
8e60: 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 41 53 20   col0 - col2 AS 
8e70: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
8e80: 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31 37  ----..-104..-117
8e90: 0d 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-34....query I
8ea0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8eb0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
8ec0: 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 41   - col2 - col0 A
8ed0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
8ee0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d  ..----..-7..-78.
8ef0: 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-79....query I 
8f00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8f10: 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d 20  + tab2.col1 * - 
8f20: 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  col1 * col1 + + 
8f30: 63 6f 6c 30 20 2b 20 2b 20 74 61 62 32 2e 63 6f  col0 + + tab2.co
8f40: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
8f50: 2d 2d 0d 0a 2d 32 30 35 32 32 33 0d 0a 2d 32 39  --..-205223..-29
8f60: 37 37 37 0d 0a 2d 34 37 35 35 0d 0a 0d 0a 6f 6e  777..-4755....on
8f70: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
8f80: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
8f90: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
8fa0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
8fb0: 6f 72 74 20 6c 61 62 65 6c 2d 32 35 32 0d 0a 53  ort label-252..S
8fc0: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  ELECT - col1 * -
8fd0: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a   col2 + - col2 *
8fe0: 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 44 49 56   col0 - col2 DIV
8ff0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
9000: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
9010: 36 33 0d 0a 32 30 34 35 0d 0a 36 31 0d 0a 0d 0a  63..2045..61....
9020: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
9030: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
9040: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
9050: 61 62 65 6c 2d 32 35 32 0d 0a 53 45 4c 45 43 54  abel-252..SELECT
9060: 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   - col1 * - col2
9070: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   + - col2 * col0
9080: 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 46   - col2 / col2 F
9090: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
90a0: 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 0d 0a 32 30 34  ..----..163..204
90b0: 35 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  5..61....query I
90c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
90d0: 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   ALL + col1 * co
90e0: 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 2b 20  l2 * - col0 - + 
90f0: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
9100: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab0..----..-3
9110: 33 39 36 0d 0a 2d 36 36 34 32 30 30 0d 0a 2d 36  396..-664200..-6
9120: 38 31 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8145....query I 
9130: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9140: 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
9150: 6c 32 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 32  l2 * col1 - col2
9160: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
9170: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 33 30 0d 0a  r0..----..1430..
9180: 35 32 39 0d 0a 38 30 33 0d 0a 0d 0a 71 75 65 72  529..803....quer
9190: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
91a0: 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  ECT + col0 + + c
91b0: 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  or0.col0 - - col
91c0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
91d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32  or0..----..21..2
91e0: 33 34 0d 0a 32 33 37 0d 0a 0d 0a 71 75 65 72 79  34..237....query
91f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9200: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
9210: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
9220: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
9230: 2d 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39  -..7396..8281..9
9240: 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
9250: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
9260: 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 2a   col2 - - col2 *
9270: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
9280: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9290: 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34  .----..2871..754
92a0: 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  4..98....query I
92b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
92c0: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   - col0 + + col2
92d0: 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30   * - col0 * cor0
92e0: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
92f0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9300: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 30 0d 0a 2d 31  .----..-1260..-1
9310: 39 30 33 32 0d 0a 2d 36 34 39 36 31 31 0d 0a 0d  9032..-649611...
9320: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9330: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 39 37 20  ..SELECT - + 97 
9340: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  * - cor0.col1 * 
9350: 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  + col2 + cor0.co
9360: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
9370: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 38  cor0..----..1488
9380: 37 36 0d 0a 36 32 37 34 31 0d 0a 38 31 31 39 36  76..62741..81196
9390: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
93a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 37  ort..SELECT - 27
93b0: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a   + col2 * col0 *
93c0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
93d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
93e0: 33 36 38 0d 0a 36 36 34 30 39 31 0d 0a 36 38 30  368..664091..680
93f0: 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  85....onlyif mys
9400: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
9410: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
9420: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
9430: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9440: 6c 2d 32 36 31 0d 0a 53 45 4c 45 43 54 20 63 6f  l-261..SELECT co
9450: 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53  l1 DIV + col0 AS
9460: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
9470: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
9480: 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..4....skipif my
9490: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
94a0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
94b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 31 0d  wsort label-261.
94c0: 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 2b  .SELECT col1 / +
94d0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
94e0: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
94f0: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 6f  --..0..0..4....o
9500: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
9510: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
9520: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
9530: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
9540: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 32 0d 0a  sort label-262..
9550: 53 45 4c 45 43 54 20 2d 20 39 38 20 2b 20 2b 20  SELECT - 98 + + 
9560: 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2d 20  cor0.col0 DIV - 
9570: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53  col2 + - col1 AS
9580: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
9590: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
95a0: 31 38 34 0d 0a 2d 31 39 30 0d 0a 2d 32 33 30 0d  184..-190..-230.
95b0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
95c0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
95d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
95e0: 74 20 6c 61 62 65 6c 2d 32 36 32 0d 0a 53 45 4c  t label-262..SEL
95f0: 45 43 54 20 2d 20 39 38 20 2b 20 2b 20 63 6f 72  ECT - 98 + + cor
9600: 30 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 32 20  0.col0 / - col2 
9610: 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + - col1 AS col1
9620: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
9630: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 34 0d 0a  r0..----..-184..
9640: 2d 31 39 30 0d 0a 2d 32 33 30 0d 0a 0d 0a 71 75  -190..-230....qu
9650: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9660: 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a  ELECT - - col2 *
9670: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
9680: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
9690: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 36  cor0..----..2916
96a0: 0d 0a 33 32 34 39 0d 0a 39 32 31 36 0d 0a 0d 0a  ..3249..9216....
96b0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
96c0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
96d0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
96e0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
96f0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 34 0d  wsort label-264.
9700: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 44 49 56  .SELECT col0 DIV
9710: 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
9720: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9730: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
9740: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9750: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9760: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9770: 62 65 6c 2d 32 36 34 0d 0a 53 45 4c 45 43 54 20  bel-264..SELECT 
9780: 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c 31  col0 / cor0.col1
9790: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
97a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
97b0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  0....query III r
97c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
97d0: 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
97e0: 20 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 42 45   NOT NULL NOT BE
97f0: 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 28  TWEEN NULL AND (
9800: 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d   - col2 )..----.
9810: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9820: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
9830: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57 48  ol0 FROM tab2 WH
9840: 45 52 45 20 28 20 2d 20 63 6f 6c 31 20 29 20 3e  ERE ( - col1 ) >
9850: 3d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 0d  = + col0 * col0.
9860: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
9870: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9880: 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2b   - tab0.col1 + +
9890: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
98a0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
98b0: 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 31 30 30 33 0d  ----..-96..1003.
98c0: 0a 36 36 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .6633....query I
98d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
98e0: 20 41 4c 4c 20 28 20 63 6f 6c 32 20 29 20 2b 20   ALL ( col2 ) + 
98f0: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  - cor0.col2 AS c
9900: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
9910: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
9920: 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  0..0....skipif p
9930: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
9940: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
9950: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
9960: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
9970: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9980: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
9990: 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 63 6f 6c  ol2 - - col2 col
99a0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
99b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a  or0..----..108..
99c0: 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65 72  114..192....quer
99d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
99e0: 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30  ECT ALL - - col0
99f0: 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 39 32 20 2b   * - col0 * 92 +
9a00: 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46   - col1 + col0 F
9a10: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
9a20: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 33 32 0d 0a 2d  ..----..-4532..-
9a30: 35 35 39 37 30 39 0d 0a 2d 35 37 34 31 31 30 0d  559709..-574110.
9a40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9a50: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 38 20  rt..SELECT - 18 
9a60: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
9a70: 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 31 38 0d 0a  ----..-18..-18..
9a80: 2d 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -18....skipif po
9a90: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
9aa0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
9ab0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
9ac0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
9ad0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9ae0: 0a 53 45 4c 45 43 54 20 2d 20 33 34 20 63 6f 6c  .SELECT - 34 col
9af0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
9b00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a  or0..----..-34..
9b10: 2d 33 34 0d 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72  -34..-34....quer
9b20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9b30: 45 43 54 20 41 4c 4c 20 2b 20 38 33 20 46 52 4f  ECT ALL + 83 FRO
9b40: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
9b50: 2d 0d 0a 38 33 0d 0a 38 33 0d 0a 38 33 0d 0a 0d  -..83..83..83...
9b60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9b70: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
9b80: 20 28 20 63 6f 6c 32 20 29 20 2a 20 63 6f 72 30   ( col2 ) * cor0
9b90: 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 41  .col1 + + col1 A
9ba0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
9bb0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9bc0: 31 35 39 33 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a  1593..663..868..
9bd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9be0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
9bf0: 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20 63  col0 - col1 AS c
9c00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
9c10: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d  r0..----..-29..-
9c20: 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79  74..-93....query
9c30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9c40: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 20  CT DISTINCT - 6 
9c50: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  + cor0.col1 + co
9c60: 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
9c70: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
9c80: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 36 38 0d  0..----..23..68.
9c90: 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .87....query I r
9ca0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
9cb0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol1 FROM tab0 WH
9cc0: 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 42 45 54  ERE NULL NOT BET
9cd0: 57 45 45 4e 20 2b 20 63 6f 6c 32 20 2b 20 74 61  WEEN + col2 + ta
9ce0: 62 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31  b0.col1 * - col1
9cf0: 20 2b 20 63 6f 6c 30 20 41 4e 44 20 63 6f 6c 32   + col0 AND col2
9d00: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
9d10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9d20: 54 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20  T - tab0.col2 + 
9d30: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53  + col1 + col1 AS
9d40: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
9d50: 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 33 39 0d  .----..100..139.
9d60: 0a 31 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .193....query I 
9d70: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9d80: 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63  col0 / col1 AS c
9d90: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 57 48  ol1 FROM tab2 WH
9da0: 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54  ERE NOT NULL NOT
9db0: 20 49 4e 20 28 20 63 6f 6c 30 20 29 0d 0a 2d 2d   IN ( col0 )..--
9dc0: 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
9dd0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
9de0: 53 54 49 4e 43 54 20 63 6f 6c 30 20 46 52 4f 4d  STINCT col0 FROM
9df0: 20 74 61 62 31 20 57 48 45 52 45 20 2b 20 63 6f   tab1 WHERE + co
9e00: 6c 31 20 3c 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d  l1 < NULL..----.
9e10: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
9e20: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
9e30: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
9e40: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
9e50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
9e60: 38 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  81..SELECT ALL -
9e70: 20 74 61 62 30 2e 63 6f 6c 32 20 44 49 56 20 63   tab0.col2 DIV c
9e80: 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 - col0 FROM 
9e90: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d  tab0..----..-25.
9ea0: 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69  .-35..-89....ski
9eb0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
9ec0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
9ed0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9ee0: 6c 2d 32 38 31 0d 0a 53 45 4c 45 43 54 20 41 4c  l-281..SELECT AL
9ef0: 4c 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2f 20  L - tab0.col2 / 
9f00: 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  col0 - col0 FROM
9f10: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   tab0..----..-25
9f20: 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75  ..-35..-89....qu
9f30: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9f40: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 41  ELECT ALL col1 A
9f50: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
9f60: 20 57 48 45 52 45 20 4e 4f 54 20 28 20 63 6f 6c   WHERE NOT ( col
9f70: 30 20 29 20 3c 3d 20 74 61 62 31 2e 63 6f 6c 30  0 ) <= tab1.col0
9f80: 20 2a 20 2d 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d   * - col1..----.
9f90: 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 6f  .10..13..26....o
9fa0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
9fb0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
9fc0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
9fd0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
9fe0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 33 0d 0a  sort label-283..
9ff0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
a000: 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 32 20  col0 DIV + col2 
a010: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a020: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a030: 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..1....skipif 
a040: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
a050: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
a060: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38  rowsort label-28
a070: 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
a080: 43 54 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32  CT col0 / + col2
a090: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
a0a0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
a0b0: 0d 0a 30 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..0..1....onlyif
a0c0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
a0d0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
a0e0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
a0f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
a100: 6c 61 62 65 6c 2d 32 38 34 0d 0a 53 45 4c 45 43  label-284..SELEC
a110: 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44 49  T col0 + col1 DI
a120: 56 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20  V cor0.col0 - + 
a130: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
a140: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
a150: 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d  ----..1..2..3...
a160: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
a170: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
a180: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
a190: 6c 61 62 65 6c 2d 32 38 34 0d 0a 53 45 4c 45 43  label-284..SELEC
a1a0: 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2f 20  T col0 + col1 / 
a1b0: 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f  cor0.col0 - + co
a1c0: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
a1d0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
a1e0: 2d 2d 0d 0a 31 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71  --..1..2..3....q
a1f0: 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
a200: 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
a210: 74 61 62 30 20 41 53 20 63 6f 72 30 20 57 48 45  tab0 AS cor0 WHE
a220: 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 32 20 3d 20  RE NOT + col2 = 
a230: 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( NULL )..----..
a240: 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
a250: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
a260: 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  INCT * FROM tab1
a270: 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 28   AS cor0 WHERE (
a280: 20 2b 20 63 6f 6c 30 20 29 20 3d 20 28 20 63 6f   + col0 ) = ( co
a290: 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l2 )..----....qu
a2a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a2b0: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d  ELECT + col2 + -
a2c0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f   col1 * col1 FRO
a2d0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
a2e0: 2d 0d 0a 2d 34 33 0d 0a 2d 36 32 32 0d 0a 2d 37  -..-43..-622..-7
a2f0: 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
a300: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
a310: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
a320: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
a330: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
a340: 2d 32 38 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -288..SELECT ALL
a350: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   + col2 * cor0.c
a360: 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 41  ol2 DIV + col2 A
a370: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
a380: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a390: 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69  1..33..82....ski
a3a0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
a3b0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
a3c0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a3d0: 6c 2d 32 38 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-288..SELECT AL
a3e0: 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  L + col2 * cor0.
a3f0: 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 41 53  col2 / + col2 AS
a400: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
a410: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
a420: 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e 6c 79  ..33..82....only
a430: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
a440: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
a450: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
a460: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a470: 74 20 6c 61 62 65 6c 2d 32 38 39 0d 0a 53 45 4c  t label-289..SEL
a480: 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20 63  ECT - col1 DIV c
a490: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
a4a0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
a4b0: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
a4c0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
a4d0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
a4e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a4f0: 6c 2d 32 38 39 0d 0a 53 45 4c 45 43 54 20 2d 20  l-289..SELECT - 
a500: 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41 53 20 63  col1 / col2 AS c
a510: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
a520: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
a530: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
a540: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
a550: 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b   - tab0.col2 + +
a560: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46   col0 + - col0 F
a570: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
a580: 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a  -1..-33..-82....
a590: 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
a5a0: 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
a5b0: 20 74 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c   tab1 WHERE NULL
a5c0: 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 30 20 2b   NOT IN ( col0 +
a5d0: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 29   col0 * + col1 )
a5e0: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
a5f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a600: 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  T - col1 * col2 
a610: 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  + + col2 AS col1
a620: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
a630: 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a 2d  ..-1508..-608..-
a640: 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  810....query I r
a650: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
a660: 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  LL + col2 * + co
a670: 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 + + col2 FROM
a680: 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20   tab2 WHERE NOT 
a690: 4e 55 4c 4c 20 49 4e 20 28 20 63 6f 6c 30 20 2a  NULL IN ( col0 *
a6a0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 0d 0a   col0 * col1 )..
a6b0: 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
a6c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a6d0: 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  ALL col1 * + col
a6e0: 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 + col1 FROM ta
a6f0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a  b2..----..1360..
a700: 32 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 73 6b 69  248..4661....ski
a710: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
a720: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
a730: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
a740: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
a750: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
a760: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
a770: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 63 6f 6c 31  col0 + col0 col1
a780: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
a790: 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d  ..178..48..70...
a7a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a7b0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
a7c0: 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  - - col0 AS col1
a7d0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
a7e0: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
a7f0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
a800: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
a810: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
a820: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
a830: 72 74 20 6c 61 62 65 6c 2d 32 39 37 0d 0a 53 45  rt label-297..SE
a840: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
a850: 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 30 20  col0 DIV - col0 
a860: 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + + col2 FROM ta
a870: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36  b1..----..53..56
a880: 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..95....skipif m
a890: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
a8a0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
a8b0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39 37  owsort label-297
a8c0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
a8d0: 54 20 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c  T + col0 / - col
a8e0: 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + + col2 FROM 
a8f0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  tab1..----..53..
a900: 35 36 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20  56..95....query 
a910: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a920: 54 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  T + col0 - col2 
a930: 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
a940: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33  b0..----..70..73
a950: 38 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79  87..816....query
a960: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a970: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
a980: 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   * + col2 + col0
a990: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
a9a0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 33 0d 0a  b2..----..1523..
a9b0: 37 33 36 0d 0a 37 35 34 0d 0a 0d 0a 71 75 65 72  736..754....quer
a9c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a9d0: 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  ECT - col0 + - c
a9e0: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
a9f0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
aa00: 0d 0a 2d 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d 36  ..-128..-160..-6
aa10: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
aa20: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
aa30: 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
aa40: 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 2d 20  NULL NOT IN ( - 
aa50: 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31  tab0.col2 * col1
aa60: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 29   - col1 * col2 )
aa70: 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
aa80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
aa90: 54 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 31 2e  T - col0 * tab1.
aaa0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
aab0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
aac0: 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a  040..-640..-78..
aad0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
aae0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
aaf0: 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2b  CT - tab2.col2 +
ab00: 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f   - tab2.col2 FRO
ab10: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab2..----..-5
ab20: 32 0d 0a 2d 35 34 0d 0a 2d 37 36 0d 0a 0d 0a 71  2..-54..-76....q
ab30: 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
ab40: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
ab50: 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48  T * FROM tab0 WH
ab60: 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 32 20 2a  ERE NOT + col2 *
ab70: 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 4e   - col0 + col0 N
ab80: 4f 54 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20  OT BETWEEN NULL 
ab90: 41 4e 44 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a  AND col2..----..
aba0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
abb0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
abc0: 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   * + col1 + - co
abd0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
abe0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36 33  tab0..----..7363
abf0: 0d 0a 38 31 39 39 0d 0a 39 34 30 38 0d 0a 0d 0a  ..8199..9408....
ac00: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
ac10: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
ac20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ac30: 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20  SELECT - CAST ( 
ac40: 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
ac50: 29 20 2a 20 63 6f 6c 30 20 2a 20 43 41 53 54 20  ) * col0 * CAST 
ac60: 28 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29  ( col0 AS REAL )
ac70: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
ac80: 0d 0a 2d 31 32 32 35 0d 0a 2d 31 39 30 30 38 0d  ..-1225..-19008.
ac90: 0a 2d 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72  .-649522....quer
aca0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
acb0: 45 43 54 20 32 34 20 2a 20 2d 20 63 6f 6c 30 20  ECT 24 * - col0 
acc0: 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2d  * + col1 + - ( -
acd0: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 29 20 46   col2 * col0 ) F
ace0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
acf0: 2d 31 38 37 30 37 38 0d 0a 2d 34 38 37 34 34 0d  -187078..-48744.
ad00: 0a 2d 38 31 34 34 35 0d 0a 0d 0a 71 75 65 72 79  .-81445....query
ad10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
ad20: 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20  CT DISTINCT ( - 
ad30: 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 32 20  col1 ) * + col2 
ad40: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
ad50: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
ad60: 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
ad70: 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
ad80: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
ad90: 4c 4c 20 2b 20 31 20 2b 20 2d 20 63 6f 6c 30 20  LL + 1 + - col0 
ada0: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  * - cor0.col2 AS
adb0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
adc0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
add0: 36 0d 0a 37 32 39 39 0d 0a 37 39 33 0d 0a 0d 0a  6..7299..793....
ade0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
adf0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
ae00: 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col1 * cor0.col0
ae10: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
ae20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a  r0..----..1343..
ae30: 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65  217..4602....que
ae40: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ae50: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  LECT - col1 + co
ae60: 6c 32 20 2a 20 2b 20 28 20 2b 20 28 20 63 6f 6c  l2 * + ( + ( col
ae70: 31 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32 20  1 ) ) FROM tab2 
ae80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
ae90: 34 37 35 0d 0a 36 32 39 0d 0a 38 30 36 0d 0a 0d  475..629..806...
aea0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
aeb0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 38 39 20  ..SELECT + - 89 
aec0: 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  * cor0.col0 * + 
aed0: 31 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  18 AS col2 FROM 
aee0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
aef0: 2d 2d 0d 0a 2d 31 34 32 35 37 38 0d 0a 2d 33 38  --..-142578..-38
af00: 34 34 38 0d 0a 2d 35 36 30 37 30 0d 0a 0d 0a 71  448..-56070....q
af10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
af20: 53 45 4c 45 43 54 20 2b 20 2d 20 33 39 20 41 53  SELECT + - 39 AS
af30: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
af40: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
af50: 33 39 0d 0a 2d 33 39 0d 0a 2d 33 39 0d 0a 0d 0a  39..-39..-39....
af60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
af70: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
af80: 6f 6c 32 20 2a 20 28 20 32 38 20 29 20 2b 20 2b  ol2 * ( 28 ) + +
af90: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20   col0 * col0 AS 
afa0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
afb0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
afc0: 35 30 33 0d 0a 32 35 30 30 0d 0a 33 37 31 32 0d  503..2500..3712.
afd0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
afe0: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
aff0: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
b000: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
b010: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
b020: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 35 0d  wsort label-315.
b030: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
b040: 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53   + CAST( col0 AS
b050: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
b060: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a  ab0..----..110..
b070: 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 73 6b 69 70  132..180....skip
b080: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
b090: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
b0a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b0b0: 2d 33 31 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -315..SELECT ALL
b0c0: 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 63   col1 + CAST ( c
b0d0: 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
b0e0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
b0f0: 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d  ..110..132..180.
b100: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b110: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
b120: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a   col2 + + col0 *
b130: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
b140: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 35 38 33  1..----..24..583
b150: 0d 0a 39 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..944....query I
b160: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b170: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
b180: 20 2b 20 2d 20 33 37 20 2a 20 74 61 62 32 2e 63   + - 37 * tab2.c
b190: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
b1a0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39   tab2..----..-29
b1b0: 30 0d 0a 2d 32 39 34 30 0d 0a 2d 32 39 34 35 0d  0..-2940..-2945.
b1c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b1d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
b1e0: 20 63 6f 6c 31 20 2b 20 28 20 37 36 20 29 20 46   col1 + ( 76 ) F
b1f0: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
b200: 2d 2d 2d 0d 0a 35 30 0d 0a 36 33 0d 0a 36 36 0d  ---..50..63..66.
b210: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b220: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
b230: 20 63 6f 6c 30 20 2a 20 35 33 20 46 52 4f 4d 20   col0 * 53 FROM 
b240: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
b250: 0a 2d 31 32 37 32 0d 0a 2d 31 38 35 35 0d 0a 2d  .-1272..-1855..-
b260: 34 37 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4717....query I 
b270: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b280: 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72  + + col1 * - cor
b290: 30 2e 63 6f 6c 32 20 2b 20 2b 20 37 38 20 46 52  0.col2 + + 78 FR
b2a0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
b2b0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35 36 0d 0a 2d 35  .----..-1456..-5
b2c0: 36 38 0d 0a 2d 37 35 39 0d 0a 0d 0a 71 75 65 72  68..-759....quer
b2d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b2e0: 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT - cor0.col1 
b2f0: 2a 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  * ( + cor0.col2 
b300: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
b310: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38  or0..----..-1248
b320: 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d  ..-1404..-570...
b330: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b340: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
b350: 6f 6c 32 20 2b 20 2b 20 31 36 20 41 53 20 63 6f  ol2 + + 16 AS co
b360: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
b370: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  cor0..----..-17.
b380: 0a 2d 36 36 0d 0a 31 35 0d 0a 0d 0a 73 6b 69 70  .-66..15....skip
b390: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
b3a0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
b3b0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
b3c0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
b3d0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
b3e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
b3f0: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63   + col0 + cor0.c
b400: 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
b410: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
b420: 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d  ..171..36..57...
b430: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b440: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
b450: 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  T - col2 + - cor
b460: 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
b470: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
b480: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 0d 0a 2d 36  ..----..-109..-6
b490: 37 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20  7..-80....query 
b4a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b4b0: 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c  T ALL col0 * col
b4c0: 31 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  1 - col0 * col1 
b4d0: 2a 20 2b 20 28 20 63 6f 6c 31 20 2b 20 2d 20 63  * + ( col1 + - c
b4e0: 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol1 ) AS col1 FR
b4f0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
b500: 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37  .----..1343..217
b510: 0d 0a 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  ..4602....query 
b520: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b530: 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  T cor0.col1 + + 
b540: 28 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e  ( col2 * - cor0.
b550: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46  col1 ) AS col2 F
b560: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
b570: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d  ..----..-2752..-
b580: 37 33 37 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  7371..0....query
b590: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b5a0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
b5b0: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col2 * col1 + co
b5c0: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
b5d0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
b5e0: 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38  --..1560..684..8
b5f0: 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  64....skipif pos
b600: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
b610: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
b620: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
b630: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
b640: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
b650: 53 45 4c 45 43 54 20 2b 20 28 20 33 30 20 29 20  SELECT + ( 30 ) 
b660: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 31  + cor0.col0 col1
b670: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
b680: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 33  r0..----..110..3
b690: 33 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  3..94....query I
b6a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b6b0: 20 44 49 53 54 49 4e 43 54 20 38 34 20 2a 20 2b   DISTINCT 84 * +
b6c0: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 46   col0 + - col2 F
b6d0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
b6e0: 0d 0a 2d 2d 2d 2d 0d 0a 35 36 31 0d 0a 36 35 32  ..----..561..652
b6f0: 36 0d 0a 36 35 39 38 0d 0a 0d 0a 71 75 65 72 79  6..6598....query
b700: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
b710: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31 36  CT DISTINCT + 16
b720: 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
b730: 6c 30 20 2a 20 2b 20 28 20 28 20 63 6f 6c 30 20  l0 * + ( ( col0 
b740: 29 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f  ) ) + - col0 FRO
b750: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
b760: 2d 2d 2d 2d 0d 0a 31 39 32 38 0d 0a 32 37 34 32  ----..1928..2742
b770: 0d 0a 39 32 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..9288....onlyif
b780: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
b790: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
b7a0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
b7b0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
b7c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b7d0: 65 6c 2d 33 33 31 0d 0a 53 45 4c 45 43 54 20 2d  el-331..SELECT -
b7e0: 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
b7f0: 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30   SIGNED ) + col0
b800: 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
b810: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
b820: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
b830: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
b840: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
b850: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
b860: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
b870: 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43  31..SELECT - + C
b880: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
b890: 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 2a  TEGER ) + col0 *
b8a0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
b8b0: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
b8c0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
b8d0: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
b8e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b8f0: 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20  - col1 * col2 * 
b900: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
b910: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
b920: 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d  ----..-119652..-
b930: 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a  51034..-5859....
b940: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b950: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
b960: 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 38 37 20 2b   - col0 + - 87 +
b970: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
b980: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
b990: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 0d 0a 2d  0..----..-125..-
b9a0: 31 38 33 0d 0a 2d 32 32 34 0d 0a 0d 0a 6f 6e 6c  183..-224....onl
b9b0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
b9c0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
b9d0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
b9e0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
b9f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ba00: 6c 61 62 65 6c 2d 33 33 34 0d 0a 53 45 4c 45 43  label-334..SELEC
ba10: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
ba20: 54 28 20 2d 20 39 39 20 41 53 20 53 49 47 4e 45  T( - 99 AS SIGNE
ba30: 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  D ) FROM tab2 AS
ba40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 39 0d   cor0..----..99.
ba50: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
ba60: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
ba70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ba80: 74 20 6c 61 62 65 6c 2d 33 33 34 0d 0a 53 45 4c  t label-334..SEL
ba90: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43  ECT DISTINCT - C
baa0: 41 53 54 20 28 20 2d 20 39 39 20 41 53 20 49 4e  AST ( - 99 AS IN
bab0: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
bac0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
bad0: 0a 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .99....query I r
bae0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
baf0: 20 36 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b   60 + + col1 * +
bb00: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
bb10: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
bb20: 0a 2d 2d 2d 2d 0d 0a 37 33 33 36 0d 0a 38 32 32  .----..7336..822
bb30: 31 0d 0a 39 33 34 39 0d 0a 0d 0a 71 75 65 72 79  1..9349....query
bb40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
bb50: 43 54 20 41 4c 4c 20 33 35 20 2b 20 2b 20 63 6f  CT ALL 35 + + co
bb60: 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46  r0.col1 * col1 F
bb70: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
bb80: 0d 0a 2d 2d 2d 2d 0d 0a 33 32 34 0d 0a 33 35 31  ..----..324..351
bb90: 36 0d 0a 39 39 36 0d 0a 0d 0a 71 75 65 72 79 20  6..996....query 
bba0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
bbb0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 32 20  T DISTINCT + 62 
bbc0: 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  * + col0 + col2 
bbd0: 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  * - cor0.col0 FR
bbe0: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
bbf0: 2d 2d 0d 0a 2d 31 37 38 30 0d 0a 32 31 33 35 0d  --..-1780..2135.
bc00: 0a 36 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .696....query I 
bc10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
bc20: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  + + cor0.col0 * 
bc30: 2b 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  + ( col2 ) FROM 
bc40: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
bc50: 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33  --..189..2028..3
bc60: 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
bc70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
bc80: 6f 6c 32 20 2b 20 28 20 32 33 20 29 20 2a 20 2b  ol2 + ( 23 ) * +
bc90: 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63   col1 * + tab0.c
bca0: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
bcb0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 36   tab0..----..186
bcc0: 33 35 39 0d 0a 34 37 35 30 35 0d 0a 37 38 30 38  359..47505..7808
bcd0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
bce0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
bcf0: 30 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  0 * col2 * col1 
bd00: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
bd10: 0a 31 31 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a  .119652..51034..
bd20: 35 38 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  5859....onlyif m
bd30: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
bd40: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
bd50: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
bd60: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
bd70: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
bd80: 2d 33 34 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -341..SELECT - +
bd90: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
bda0: 49 47 4e 45 44 20 29 20 2a 20 63 6f 72 30 2e 63  IGNED ) * cor0.c
bdb0: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol0 + - col2 FRO
bdc0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
bdd0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
bde0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
bdf0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
be00: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
be10: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
be20: 34 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 43  41..SELECT - + C
be30: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
be40: 54 45 47 45 52 20 29 20 2a 20 63 6f 72 30 2e 63  TEGER ) * cor0.c
be50: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol0 + - col2 FRO
be60: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
be70: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
be80: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
be90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
bea0: 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  T + col1 - col0 
beb0: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
bec0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
bed0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31  ..----..-158..-1
bee0: 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75  969..-2985....qu
bef0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
bf00: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
bf10: 20 2b 20 38 34 20 2d 20 2b 20 63 6f 6c 32 20 41   + 84 - + col2 A
bf20: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
bf30: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
bf40: 2d 32 35 0d 0a 31 37 0d 0a 34 0d 0a 0d 0a 71 75  -25..17..4....qu
bf50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
bf60: 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 29 20 2b  ELECT ( col1 ) +
bf70: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
bf80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
bf90: 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71 75  09..67..80....qu
bfa0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
bfb0: 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 74  ELECT col0 * - t
bfc0: 61 62 32 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  ab2.col1 + col2 
bfd0: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
bfe0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 32 36 0d 0a 31  ..----..-3926..1
bff0: 30 31 0d 0a 35 31 32 0d 0a 0d 0a 71 75 65 72 79  01..512....query
c000: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c010: 43 54 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63  CT ( col2 ) AS c
c020: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
c030: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37  r0..----..54..57
c040: 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
c050: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c060: 41 4c 4c 20 2b 20 28 20 28 20 2b 20 63 6f 6c 30  ALL + ( ( + col0
c070: 20 29 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 30   ) + + tab2.col0
c080: 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   ) FROM tab2..--
c090: 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35 38  --..14..156..158
c0a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c0b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
c0c0: 2d 20 32 35 20 46 52 4f 4d 20 74 61 62 31 0d 0a  - 25 FROM tab1..
c0d0: 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 32 35 0d 0a  ----..-25..-25..
c0e0: 2d 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -25....query I r
c0f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
c100: 49 53 54 49 4e 43 54 20 2d 20 36 39 20 41 53 20  ISTINCT - 69 AS 
c110: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
c120: 2d 2d 2d 2d 0d 0a 2d 36 39 0d 0a 0d 0a 6f 6e 6c  ----..-69....onl
c130: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
c140: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
c150: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
c160: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
c170: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
c180: 6c 61 62 65 6c 2d 33 35 30 0d 0a 53 45 4c 45 43  label-350..SELEC
c190: 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20 35 37  T ALL - CAST( 57
c1a0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
c1b0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab1..----..-5
c1c0: 37 0d 0a 2d 35 37 0d 0a 2d 35 37 0d 0a 0d 0a 73  7..-57..-57....s
c1d0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
c1e0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
c1f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
c200: 62 65 6c 2d 33 35 30 0d 0a 53 45 4c 45 43 54 20  bel-350..SELECT 
c210: 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 35 37 20  ALL - CAST ( 57 
c220: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
c230: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  M tab1..----..-5
c240: 37 0d 0a 2d 35 37 0d 0a 2d 35 37 0d 0a 0d 0a 71  7..-57..-57....q
c250: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c260: 53 45 4c 45 43 54 20 35 20 2a 20 2b 20 63 6f 6c  SELECT 5 * + col
c270: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
c280: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a  ab1..----..130..
c290: 35 30 0d 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20  50..65....query 
c2a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c2b0: 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20  T ALL cor0.col0 
c2c0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
c2d0: 32 2c 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f  2, tab0, tab1 co
c2e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
c2f0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
c300: 37 38 62 35 30 35 37 35 61 39 62 39 31 34 34 38  78b50575a9b91448
c310: 31 31 39 65 65 30 65 65 31 61 39 63 34 34 66 0d  119ee0ee1a9c44f.
c320: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c330: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 36 20  rt..SELECT - 16 
c340: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
c350: 32 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  2, tab0, tab0 AS
c360: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
c370: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
c380: 6f 20 37 31 63 38 62 30 38 39 36 34 61 62 34 37  o 71c8b08964ab47
c390: 63 65 31 32 31 35 38 39 37 35 63 30 65 65 31 66  ce12158975c0ee1f
c3a0: 64 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  d9....skipif pos
c3b0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
c3c0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
c3d0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
c3e0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
c3f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c400: 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f  SELECT col2 + co
c410: 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
c420: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37  1..----..121..17
c430: 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..57....query I
c440: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c450: 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f   ALL - col0 * co
c460: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
c470: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  tab2..----..-134
c480: 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a  3..-217..-4602..
c490: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c4a0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 39 20 2b  t..SELECT + 69 +
c4b0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
c4c0: 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31 34 39 0d  .----..133..149.
c4d0: 0a 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .72....query I r
c4e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
c4f0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b  ISTINCT - col0 +
c500: 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53   + ( - col2 ) AS
c510: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
c520: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 31  .----..-104..-11
c530: 37 0d 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72 79 20  7..-34....query 
c540: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c550: 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 33 34 20  T + col0 + + 34 
c560: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
c570: 0a 31 31 34 0d 0a 33 37 0d 0a 39 38 0d 0a 0d 0a  .114..37..98....
c580: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c590: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
c5a0: 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 38 32 20 41   - col2 + + 82 A
c5b0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
c5c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c5d0: 30 0d 0a 34 39 0d 0a 38 31 0d 0a 0d 0a 71 75 65  0..49..81....que
c5e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c5f0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
c600: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32  cor0.col2 * col2
c610: 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
c620: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
c630: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 37 30  or0..----..-2970
c640: 0d 0a 2d 33 33 30 36 0d 0a 2d 39 33 31 32 0d 0a  ..-3306..-9312..
c650: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c660: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
c670: 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   * - col0 * - co
c680: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
c690: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33  cor0..----..-233
c6a0: 34 37 32 0d 0a 2d 34 38 36 0d 0a 2d 36 31 34 34  472..-486..-6144
c6b0: 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  00....skipif pos
c6c0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
c6d0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
c6e0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
c6f0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
c700: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c710: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
c720: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
c730: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
c740: 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..97....skipif 
c750: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
c760: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
c770: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
c780: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
c790: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c7a0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
c7b0: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  CT - cor0.col1 +
c7c0: 20 37 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   7 col1 FROM tab
c7d0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
c7e0: 0a 2d 31 39 0d 0a 2d 33 0d 0a 2d 36 0d 0a 0d 0a  .-19..-3..-6....
c7f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c800: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
c810: 20 2d 20 63 6f 6c 31 20 2a 20 36 35 20 2d 20 63   - col1 * 65 - c
c820: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
c830: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
c840: 31 36 0d 0a 2d 36 36 30 0d 0a 2d 38 35 38 0d 0a  16..-660..-858..
c850: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c860: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
c870: 20 2d 20 39 34 20 41 53 20 63 6f 6c 30 20 46 52   - 94 AS col0 FR
c880: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
c890: 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35 39 0d 0a  .----..-5..-59..
c8a0: 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -70....query I r
c8b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
c8c0: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 35 20 46 52   - col1 + + 5 FR
c8d0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
c8e0: 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 39 31 0d 0a  .----..102..91..
c8f0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
c900: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
c910: 4c 20 2d 20 63 6f 6c 32 20 2b 20 36 36 20 2d 20  L - col2 + 66 - 
c920: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
c930: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
c940: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 31 31 0d  ..----..-19..11.
c950: 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .8....query I ro
c960: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
c970: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
c980: 38 33 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  83 + col2 FROM t
c990: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
c9a0: 2d 0d 0a 31 30 34 0d 0a 35 30 0d 0a 37 39 0d 0a  -..104..50..79..
c9b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c9c0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
c9d0: 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
c9e0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
c9f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34  or0..----..-2064
ca00: 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a  ..-3395..-8099..
ca10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ca20: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 31 2e 63  t..SELECT cor1.c
ca30: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
ca40: 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
ca50: 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20  0 AS cor1, tab1 
ca60: 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
ca70: 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
ca80: 20 74 6f 20 32 33 30 34 66 63 63 31 34 30 65 39   to 2304fcc140e9
ca90: 35 35 65 62 32 64 31 65 65 32 38 61 62 31 65 65  55eb2d1ee28ab1ee
caa0: 61 39 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  a994....onlyif m
cab0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
cac0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
cad0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
cae0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
caf0: 62 65 6c 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20  bel-371..SELECT 
cb00: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72  DISTINCT - - cor
cb10: 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20 38 31 20  0.col0 DIV + 81 
cb20: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
cb30: 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
cb40: 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
cb50: 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b  1..----..0....sk
cb60: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
cb70: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
cb80: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
cb90: 65 6c 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 44  el-371..SELECT D
cba0: 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30  ISTINCT - - cor0
cbb0: 2e 63 6f 6c 30 20 2f 20 2b 20 38 31 20 41 53 20  .col0 / + 81 AS 
cbc0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
cbd0: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
cbe0: 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
cbf0: 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  ----..0....query
cc00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
cc10: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
cc20: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col1 * + col0 AS
cc30: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
cc40: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
cc50: 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
cc60: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
cc70: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
cc80: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
cc90: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
cca0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
ccb0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ccc0: 45 43 54 20 2d 20 32 34 20 63 6f 6c 32 20 46 52  ECT - 24 col2 FR
ccd0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
cce0: 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 32 34 0d  .----..-24..-24.
ccf0: 0a 2d 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-24....query I 
cd00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
cd10: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
cd20: 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  ( col0 ) FROM ta
cd30: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
cd40: 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a  89..2028..3002..
cd50: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
cd60: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
cd70: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
cd80: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
cd90: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
cda0: 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  5..SELECT ALL - 
cdb0: 63 6f 6c 31 20 2a 20 34 34 20 2b 20 63 6f 6c 31  col1 * 44 + col1
cdc0: 20 2a 20 2d 20 31 32 20 2b 20 2d 20 63 6f 6c 32   * - 12 + - col2
cdd0: 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   DIV - col0 FROM
cde0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
cdf0: 2d 2d 2d 0d 0a 2d 34 38 31 35 0d 0a 2d 35 30 39  ---..-4815..-509
ce00: 36 0d 0a 2d 35 34 33 32 0d 0a 0d 0a 73 6b 69 70  6..-5432....skip
ce10: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
ce20: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
ce30: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ce40: 2d 33 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -375..SELECT ALL
ce50: 20 2d 20 63 6f 6c 31 20 2a 20 34 34 20 2b 20 63   - col1 * 44 + c
ce60: 6f 6c 31 20 2a 20 2d 20 31 32 20 2b 20 2d 20 63  ol1 * - 12 + - c
ce70: 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 / - col0 FRO
ce80: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
ce90: 2d 2d 2d 2d 0d 0a 2d 34 38 31 35 0d 0a 2d 35 30  ----..-4815..-50
cea0: 39 36 0d 0a 2d 35 34 33 32 0d 0a 0d 0a 71 75 65  96..-5432....que
ceb0: 72 79 20 49 49 49 49 49 49 49 49 49 20 72 6f 77  ry IIIIIIIII row
cec0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
ced0: 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
cee0: 30 2c 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  0, tab2, tab0 AS
cef0: 20 63 6f 72 30 20 57 48 45 52 45 20 4e 55 4c 4c   cor0 WHERE NULL
cf00: 20 3c 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d   < ( NULL )..---
cf10: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
cf20: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 32 20  sort..SELECT 92 
cf30: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
cf40: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
cf50: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
cf60: 68 61 73 68 69 6e 67 20 74 6f 20 35 31 36 66 61  hashing to 516fa
cf70: 34 35 63 38 62 30 36 66 39 66 36 37 64 36 65 35  45c8b06f9f67d6e5
cf80: 30 30 62 66 64 34 33 35 63 31 61 0d 0a 0d 0a 71  00bfd435c1a....q
cf90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cfa0: 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20  SELECT col2 + - 
cfb0: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col1 * + col2 AS
cfc0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
cfd0: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36  .----..-1508..-6
cfe0: 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75 65 72  08..-810....quer
cff0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d000: 45 43 54 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29  ECT + - ( col2 )
d010: 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
d020: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
d030: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a  or0..----..189..
d040: 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71 75  2028..3002....qu
d050: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d060: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 38 30  ELECT ALL - - 80
d070: 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
d080: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
d090: 2d 0d 0a 34 33 32 30 0d 0a 34 35 36 30 0d 0a 37  -..4320..4560..7
d0a0: 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
d0b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
d0c0: 20 34 34 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20   44 + cor0.col0 
d0d0: 2b 20 34 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 43 AS col2 FRO
d0e0: 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
d0f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
d100: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
d110: 37 65 34 30 65 36 33 65 31 64 39 36 38 66 35 37  7e40e63e1d968f57
d120: 34 33 39 63 63 30 30 37 34 63 34 32 62 37 35 65  439cc0074c42b75e
d130: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d140: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 20 2b 20  ort..SELECT 9 + 
d150: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
d160: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d170: 2d 35 35 0d 0a 2d 37 31 0d 0a 36 0d 0a 0d 0a 6f  -55..-71..6....o
d180: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
d190: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
d1a0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
d1b0: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
d1c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d1d0: 74 20 6c 61 62 65 6c 2d 33 38 33 0d 0a 53 45 4c  t label-383..SEL
d1e0: 45 43 54 20 2b 20 2d 20 31 30 20 2b 20 63 6f 6c  ECT + - 10 + col
d1f0: 32 20 2a 20 2d 20 43 41 53 54 28 20 2b 20 63 6f  2 * - CAST( + co
d200: 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l0 AS SIGNED ) A
d210: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
d220: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35   cor0..----..-45
d230: 0d 0a 2d 37 33 30 38 0d 0a 2d 38 30 32 0d 0a 0d  ..-7308..-802...
d240: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
d250: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
d260: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
d270: 6c 61 62 65 6c 2d 33 38 33 0d 0a 53 45 4c 45 43  label-383..SELEC
d280: 54 20 2b 20 2d 20 31 30 20 2b 20 63 6f 6c 32 20  T + - 10 + col2 
d290: 2a 20 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  * - CAST ( + col
d2a0: 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  0 AS INTEGER ) A
d2b0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
d2c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35   cor0..----..-45
d2d0: 0d 0a 2d 37 33 30 38 0d 0a 2d 38 30 32 0d 0a 0d  ..-7308..-802...
d2e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d2f0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
d300: 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  T + col2 * - cor
d310: 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
d320: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
d330: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d  ..----..-1248..-
d340: 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75  1404..-570....qu
d350: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d360: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
d370: 6f 6c 30 20 2b 20 2b 20 34 33 20 41 53 20 63 6f  ol0 + + 43 AS co
d380: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
d390: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 34 31  cor0..----..7341
d3a0: 0d 0a 37 38 0d 0a 38 33 35 0d 0a 0d 0a 71 75 65  ..78..835....que
d3b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d3c0: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
d3d0: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col2 * col0 FROM
d3e0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
d3f0: 0d 0a 2d 32 30 37 39 33 36 0d 0a 2d 37 33 37 32  ..-207936..-7372
d400: 38 30 0d 0a 2d 38 37 34 38 0d 0a 0d 0a 71 75 65  80..-8748....que
d410: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d420: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  LECT - col1 * + 
d430: 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 30 20  col0 * col1 + 0 
d440: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
d450: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
d460: 37 37 35 30 34 0d 0a 2d 33 32 39 33 31 35 0d 0a  77504..-329315..
d470: 2d 37 33 37 30 30 39 0d 0a 0d 0a 71 75 65 72 79  -737009....query
d480: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d490: 43 54 20 41 4c 4c 20 34 36 20 2a 20 35 30 20 41  CT ALL 46 * 50 A
d4a0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
d4b0: 0d 0a 2d 2d 2d 2d 0d 0a 32 33 30 30 0d 0a 32 33  ..----..2300..23
d4c0: 30 30 0d 0a 32 33 30 30 0d 0a 0d 0a 71 75 65 72  00..2300....quer
d4d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d4e0: 45 43 54 20 28 20 2b 20 74 61 62 30 2e 63 6f 6c  ECT ( + tab0.col
d4f0: 32 20 29 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c  2 ) * + tab0.col
d500: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
d510: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30  ab0..----..1..10
d520: 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 73 6b 69 70  89..6724....skip
d530: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
d540: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
d550: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
d560: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
d570: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
d580: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
d590: 30 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  0 + col0 col0 FR
d5a0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
d5b0: 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34 38 0d 0a  .----..178..48..
d5c0: 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  70....skipif pos
d5d0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
d5e0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
d5f0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
d600: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
d610: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d620: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
d630: 2b 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 31 20  + col2 + ( col1 
d640: 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  ) col0 FROM tab2
d650: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d660: 2d 31 34 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30  -1475..-629..-80
d670: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
d680: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39  sort..SELECT + 9
d690: 38 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  8 + + col1 AS co
d6a0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
d6b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d  cor0..----..108.
d6c0: 0a 31 31 31 0d 0a 31 32 34 0d 0a 0d 0a 71 75 65  .111..124....que
d6d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d6e0: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  LECT + col1 + + 
d6f0: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30  cor0.col0 * col0
d700: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
d710: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
d720: 0d 0a 36 31 34 33 0d 0a 36 32 35 38 0d 0a 38 30  ..6143..6258..80
d730: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
d740: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
d750: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
d760: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
d770: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d780: 33 39 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  394..SELECT DIST
d790: 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  INCT + col2 * - 
d7a0: 63 6f 6c 32 20 2b 20 2d 20 36 33 20 2a 20 35 38  col2 + - 63 * 58
d7b0: 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   DIV + col0 FROM
d7c0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab0..----..-10
d7d0: 35 0d 0a 2d 31 32 34 31 0d 0a 2d 36 37 36 35 0d  5..-1241..-6765.
d7e0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
d7f0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
d800: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d810: 74 20 6c 61 62 65 6c 2d 33 39 34 0d 0a 53 45 4c  t label-394..SEL
d820: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
d830: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d  ol2 * - col2 + -
d840: 20 36 33 20 2a 20 35 38 20 2f 20 2b 20 63 6f 6c   63 * 58 / + col
d850: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
d860: 2d 0d 0a 2d 31 30 35 0d 0a 2d 31 32 34 31 0d 0a  -..-105..-1241..
d870: 2d 36 37 36 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  -6765....skipif 
d880: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
d890: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
d8a0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
d8b0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
d8c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d8d0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
d8e0: 63 6f 6c 32 20 2a 20 2d 20 74 61 62 30 2e 63 6f  col2 * - tab0.co
d8f0: 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  l1 + - col0 * - 
d900: 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
d910: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 36 32  ab0..----..-2262
d920: 0d 0a 31 31 32 38 0d 0a 34 35 39 0d 0a 0d 0a 6f  ..1128..459....o
d930: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
d940: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
d950: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
d960: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
d970: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 36 0d 0a  sort label-396..
d980: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49  SELECT + col0 DI
d990: 56 20 2b 20 34 30 20 2b 20 2b 20 32 32 20 41 53  V + 40 + + 22 AS
d9a0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
d9b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
d9c0: 32 0d 0a 32 33 0d 0a 32 34 0d 0a 0d 0a 73 6b 69  2..23..24....ski
d9d0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
d9e0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
d9f0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
da00: 6c 2d 33 39 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-396..SELECT + 
da10: 63 6f 6c 30 20 2f 20 2b 20 34 30 20 2b 20 2b 20  col0 / + 40 + + 
da20: 32 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  22 AS col1 FROM 
da30: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
da40: 2d 2d 0d 0a 32 32 0d 0a 32 33 0d 0a 32 34 0d 0a  --..22..23..24..
da50: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
da60: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
da70: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
da80: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
da90: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
daa0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
dab0: 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 32  CT + col1 - col2
dac0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
dad0: 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a  .----..-21..33..
dae0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
daf0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
db00: 32 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 - + col0 AS co
db10: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
db20: 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a  --..-7..16..51..
db30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
db40: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
db50: 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   * col2 + cor0.c
db60: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
db70: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30   cor0..----..-70
db80: 36 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d 0a  6..-7207..62....
db90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
dba0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
dbb0: 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31   + col1 * - col1
dbc0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
dbd0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
dbe0: 0d 0a 32 32 38 33 31 0d 0a 32 37 31 35 31 38 0d  ..22831..271518.
dbf0: 0a 36 37 32 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .6727....query I
dc00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
dc10: 20 31 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   10 FROM tab0, t
dc20: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
dc30: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
dc40: 20 74 6f 20 61 34 37 31 39 34 34 32 39 66 33 65   to a47194429f3e
dc50: 30 33 35 38 61 33 61 65 62 66 66 64 35 66 30 35  0358a3aebffd5f05
dc60: 30 31 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0113....query I 
dc70: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
dc80: 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  + col2 * - col0 
dc90: 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  + ( cor0.col2 ) 
dca0: 2a 20 28 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  * ( + ( + col0 )
dcb0: 20 29 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   ) * col2 + col0
dcc0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
dcd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 33 36 38 0d  r0..----..25368.
dce0: 0a 33 35 0d 0a 35 39 31 32 32 37 0d 0a 0d 0a 71  .35..591227....q
dcf0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
dd00: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
dd10: 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  0.col2 * + cor0.
dd20: 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
dd30: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
dd40: 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39  -..2838..7462..9
dd50: 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
dd60: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
dd70: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
dd80: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
dd90: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
dda0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ddb0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
ddc0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
ddd0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d  cor0..----..-54.
dde0: 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65  .-57..-96....que
ddf0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
de00: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
de10: 63 6f 6c 31 20 2b 20 2b 20 28 20 2d 20 63 6f 6c  col1 + + ( - col
de20: 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  2 ) FROM tab1 AS
de30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
de40: 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a 71  9..-67..-80....q
de50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
de60: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
de70: 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 32 20  col0 * + ( col2 
de80: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
de90: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
dea0: 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d  35..7298..792...
deb0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
dec0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
ded0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
dee0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
def0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
df00: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
df10: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
df20: 32 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20  2 * - col0 col2 
df30: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
df40: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  0..----..-162..-
df50: 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 73  3648..-7680....s
df60: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
df70: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
df80: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
df90: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
dfa0: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
dfb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
dfc0: 63 6f 6c 31 20 2a 20 2b 20 32 33 20 2a 20 2b 20  col1 * + 23 * + 
dfd0: 34 37 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  47 col0 FROM tab
dfe0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  1 cor0..----..10
dff0: 38 31 30 0d 0a 31 34 30 35 33 0d 0a 32 38 31 30  810..14053..2810
e000: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
e010: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
e020: 6f 6c 32 20 2a 20 2b 20 38 33 20 41 53 20 63 6f  ol2 * + 83 AS co
e030: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
e040: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 38  cor0..----..-448
e050: 32 0d 0a 2d 34 37 33 31 0d 0a 2d 37 39 36 38 0d  2..-4731..-7968.
e060: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
e070: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
e080: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
e090: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
e0a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
e0b0: 31 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  10..SELECT DISTI
e0c0: 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  NCT - col1 + - c
e0d0: 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 46 52 4f  ol1 DIV col0 FRO
e0e0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
e0f0: 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 33 34  -..-10..-13..-34
e100: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
e110: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
e120: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
e130: 72 74 20 6c 61 62 65 6c 2d 34 31 30 0d 0a 53 45  rt label-410..SE
e140: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
e150: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2f 20  col1 + - col1 / 
e160: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
e170: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a  or0..----..-10..
e180: 2d 31 33 0d 0a 2d 33 34 0d 0a 0d 0a 71 75 65 72  -13..-34....quer
e190: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e1a0: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d  ECT ALL col1 * -
e1b0: 20 33 34 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f   34 * - col2 FRO
e1c0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
e1d0: 2d 2d 2d 2d 0d 0a 31 39 33 38 30 0d 0a 34 32 34  ----..19380..424
e1e0: 33 32 0d 0a 34 37 37 33 36 0d 0a 0d 0a 73 6b 69  32..47736....ski
e1f0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
e200: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
e210: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
e220: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
e230: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
e240: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
e250: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 39 37  cor0.col0 * + 97
e260: 20 2a 20 2b 20 35 33 20 63 6f 6c 30 20 46 52 4f   * + 53 col0 FRO
e270: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
e280: 2d 2d 2d 2d 0d 0a 31 32 33 33 38 34 0d 0a 31 37  ----..123384..17
e290: 39 39 33 35 0d 0a 34 35 37 35 34 39 0d 0a 0d 0a  9935..457549....
e2a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e2b0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
e2c0: 63 6f 6c 32 20 2a 20 2d 20 28 20 2b 20 63 6f 6c  col2 * - ( + col
e2d0: 31 20 29 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  1 ) - col2 AS co
e2e0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
e2f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  cor0..----..-134
e300: 34 0d 0a 2d 31 34 35 38 0d 0a 2d 36 32 37 0d 0a  4..-1458..-627..
e310: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e320: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
e330: 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63  .col1 * - cor0.c
e340: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
e350: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
e360: 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d  43..-217..-4602.
e370: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
e380: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
e390: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
e3a0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
e3b0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
e3c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e3d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
e3e0: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol0 * + col2 col
e3f0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
e400: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d  or0..----..-162.
e410: 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d  .-3648..-7680...
e420: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
e430: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
e440: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
e450: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
e460: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 36  owsort label-416
e470: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
e480: 2b 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 74 61 62  + - col2 - - tab
e490: 30 2e 63 6f 6c 31 20 44 49 56 20 2d 20 32 20 41  0.col1 DIV - 2 A
e4a0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
e4b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 34 35  ..----..-43..-45
e4c0: 0d 0a 2d 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-48....skipif 
e4d0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
e4e0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
e4f0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31  rowsort label-41
e500: 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  6..SELECT + col2
e510: 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 74 61   + - col2 - - ta
e520: 62 30 2e 63 6f 6c 31 20 2f 20 2d 20 32 20 41 53  b0.col1 / - 2 AS
e530: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
e540: 0a 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 34 35 0d  .----..-43..-45.
e550: 0a 2d 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-48....query I 
e560: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e570: 44 49 53 54 49 4e 43 54 20 2b 20 39 34 20 2a 20  DISTINCT + 94 * 
e580: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
e590: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
e5a0: 2d 2d 2d 0d 0a 2d 36 35 38 0d 0a 2d 37 33 33 32  ---..-658..-7332
e5b0: 0d 0a 2d 37 34 32 36 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7426....onlyi
e5c0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
e5d0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
e5e0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
e5f0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
e600: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e610: 62 65 6c 2d 34 31 38 0d 0a 53 45 4c 45 43 54 20  bel-418..SELECT 
e620: 2d 20 43 41 53 54 28 20 2b 20 63 6f 72 30 2e 63  - CAST( + cor0.c
e630: 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
e640: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
e650: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39  0..----..-86..-9
e660: 31 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  1..-97....skipif
e670: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
e680: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
e690: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
e6a0: 31 38 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  18..SELECT - CAS
e6b0: 54 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T ( + cor0.col1 
e6c0: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
e6d0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
e6e0: 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a  ----..-86..-91..
e6f0: 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -97....skipif po
e700: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
e710: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
e720: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
e730: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
e740: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e750: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e760: 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   - + col2 + - co
e770: 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  l0 * + col2 + co
e780: 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
e790: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
e7a0: 0a 2d 31 39 30 0d 0a 2d 33 36 39 35 0d 0a 2d 37  .-190..-3695..-7
e7b0: 37 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  763....onlyif my
e7c0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
e7d0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
e7e0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
e7f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e800: 65 6c 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20 28  el-420..SELECT (
e810: 20 2d 20 39 37 20 29 20 44 49 56 20 2b 20 63 6f   - 97 ) DIV + co
e820: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
e830: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
e840: 2d 2d 0d 0a 2d 31 0d 0a 2d 33 0d 0a 2d 35 0d 0a  --..-1..-3..-5..
e850: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
e860: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
e870: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e880: 20 6c 61 62 65 6c 2d 34 32 30 0d 0a 53 45 4c 45   label-420..SELE
e890: 43 54 20 28 20 2d 20 39 37 20 29 20 2f 20 2b 20  CT ( - 97 ) / + 
e8a0: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
e8b0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
e8c0: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 0d 0a 2d 35  ----..-1..-3..-5
e8d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e8e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32  ort..SELECT + 12
e8f0: 20 2b 20 2b 20 34 37 20 2a 20 2b 20 63 6f 6c 31   + + 47 * + col1
e900: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
e910: 0a 2d 2d 2d 2d 0d 0a 34 30 35 34 0d 0a 34 32 38  .----..4054..428
e920: 39 0d 0a 34 35 37 31 0d 0a 0d 0a 71 75 65 72 79  9..4571....query
e930: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e940: 43 54 20 2b 20 2d 20 36 30 20 41 53 20 63 6f 6c  CT + - 60 AS col
e950: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
e960: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 0d 0a  or0..----..-60..
e970: 2d 36 30 0d 0a 2d 36 30 0d 0a 0d 0a 73 6b 69 70  -60..-60....skip
e980: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
e990: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
e9a0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
e9b0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
e9c0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
e9d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
e9e0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   + cor0.col2 * +
e9f0: 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
ea00: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
ea10: 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a  .1..1089..6724..
ea20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ea30: 74 0d 0a 53 45 4c 45 43 54 20 36 36 20 2b 20 28  t..SELECT 66 + (
ea40: 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   - col0 ) FROM t
ea50: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
ea60: 2d 0d 0a 2d 31 32 0d 0a 2d 31 33 0d 0a 35 39 0d  -..-12..-13..59.
ea70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ea80: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
ea90: 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d  NCT col1 * - ( -
eaa0: 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31   col0 ) + - col1
eab0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
eac0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 37 0d 0a  r0..----..1027..
ead0: 35 32 0d 0a 36 33 30 0d 0a 0d 0a 71 75 65 72 79  52..630....query
eae0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
eaf0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 38  CT DISTINCT + 58
eb00: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30   + col0 * + cor0
eb10: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20  .col2 FROM tab2 
eb20: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
eb30: 30 38 36 0d 0a 32 34 37 0d 0a 33 30 36 30 0d 0a  086..247..3060..
eb40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb50: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
eb60: 2b 20 39 33 20 2a 20 63 6f 6c 30 20 41 53 20 63  + 93 * col0 AS c
eb70: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
eb80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   cor0..----..-22
eb90: 33 32 0d 0a 2d 33 32 35 35 0d 0a 2d 38 32 37 37  32..-3255..-8277
eba0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ebb0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
ebc0: 49 4e 43 54 20 2b 20 34 35 20 2a 20 2b 20 63 6f  INCT + 45 * + co
ebd0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
ebe0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 30  cor0..----..2430
ebf0: 0d 0a 32 35 36 35 0d 0a 34 33 32 30 0d 0a 0d 0a  ..2565..4320....
ec00: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
ec10: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
ec20: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
ec30: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
ec40: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
ec50: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ec60: 20 2d 20 38 37 20 63 6f 6c 32 20 46 52 4f 4d 20   - 87 col2 FROM 
ec70: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
ec80: 2d 2d 0d 0a 2d 38 37 0d 0a 2d 38 37 0d 0a 2d 38  --..-87..-87..-8
ec90: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
eca0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ecb0: 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63   cor0.col2 * - c
ecc0: 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  or0.col1 + - col
ecd0: 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 * col0 FROM ta
ece0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
ecf0: 0d 0a 2d 31 35 35 36 31 0d 0a 2d 33 34 39 32 0d  ..-15561..-3492.
ed00: 0a 2d 34 39 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4902....query 
ed10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ed20: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
ed30: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 * + col1 AS 
ed40: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
ed50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
ed60: 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a  040..-640..-78..
ed70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ed80: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
ed90: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f   col2 * col0 FRO
eda0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
edb0: 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a  ----..36..7380..
edc0: 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  825....query I r
edd0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
ede0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b   col0 * col0 + +
edf0: 20 63 6f 6c 32 20 2a 20 36 34 20 46 52 4f 4d 20   col2 * 64 FROM 
ee00: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
ee10: 2d 2d 0d 0a 2d 33 38 30 39 0d 0a 2d 34 34 32 30  --..-3809..-4420
ee20: 0d 0a 31 36 37 39 0d 0a 0d 0a 71 75 65 72 79 20  ..1679....query 
ee30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ee40: 54 20 41 4c 4c 20 63 6f 6c 30 20 2d 20 2d 20 63  T ALL col0 - - c
ee50: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
ee60: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38   tab1..----..128
ee70: 0d 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72  ..160..6....quer
ee80: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ee90: 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 38 20  ECT DISTINCT 58 
eea0: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  * col1 AS col2 F
eeb0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
eec0: 0d 0a 2d 2d 2d 2d 0d 0a 34 39 38 38 0d 0a 35 32  ..----..4988..52
eed0: 37 38 0d 0a 35 36 32 36 0d 0a 0d 0a 71 75 65 72  78..5626....quer
eee0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
eef0: 45 43 54 20 41 4c 4c 20 39 30 20 41 53 20 63 6f  ECT ALL 90 AS co
ef00: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
ef10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a  cor0..----..90..
ef20: 39 30 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20  90..90....query 
ef30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ef40: 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 31 31 20  T + col2 + - 11 
ef50: 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
ef60: 2d 2d 2d 2d 0d 0a 34 33 0d 0a 34 36 0d 0a 38 35  ----..43..46..85
ef70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ef80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 38  ort..SELECT - 58
ef90: 20 2a 20 2d 20 39 37 20 2b 20 2d 20 63 6f 6c 31   * - 97 + - col1
efa0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
efb0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  b1 cor0..----..5
efc0: 36 30 30 0d 0a 35 36 31 33 0d 0a 35 36 31 36 0d  600..5613..5616.
efd0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
efe0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
eff0: 4e 43 54 20 2d 20 2d 20 38 36 20 2b 20 2b 20 63  NCT - - 86 + + c
f000: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
f010: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 31  r0..----..103..1
f020: 31 37 0d 0a 31 34 35 0d 0a 0d 0a 6f 6e 6c 79 69  17..145....onlyi
f030: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
f040: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
f050: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
f060: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
f070: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f080: 62 65 6c 2d 34 34 30 0d 0a 53 45 4c 45 43 54 20  bel-440..SELECT 
f090: 41 4c 4c 20 2d 20 43 41 53 54 28 20 38 34 20 41  ALL - CAST( 84 A
f0a0: 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c  S SIGNED ) + col
f0b0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
f0c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a  or0..----..-25..
f0d0: 2d 35 33 0d 0a 2d 36 37 0d 0a 0d 0a 73 6b 69 70  -53..-67....skip
f0e0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
f0f0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
f100: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
f110: 2d 34 34 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -440..SELECT ALL
f120: 20 2d 20 43 41 53 54 20 28 20 38 34 20 41 53 20   - CAST ( 84 AS 
f130: 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31  INTEGER ) + col1
f140: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
f150: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d  r0..----..-25..-
f160: 35 33 0d 0a 2d 36 37 0d 0a 0d 0a 6f 6e 6c 79 69  53..-67....onlyi
f170: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
f180: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
f190: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
f1a0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
f1b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f1c0: 62 65 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54 20  bel-441..SELECT 
f1d0: 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 63  DISTINCT CAST( c
f1e0: 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
f1f0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
f200: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
f210: 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73  .86..91..97....s
f220: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
f230: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
f240: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
f250: 62 65 6c 2d 34 34 31 0d 0a 53 45 4c 45 43 54 20  bel-441..SELECT 
f260: 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
f270: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
f280: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
f290: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
f2a0: 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..86..91..97...
f2b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f2c0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
f2d0: 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
f2e0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
f2f0: 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30  ..189..2028..300
f300: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
f310: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
f320: 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63  ol1 + ( + cor0.c
f330: 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol0 ) FROM tab2 
f340: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f350: 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 6f 6e  24..19..62....on
f360: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
f370: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
f380: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
f390: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
f3a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f3b0: 20 6c 61 62 65 6c 2d 34 34 34 0d 0a 53 45 4c 45   label-444..SELE
f3c0: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  CT - col0 * col1
f3d0: 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54   * col2 + + CAST
f3e0: 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ( - cor0.col2 AS
f3f0: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
f400: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
f410: 2d 0d 0a 2d 33 36 35 33 37 0d 0a 2d 34 32 36 36  -..-36537..-4266
f420: 0d 0a 2d 39 39 39 33 36 0d 0a 0d 0a 73 6b 69 70  ..-99936....skip
f430: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
f440: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
f450: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
f460: 2d 34 34 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -444..SELECT - c
f470: 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol0 * col1 * col
f480: 32 20 2b 20 2b 20 43 41 53 54 20 28 20 2d 20 63  2 + + CAST ( - c
f490: 6f 72 30 2e 63 6f 6c 32 20 41 53 20 49 4e 54 45  or0.col2 AS INTE
f4a0: 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20  GER ) FROM tab1 
f4b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
f4c0: 33 36 35 33 37 0d 0a 2d 34 32 36 36 0d 0a 2d 39  36537..-4266..-9
f4d0: 39 39 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9936....query I 
f4e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f4f0: 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29  ALL + ( - col0 )
f500: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
f510: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
f520: 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
f530: 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
f540: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
f550: 20 74 61 62 30 2e 63 6f 6c 30 20 29 20 2a 20 2b   tab0.col0 ) * +
f560: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
f570: 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39  .----..2064..339
f580: 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  5..8099....query
f590: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f5a0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
f5b0: 37 36 20 2b 20 2d 20 38 35 20 46 52 4f 4d 20 74  76 + - 85 FROM t
f5c0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f5d0: 2d 0d 0a 2d 31 36 31 0d 0a 0d 0a 71 75 65 72 79  -..-161....query
f5e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f5f0: 43 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 30 20  CT ALL ( - col0 
f600: 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ) + + col1 * col
f610: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
f620: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a  or0..----..210..
f630: 33 34 30 33 0d 0a 39 35 34 0d 0a 0d 0a 71 75 65  3403..954....que
f640: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f650: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 38 33  LECT + col2 + 83
f660: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
f670: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
f680: 0d 0a 31 31 36 0d 0a 31 36 35 0d 0a 38 34 0d 0a  ..116..165..84..
f690: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
f6a0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
f6b0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
f6c0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
f6d0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35  rowsort label-45
f6e0: 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
f6f0: 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f  CT - col2 DIV co
f700: 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l0 + + col1 FROM
f710: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
f720: 0d 0a 31 37 0d 0a 32 38 0d 0a 35 39 0d 0a 0d 0a  ..17..28..59....
f730: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
f740: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
f750: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f760: 61 62 65 6c 2d 34 35 30 0d 0a 53 45 4c 45 43 54  abel-450..SELECT
f770: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
f780: 20 2f 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   / col0 + + col1
f790: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
f7a0: 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 32 38 0d 0a 35  .----..17..28..5
f7b0: 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
f7c0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
f7d0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
f7e0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
f7f0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
f800: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35  rowsort label-45
f810: 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20  1..SELECT CAST( 
f820: 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
f830: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
f840: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
f850: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31  0..----..104..11
f860: 37 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..34....skipif 
f870: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
f880: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
f890: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35  rowsort label-45
f8a0: 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  1..SELECT CAST (
f8b0: 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52   col2 AS INTEGER
f8c0: 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) + col0 AS col
f8d0: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
f8e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a  or0..----..104..
f8f0: 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79  117..34....query
f900: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f910: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
f920: 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20  ( cor0.col2 ) * 
f930: 63 6f 6c 32 20 2b 20 2d 20 28 20 2d 20 63 6f 72  col2 + - ( - cor
f940: 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20  0.col0 * col1 ) 
f950: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
f960: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 35 36 0d 0a  0..----..10256..
f970: 32 39 39 34 0d 0a 33 38 38 39 0d 0a 0d 0a 71 75  2994..3889....qu
f980: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f990: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20  ELECT ALL - ( + 
f9a0: 31 38 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  18 ) + - cor0.co
f9b0: 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  l0 * col2 * - co
f9c0: 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l0 - + col1 FROM
f9d0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
f9e0: 2d 2d 2d 0d 0a 31 31 31 30 0d 0a 31 38 39 30 34  ---..1110..18904
f9f0: 0d 0a 36 34 39 34 31 33 0d 0a 0d 0a 71 75 65 72  ..649413....quer
fa00: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fa10: 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 37 20  ECT DISTINCT 97 
fa20: 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  * col1 * col2 FR
fa30: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
fa40: 32 31 30 35 36 0d 0a 31 33 36 31 38 38 0d 0a 35  21056..136188..5
fa50: 35 32 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5290....query I 
fa60: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fa70: 2b 20 63 6f 6c 32 20 2a 20 39 34 20 41 53 20 63  + col2 * 94 AS c
fa80: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
fa90: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 37   cor0..----..507
faa0: 36 0d 0a 35 33 35 38 0d 0a 39 30 32 34 0d 0a 0d  6..5358..9024...
fab0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
fac0: 0d 0a 53 45 4c 45 43 54 20 38 20 46 52 4f 4d 20  ..SELECT 8 FROM 
fad0: 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
fae0: 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
faf0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
fb00: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
fb10: 66 66 63 35 62 34 63 39 38 62 35 37 61 65 35 34  ffc5b4c98b57ae54
fb20: 36 35 32 31 31 37 35 39 39 35 63 34 39 63 35 37  6521175995c49c57
fb30: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
fb40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 37  ort..SELECT - 27
fb50: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
fb60: 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
fb70: 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f   JOIN tab1 AS co
fb80: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
fb90: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 30  es hashing to 90
fba0: 62 37 36 63 61 66 35 34 61 34 65 34 38 65 65 34  b76caf54a4e48ee4
fbb0: 61 39 37 38 34 66 35 32 39 39 37 61 36 61 0d 0a  a9784f52997a6a..
fbc0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fbd0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
fbe0: 43 54 20 2b 20 33 31 20 41 53 20 63 6f 6c 32 20  CT + 31 AS col2 
fbf0: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20  FROM tab2, tab0 
fc00: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
fc10: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
fc20: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
fc30: 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63  TINCT - col1 + c
fc40: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 * + col1 FRO
fc50: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
fc60: 2d 0d 0a 31 35 36 0d 0a 36 35 30 0d 0a 39 30 0d  -..156..650..90.
fc70: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
fc80: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
fc90: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
fca0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
fcb0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
fcc0: 36 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  60..SELECT - col
fcd0: 30 20 2a 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  0 * ( col0 ) + c
fce0: 6f 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29  ol1 * - ( col0 )
fcf0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 31   + cor0.col0 * 1
fd00: 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
fd10: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
fd20: 2d 0d 0a 2d 31 30 36 38 35 0d 0a 2d 32 36 36 0d  -..-10685..-266.
fd30: 0a 2d 37 35 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-7580....skipif
fd40: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
fd50: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
fd60: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
fd70: 36 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  60..SELECT - col
fd80: 30 20 2a 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  0 * ( col0 ) + c
fd90: 6f 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29  ol1 * - ( col0 )
fda0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 31   + cor0.col0 * 1
fdb0: 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   / col1 FROM tab
fdc0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
fdd0: 0a 2d 31 30 36 38 35 0d 0a 2d 32 36 36 0d 0a 2d  .-10685..-266..-
fde0: 37 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7580....query I 
fdf0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fe00: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
fe10: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
fe20: 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 32  cor0.col2 - col2
fe30: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
fe40: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
fe50: 0d 0a 2d 31 34 39 39 0d 0a 2d 37 36 31 0d 0a 2d  ..-1499..-761..-
fe60: 37 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  787....query I r
fe70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
fe80: 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 37 37 20  or0.col2 - - 77 
fe90: 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  * + col0 AS col1
fea0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
feb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 36 36 0d 0a 36  r0..----..566..6
fec0: 30 33 32 0d 0a 36 31 32 31 0d 0a 0d 0a 6f 6e 6c  032..6121....onl
fed0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
fee0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
fef0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
ff00: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
ff10: 72 74 20 6c 61 62 65 6c 2d 34 36 33 0d 0a 53 45  rt label-463..SE
ff20: 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  LECT col0 + col2
ff30: 20 2d 20 34 33 20 44 49 56 20 63 6f 6c 31 20 46   - 43 DIV col1 F
ff40: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
ff50: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 31 37 33  ..----..117..173
ff60: 0d 0a 35 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..56....skipif m
ff70: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
ff80: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
ff90: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 33  owsort label-463
ffa0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
ffb0: 63 6f 6c 32 20 2d 20 34 33 20 2f 20 63 6f 6c 31  col2 - 43 / col1
ffc0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
ffd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 31  r0..----..117..1
ffe0: 37 33 0d 0a 35 36 0d 0a 0d 0a 71 75 65 72 79 20  73..56....query 
fff0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10000 54 20 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63  T + col2 * ( - c
10010 6f 6c 30 20 29 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol0 ) + col2 + -
10020 20 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   3 FROM tab1 AS 
10030 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31  cor0..----..-111
10040 0d 0a 2d 33 35 39 34 0d 0a 2d 37 35 38 37 0d 0a  ..-3594..-7587..
10050 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10060 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
10070 20 2a 20 35 37 20 41 53 20 63 6f 6c 32 20 46 52   * 57 AS col2 FR
10080 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
10090 0a 2d 2d 2d 2d 0d 0a 34 39 30 32 0d 0a 35 31 38  .----..4902..518
100a0 37 0d 0a 35 35 32 39 0d 0a 0d 0a 71 75 65 72 79  7..5529....query
100b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
100c0 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2d  CT tab1.col2 + -
100d0 20 39 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c   91 * col2 + col
100e0 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  2 * - col1 * col
100f0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
10100 2d 0d 0a 2d 31 30 38 34 38 30 0d 0a 2d 34 31 36  -..-108480..-416
10110 31 30 0d 0a 2d 39 30 37 32 0d 0a 0d 0a 71 75 65  10..-9072....que
10120 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10130 4c 45 43 54 20 2d 20 31 33 20 46 52 4f 4d 20 74  LECT - 13 FROM t
10140 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
10150 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
10160 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 39 35  s hashing to e95
10170 66 35 66 34 62 64 30 66 34 38 30 33 39 37 63 63  f5f4bd0f480397cc
10180 65 64 35 66 35 65 38 61 32 33 37 39 32 0d 0a 0d  ed5f5e8a23792...
10190 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
101a0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
101b0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
101c0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
101d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 36 38  owsort label-468
101e0 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 63  ..SELECT - + ( c
101f0 6f 6c 30 20 29 20 2d 20 63 6f 6c 30 20 44 49 56  ol0 ) - col0 DIV
10200 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
10210 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
10220 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  cor0..----..-4..
10230 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a 73 6b 69 70  -65..-81....skip
10240 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
10250 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
10260 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10270 2d 34 36 38 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -468..SELECT - +
10280 20 28 20 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 30   ( col0 ) - col0
10290 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   / cor0.col0 AS 
102a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
102b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
102c0 0d 0a 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a 71 75  ..-65..-81....qu
102d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
102e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
102f0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30   + col0 * + cor0
10300 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
10310 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
10320 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a  62..3648..7680..
10330 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10340 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
10350 32 37 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  27 + col2 FROM t
10360 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
10370 2d 0d 0a 31 32 33 0d 0a 38 31 0d 0a 38 34 0d 0a  -..123..81..84..
10380 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
10390 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
103a0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
103b0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
103c0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
103d0 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 31 0d 0a  sort label-471..
103e0 53 45 4c 45 43 54 20 2d 20 31 32 20 2a 20 2b 20  SELECT - 12 * + 
103f0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col0 * + col1 + 
10400 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 31 20  col0 * - ( col1 
10410 29 20 2d 20 2b 20 43 41 53 54 28 20 63 6f 6c 32  ) - + CAST( col2
10420 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
10430 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
10440 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
10450 30 35 33 36 39 0d 0a 2d 32 36 38 36 35 0d 0a 2d  05369..-26865..-
10460 34 34 31 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  44136....skipif 
10470 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
10480 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
10490 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
104a0 31 0d 0a 53 45 4c 45 43 54 20 2d 20 31 32 20 2a  1..SELECT - 12 *
104b0 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31   + col0 * + col1
104c0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f   + col0 * - ( co
104d0 6c 31 20 29 20 2d 20 2b 20 43 41 53 54 20 28 20  l1 ) - + CAST ( 
104e0 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
104f0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
10500 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
10510 2d 0d 0a 2d 31 30 35 33 36 39 0d 0a 2d 32 36 38  -..-105369..-268
10520 36 35 0d 0a 2d 34 34 31 33 36 0d 0a 0d 0a 71 75  65..-44136....qu
10530 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10540 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 31 36 20  ELECT col2 * 16 
10550 2b 20 2b 20 63 6f 6c 30 20 2a 20 35 31 20 2d 20  + + col0 * 51 - 
10560 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
10570 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
10580 0d 0a 34 34 32 30 0d 0a 34 36 37 35 0d 0a 38 31  ..4420..4675..81
10590 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  6....query IIIII
105a0 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
105b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
105c0 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61   * FROM tab1, ta
105d0 62 31 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  b1 cor0, tab1 AS
105e0 20 63 6f 72 31 2c 20 74 61 62 32 20 63 6f 72 32   cor1, tab2 cor2
105f0 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75  ..----..972 valu
10600 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 32  es hashing to 72
10610 65 62 33 64 34 64 35 32 33 66 35 64 30 63 36 39  eb3d4d523f5d0c69
10620 64 31 62 38 35 35 65 64 64 31 38 66 34 61 0d 0a  d1b855edd18f4a..
10630 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10640 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
10650 43 54 20 2b 20 31 34 20 2a 20 2b 20 63 6f 6c 30  CT + 14 * + col0
10660 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
10670 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 32 0d 0a  r0..----..1092..
10680 31 31 30 36 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79  1106..98....only
10690 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
106a0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
106b0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
106c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
106d0 74 20 6c 61 62 65 6c 2d 34 37 35 0d 0a 53 45 4c  t label-475..SEL
106e0 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 44 49 56  ECT ALL col0 DIV
106f0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
10700 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
10710 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31  ----..-1..-1..-1
10720 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
10730 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
10740 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
10750 72 74 20 6c 61 62 65 6c 2d 34 37 35 0d 0a 53 45  rt label-475..SE
10760 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2f 20  LECT ALL col0 / 
10770 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
10780 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
10790 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
107a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
107b0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 30 20  rt..SELECT + 70 
107c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
107d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
107e0 0a 37 30 0d 0a 37 30 0d 0a 37 30 0d 0a 0d 0a 71  .70..70..70....q
107f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10800 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f 72  SELECT + ( + cor
10810 30 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  0.col2 ) AS col1
10820 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
10830 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37  r0..----..26..27
10840 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..38....query I 
10850 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10860 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20 28 20 63  - ( col1 ) + ( c
10870 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol1 ) FROM tab0 
10880 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
10890 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..0..0....onlyif
108a0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
108b0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
108c0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
108d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
108e0 6c 61 62 65 6c 2d 34 37 39 0d 0a 53 45 4c 45 43  label-479..SELEC
108f0 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 28 20 2d  T + col2 DIV ( -
10900 20 28 20 63 6f 6c 32 20 29 20 29 20 41 53 20 63   ( col2 ) ) AS c
10910 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
10920 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
10930 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69  .-1..-1....skipi
10940 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
10950 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
10960 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
10970 34 37 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  479..SELECT + co
10980 6c 32 20 2f 20 28 20 2d 20 28 20 63 6f 6c 32 20  l2 / ( - ( col2 
10990 29 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ) ) AS col2 FROM
109a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
109b0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
109c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
109d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 37 20  rt..SELECT + 27 
109e0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c  FROM tab0, tab2,
109f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
10a00 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
10a10 61 73 68 69 6e 67 20 74 6f 20 31 61 33 63 65 66  ashing to 1a3cef
10a20 35 63 33 33 62 38 66 38 37 66 66 65 64 65 64 33  5c33b8f87ffeded3
10a30 37 38 66 64 32 30 37 37 35 33 0d 0a 0d 0a 6f 6e  78fd207753....on
10a40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
10a50 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
10a60 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
10a70 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
10a80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10a90 20 6c 61 62 65 6c 2d 34 38 31 0d 0a 53 45 4c 45   label-481..SELE
10aa0 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT + CAST( NULL 
10ab0 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f  AS SIGNED ) * co
10ac0 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l0 + - cor0.col2
10ad0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
10ae0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10af0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
10b00 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
10b10 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
10b20 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
10b30 73 6f 72 74 20 6c 61 62 65 6c 2d 34 38 31 0d 0a  sort label-481..
10b40 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20  SELECT + CAST ( 
10b50 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
10b60 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  ) * col0 + - cor
10b70 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
10b80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
10b90 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
10ba0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
10bb0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
10bc0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
10bd0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
10be0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
10bf0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
10c00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
10c10 20 35 36 20 2b 20 35 35 20 63 6f 6c 31 20 46 52   56 + 55 col1 FR
10c20 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
10c30 31 31 0d 0a 31 31 31 0d 0a 31 31 31 0d 0a 0d 0a  11..111..111....
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 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
10c60 20 2b 20 39 36 20 2a 20 37 34 20 46 52 4f 4d 20   + 96 * 74 FROM 
10c70 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
10c80 2d 2d 0d 0a 37 31 30 34 0d 0a 0d 0a 71 75 65 72  --..7104....quer
10c90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10ca0 45 43 54 20 2d 20 2b 20 34 37 20 2a 20 36 37 20  ECT - + 47 * 67 
10cb0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
10cc0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
10cd0 0a 2d 33 31 34 39 0d 0a 2d 33 31 34 39 0d 0a 2d  .-3149..-3149..-
10ce0 33 31 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3149....onlyif m
10cf0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
10d00 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
10d10 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
10d20 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
10d30 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10d40 2d 34 38 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -485..SELECT DIS
10d50 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63  TINCT col1 * + c
10d60 6f 6c 30 20 2b 20 2d 20 43 41 53 54 28 20 4e 55  ol0 + - CAST( NU
10d70 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
10d80 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
10d90 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
10da0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
10db0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
10dc0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
10dd0 6c 2d 34 38 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-485..SELECT DI
10de0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20  STINCT col1 * + 
10df0 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54 20 28 20  col0 + - CAST ( 
10e00 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
10e10 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  ) FROM tab2 cor0
10e20 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
10e30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10e40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
10e50 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col0 * + col0 + 
10e60 2b 20 31 37 20 46 52 4f 4d 20 74 61 62 30 20 41  + 17 FROM tab0 A
10e70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
10e80 34 32 0d 0a 35 39 33 0d 0a 37 39 33 38 0d 0a 0d  42..593..7938...
10e90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10ea0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
10eb0 54 20 2b 20 2b 20 37 31 20 2b 20 2d 20 63 6f 6c  T + + 71 + - col
10ec0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
10ed0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 38 0d 0a  ..----..-7..-8..
10ee0 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
10ef0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
10f00 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f  STINCT col0 + co
10f10 6c 32 20 2a 20 33 35 20 41 53 20 63 6f 6c 32 20  l2 * 35 AS col2 
10f20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
10f30 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 33 0d 0a 32  0..----..1893..2
10f40 30 35 39 0d 0a 33 34 34 30 0d 0a 0d 0a 73 6b 69  059..3440....ski
10f50 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
10f60 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
10f70 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
10f80 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
10f90 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
10fa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
10fb0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32  cor0.col2 + col2
10fc0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
10fd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
10fe0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
10ff0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11000 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63  T ALL + col2 * c
11010 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
11020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  r0..----..1534..
11030 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72  646..837....quer
11040 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11050 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b  ECT ALL - col2 +
11060 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
11070 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33  0 cor0..----..53
11080 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  ..9..96....query
11090 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
110a0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
110b0 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  l0 * col1 * - co
110c0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
110d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35  cor0..----..3395
110e0 0d 0a 36 36 34 31 31 38 0d 0a 36 38 31 31 32 0d  ..664118..68112.
110f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
11100 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
11110 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
11120 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
11130 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
11140 39 33 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  93..SELECT + - c
11150 6f 6c 30 20 2b 20 63 6f 6c 32 20 44 49 56 20 32  ol0 + col2 DIV 2
11160 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11170 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11180 0d 0a 2d 36 30 0d 0a 2d 36 35 0d 0a 36 0d 0a 0d  ..-60..-65..6...
11190 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
111a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
111b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
111c0 6c 61 62 65 6c 2d 34 39 33 0d 0a 53 45 4c 45 43  label-493..SELEC
111d0 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  T + - col0 + col
111e0 32 20 2f 20 32 20 41 53 20 63 6f 6c 31 20 46 52  2 / 2 AS col1 FR
111f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
11200 0a 2d 2d 2d 2d 0d 0a 2d 36 30 0d 0a 2d 36 35 0d  .----..-60..-65.
11210 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .6....query I ro
11220 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
11230 63 6f 6c 31 20 2a 20 2d 20 35 36 20 2a 20 63 6f  col1 * - 56 * co
11240 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
11250 2d 2d 0d 0a 31 31 35 35 38 34 0d 0a 31 39 30 31  --..115584..1901
11260 32 30 0d 0a 34 35 33 35 34 34 0d 0a 0d 0a 71 75  20..453544....qu
11270 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11280 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
11290 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
112a0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
112b0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
112c0 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
112d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
112e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 39 20  rt..SELECT + 79 
112f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11300 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
11310 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
11320 68 61 73 68 69 6e 67 20 74 6f 20 34 30 61 32 32  hashing to 40a22
11330 36 31 63 61 61 32 63 35 63 64 62 66 64 38 30 39  61caa2c5cdbfd809
11340 36 35 64 37 64 66 31 32 33 31 66 0d 0a 0d 0a 71  65d7df1231f....q
11350 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11360 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30  SELECT tab0.col0
11370 20 2a 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d   * ( col2 ) FROM
11380 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d   tab0..----..35.
11390 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75  .7298..792....qu
113a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
113b0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  ELECT - col2 * c
113c0 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 - col0 AS co
113d0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
113e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31  cor0..----..-161
113f0 32 0d 0a 2d 37 32 35 0d 0a 2d 38 34 34 0d 0a 0d  2..-725..-844...
11400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11410 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
11420 37 34 20 2d 20 28 20 63 6f 6c 30 20 2a 20 2d 20  74 - ( col0 * - 
11430 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31  col0 ) FROM tab1
11440 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11450 31 32 33 32 30 0d 0a 32 33 31 0d 0a 38 38 33 32  12320..231..8832
11460 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
11470 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
11480 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
11490 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
114a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
114b0 35 30 30 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  500..SELECT + + 
114c0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 28 20 2d 20  cor0.col2 * ( - 
114d0 63 6f 6c 30 20 29 20 44 49 56 20 2b 20 63 6f 6c  col0 ) DIV + col
114e0 31 20 2b 20 2b 20 28 20 63 6f 6c 32 20 29 20 41  1 + + ( col2 ) A
114f0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
11500 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11510 2d 31 33 38 0d 0a 2d 38 0d 0a 32 31 0d 0a 0d 0a  -138..-8..21....
11520 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
11530 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
11540 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11550 61 62 65 6c 2d 35 30 30 0d 0a 53 45 4c 45 43 54  abel-500..SELECT
11560 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   + + cor0.col2 *
11570 20 28 20 2d 20 63 6f 6c 30 20 29 20 2f 20 2b 20   ( - col0 ) / + 
11580 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c 32 20  col1 + + ( col2 
11590 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
115a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
115b0 2d 0d 0a 2d 31 33 38 0d 0a 2d 38 0d 0a 32 31 0d  -..-138..-8..21.
115c0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
115d0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
115e0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
115f0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
11600 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
11610 30 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  01..SELECT + col
11620 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49  1 + cor0.col1 DI
11630 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V - col0 FROM ta
11640 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11650 0d 0a 31 37 0d 0a 32 37 0d 0a 35 39 0d 0a 0d 0a  ..17..27..59....
11660 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
11670 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
11680 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11690 61 62 65 6c 2d 35 30 31 0d 0a 53 45 4c 45 43 54  abel-501..SELECT
116a0 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   + col1 + cor0.c
116b0 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f  ol1 / - col0 FRO
116c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
116d0 2d 2d 2d 2d 0d 0a 31 37 0d 0a 32 37 0d 0a 35 39  ----..17..27..59
116e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
116f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
11700 63 6f 6c 30 20 2b 20 38 35 20 2a 20 63 6f 6c 32  col0 + 85 * col2
11710 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
11720 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  b1 cor0..----..4
11730 35 38 37 0d 0a 34 37 38 31 0d 0a 38 30 38 30 0d  587..4781..8080.
11740 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11750 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 37 39 20  rt..SELECT - 79 
11760 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
11770 32 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  2, tab1, tab0 AS
11780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
11790 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
117a0 6f 20 63 39 63 63 39 35 31 30 36 30 34 65 30 39  o c9cc9510604e09
117b0 33 62 64 31 35 38 63 61 33 33 39 32 38 61 63 61  3bd158ca33928aca
117c0 65 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  ed....onlyif mys
117d0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
117e0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
117f0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
11800 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11810 6c 2d 35 30 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-504..SELECT DI
11820 53 54 49 4e 43 54 20 38 33 20 2a 20 63 6f 6c 30  STINCT 83 * col0
11830 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f   + - col2 DIV co
11840 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
11850 2d 2d 0d 0a 32 34 37 0d 0a 35 33 30 37 0d 0a 36  --..247..5307..6
11860 36 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  633....skipif my
11870 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
11880 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
11890 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30 34 0d  wsort label-504.
118a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
118b0 20 38 33 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63   83 * col0 + - c
118c0 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 / col1 FROM 
118d0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 37 0d  tab1..----..247.
118e0 0a 35 33 30 37 0d 0a 36 36 33 33 0d 0a 0d 0a 71  .5307..6633....q
118f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11900 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36 39 20  SELECT ALL - 69 
11910 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
11920 31 2c 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  1, tab0, tab0 AS
11930 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
11940 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
11950 6f 20 63 61 35 66 34 62 63 33 36 35 64 63 32 63  o ca5f4bc365dc2c
11960 36 62 31 34 31 38 37 64 36 66 66 63 38 33 61 30  6b14187d6ffc83a0
11970 31 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  1d....query I ro
11980 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
11990 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
119a0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
119b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
119c0 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d  ---..-28..-47..-
119d0 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
119e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
119f0 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20  col0 + + col0 + 
11a00 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
11a10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
11a20 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d  -17..-31..-59...
11a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11a40 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
11a50 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  l0 + col0 + col1
11a60 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   * + cor0.col2 *
11a70 20 28 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   ( - col1 + col1
11a80 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
11a90 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
11aa0 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d 0a  .128..160..6....
11ab0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11ac0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
11ad0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 37   * cor0.col2 * 7
11ae0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
11af0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
11b00 2d 0d 0a 33 39 39 30 30 0d 0a 38 37 33 36 30 0d  -..39900..87360.
11b10 0a 39 38 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20  .98280....query 
11b20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11b30 54 20 41 4c 4c 20 2b 20 2d 20 34 31 20 2a 20 2d  T ALL + - 41 * -
11b40 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f   cor1.col0 AS co
11b50 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
11b60 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
11b70 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  tab0 cor1..----.
11b80 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
11b90 67 20 74 6f 20 39 34 38 30 65 38 38 37 66 30 63  g to 9480e887f0c
11ba0 64 31 33 33 34 62 62 39 35 30 63 38 64 31 61 62  d1334bb950c8d1ab
11bb0 62 34 62 66 31 0d 0a 0d 0a 71 75 65 72 79 20 49  b4bf1....query I
11bc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11bd0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
11be0 20 2a 20 35 39 20 41 53 20 63 6f 6c 30 20 46 52   * 59 AS col0 FR
11bf0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
11c00 0a 2d 2d 2d 2d 0d 0a 2d 35 30 37 34 0d 0a 2d 35  .----..-5074..-5
11c10 33 36 39 0d 0a 2d 35 37 32 33 0d 0a 0d 0a 71 75  369..-5723....qu
11c20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11c30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
11c40 20 63 6f 6c 32 20 2b 20 33 39 20 46 52 4f 4d 20   col2 + 39 FROM 
11c50 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
11c60 2d 2d 0d 0a 36 35 0d 0a 36 36 0d 0a 37 37 0d 0a  --..65..66..77..
11c70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11c80 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 37 33  t..SELECT - - 73
11c90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11ca0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11cb0 0d 0a 37 33 0d 0a 37 33 0d 0a 37 33 0d 0a 0d 0a  ..73..73..73....
11cc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11cd0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d  .SELECT col1 * -
11ce0 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63   ( - col1 ) AS c
11cf0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
11d00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
11d10 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75  ..169..676....qu
11d20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11d30 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33 35 20 46  ELECT ALL - 35 F
11d40 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
11d50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
11d60 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
11d70 6f 20 63 31 32 65 38 62 64 64 36 38 37 63 39 30  o c12e8bdd687c90
11d80 34 30 61 35 36 30 30 64 61 62 33 62 36 61 64 66  40a5600dab3b6adf
11d90 35 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  5b....query I ro
11da0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
11db0 53 54 49 4e 43 54 20 2d 20 38 30 20 2b 20 63 6f  STINCT - 80 + co
11dc0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
11dd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d  cor0..----..-47.
11de0 0a 2d 37 39 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79  .-79..2....query
11df0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11e00 43 54 20 41 4c 4c 20 2b 20 2b 20 35 30 20 2a 20  CT ALL + + 50 * 
11e10 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  + col2 * - col0 
11e20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
11e30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 35 30 0d 0a  0..----..-1750..
11e40 2d 33 36 34 39 30 30 0d 0a 2d 33 39 36 30 30 0d  -364900..-39600.
11e50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11e60 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
11e70 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 * - col1 * col
11e80 30 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 - - col1 AS co
11e90 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
11ea0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 37 35  cor0..----..1775
11eb0 39 30 0d 0a 33 32 39 34 31 32 0d 0a 37 33 37 31  90..329412..7371
11ec0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
11ed0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
11ee0 6c 31 20 2a 20 2d 20 33 37 20 2a 20 63 6f 6c 31  l1 * - 37 * col1
11ef0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
11f00 0d 0a 2d 32 35 30 31 32 0d 0a 2d 33 37 30 30 0d  ..-25012..-3700.
11f10 0a 2d 36 32 35 33 0d 0a 0d 0a 71 75 65 72 79 20  .-6253....query 
11f20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11f30 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
11f40 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  0 + - col0 * col
11f50 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
11f60 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
11f70 2d 0d 0a 2d 34 30 33 32 0d 0a 2d 36 0d 0a 2d 36  -..-4032..-6..-6
11f80 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  320....query I r
11f90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
11fa0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
11fb0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
11fc0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  0 cor0..----..0.
11fd0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
11fe0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
11ff0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
12000 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
12010 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12020 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  22..SELECT ALL +
12030 20 28 20 2b 20 63 6f 6c 30 20 29 20 44 49 56 20   ( + col0 ) DIV 
12040 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
12050 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  or0..----..1..1.
12060 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
12070 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
12080 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
12090 73 6f 72 74 20 6c 61 62 65 6c 2d 35 32 32 0d 0a  sort label-522..
120a0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
120b0 20 63 6f 6c 30 20 29 20 2f 20 63 6f 6c 30 20 46   col0 ) / col0 F
120c0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
120d0 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
120e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
120f0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
12100 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   - cor0.col1 + -
12110 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
12120 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l0 FROM tab1 cor
12130 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d 0a  0..----..-1136..
12140 2d 31 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a 71 75  -132..-697....qu
12150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12160 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39  ELECT DISTINCT 9
12170 30 20 2a 20 2d 20 36 20 41 53 20 63 6f 6c 31 20  0 * - 6 AS col1 
12180 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12190 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 30 0d 0a 0d  0..----..-540...
121a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
121b0 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 63  ..SELECT + - ( c
121c0 6f 6c 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c  ol1 ) * cor0.col
121d0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
121e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
121f0 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d  -..-2838..-7462.
12200 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-97....query I 
12210 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12220 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 31 20  col2 * + ( col1 
12230 2b 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63  + + col2 ) * - c
12240 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
12250 2d 2d 2d 0d 0a 2d 31 30 30 34 35 34 34 0d 0a 2d  ---..-1004544..-
12260 32 31 37 36 38 33 0d 0a 2d 32 33 33 32 38 30 0d  217683..-233280.
12270 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12280 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
12290 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  + col2 * col2 * 
122a0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
122b0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
122c0 31 35 37 35 31 38 0d 0a 31 38 35 32 35 30 0d 0a  157518..185250..
122d0 38 38 34 38 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  884832....onlyif
122e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
122f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
12300 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
12310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
12320 6c 61 62 65 6c 2d 35 32 38 0d 0a 53 45 4c 45 43  label-528..SELEC
12330 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 31 32 20  T - col2 DIV 12 
12340 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
12350 0a 2d 32 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a 73  .-2..-2..-3....s
12360 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
12370 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
12380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
12390 62 65 6c 2d 35 32 38 0d 0a 53 45 4c 45 43 54 20  bel-528..SELECT 
123a0 2d 20 63 6f 6c 32 20 2f 20 31 32 20 46 52 4f 4d  - col2 / 12 FROM
123b0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   tab2..----..-2.
123c0 0a 2d 32 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79  .-2..-3....query
123d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
123e0 43 54 20 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f  CT col2 * + ( co
123f0 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53  l2 ) + + col2 AS
12400 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
12410 0a 2d 2d 2d 2d 0d 0a 32 39 37 30 0d 0a 33 33 30  .----..2970..330
12420 36 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79  6..9312....query
12430 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12440 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2b  CT + tab1.col0 +
12450 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 46   + col1 - col0 F
12460 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
12470 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e  10..13..26....on
12480 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
12490 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
124a0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
124b0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
124c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
124d0 20 6c 61 62 65 6c 2d 35 33 31 0d 0a 53 45 4c 45   label-531..SELE
124e0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
124f0 6c 32 20 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c  l2 + CAST( + col
12500 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  0 * + col0 AS SI
12510 47 4e 45 44 20 29 20 2d 20 37 32 20 46 52 4f 4d  GNED ) - 72 FROM
12520 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a   tab2..----..4..
12530 36 30 33 38 0d 0a 36 32 30 37 0d 0a 0d 0a 73 6b  6038..6207....sk
12540 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
12550 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
12560 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12570 65 6c 2d 35 33 31 0d 0a 53 45 4c 45 43 54 20 44  el-531..SELECT D
12580 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
12590 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 2a   CAST ( + col0 *
125a0 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   + col0 AS INTEG
125b0 45 52 20 29 20 2d 20 37 32 20 46 52 4f 4d 20 74  ER ) - 72 FROM t
125c0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36 30  ab2..----..4..60
125d0 33 38 0d 0a 36 32 30 37 0d 0a 0d 0a 71 75 65 72  38..6207....quer
125e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
125f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
12600 30 20 2d 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29  0 - - ( + col1 )
12610 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
12620 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33  b2..----..137..3
12630 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  8..96....query I
12640 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12650 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20   DISTINCT - ( + 
12660 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20  col1 ) + - col0 
12670 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
12680 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d  0..----..-110..-
12690 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65  132..-180....que
126a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
126b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
126c0 2b 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2d 20 63  + col1 + + ( - c
126d0 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20 2d 20 63  or0.col2 ) * - c
126e0 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 - + col1 AS 
126f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
12700 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36 34 0d  or0..----..2864.
12710 0a 33 32 32 39 0d 0a 39 31 39 30 0d 0a 0d 0a 71  .3229..9190....q
12720 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12730 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
12740 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  * + col2 + col2 
12750 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
12760 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
12770 0a 2d 31 34 30 36 0d 0a 2d 36 35 30 0d 0a 2d 37  .-1406..-650..-7
12780 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  02....skipif pos
12790 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
127a0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
127b0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
127c0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
127d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
127e0 53 45 4c 45 43 54 20 41 4c 4c 20 36 20 63 6f 6c  SELECT ALL 6 col
127f0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
12800 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 36 0d  or0..----..6..6.
12810 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .6....query I ro
12820 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
12830 4c 20 2b 20 28 20 37 36 20 29 20 2a 20 2b 20 63  L + ( 76 ) * + c
12840 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 + col0 FROM 
12850 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12860 2d 2d 0d 0a 36 35 36 30 0d 0a 37 30 30 35 0d 0a  --..6560..7005..
12870 37 34 30 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7407....onlyif m
12880 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
12890 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
128a0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
128b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
128c0 62 65 6c 2d 35 33 38 0d 0a 53 45 4c 45 43 54 20  bel-538..SELECT 
128d0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
128e0 2a 20 35 39 20 44 49 56 20 2d 20 63 6f 6c 32 20  * 59 DIV - col2 
128f0 2d 20 2b 20 31 20 46 52 4f 4d 20 74 61 62 30 20  - + 1 FROM tab0 
12900 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 34  cor0..----..-154
12910 0d 0a 2d 35 37 32 34 0d 0a 2d 36 36 0d 0a 0d 0a  ..-5724..-66....
12920 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
12930 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
12940 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
12950 61 62 65 6c 2d 35 33 38 0d 0a 53 45 4c 45 43 54  abel-538..SELECT
12960 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
12970 20 2a 20 35 39 20 2f 20 2d 20 63 6f 6c 32 20 2d   * 59 / - col2 -
12980 20 2b 20 31 20 46 52 4f 4d 20 74 61 62 30 20 63   + 1 FROM tab0 c
12990 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 34 0d  or0..----..-154.
129a0 0a 2d 35 37 32 34 0d 0a 2d 36 36 0d 0a 0d 0a 71  .-5724..-66....q
129b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
129c0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 33  SELECT ALL + ( 3
129d0 35 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  5 ) FROM tab2 co
129e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 35  r0..----..35..35
129f0 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..35....query I 
12a00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12a10 41 4c 4c 20 2b 20 33 37 20 46 52 4f 4d 20 74 61  ALL + 37 FROM ta
12a20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
12a30 0d 0a 33 37 0d 0a 33 37 0d 0a 33 37 0d 0a 0d 0a  ..37..37..37....
12a40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12a50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
12a60 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   - - col0 * - co
12a70 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
12a80 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
12a90 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a  --..-49..-6084..
12aa0 2d 36 32 34 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -6241....onlyif 
12ab0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
12ac0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
12ad0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
12ae0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
12af0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12b00 6c 2d 35 34 32 0d 0a 53 45 4c 45 43 54 20 44 49  l-542..SELECT DI
12b10 53 54 49 4e 43 54 20 2d 20 2d 20 43 41 53 54 28  STINCT - - CAST(
12b20 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
12b30 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
12b40 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
12b50 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
12b60 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
12b70 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
12b80 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12b90 35 34 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  542..SELECT DIST
12ba0 49 4e 43 54 20 2d 20 2d 20 43 41 53 54 20 28 20  INCT - - CAST ( 
12bb0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
12bc0 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
12bd0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
12be0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  -..NULL....query
12bf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12c00 43 54 20 2d 20 63 6f 6c 32 20 2d 20 37 38 20 41  CT - col2 - 78 A
12c10 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
12c20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12c30 2d 31 33 32 0d 0a 2d 31 33 35 0d 0a 2d 31 37 34  -132..-135..-174
12c40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12c50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
12c60 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  - col2 * col1 + 
12c70 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
12c80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
12c90 37 35 32 0d 0a 2d 37 33 37 31 0d 0a 30 0d 0a 0d  752..-7371..0...
12ca0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12cb0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12cc0 54 20 2d 20 37 32 20 46 52 4f 4d 20 74 61 62 30  T - 72 FROM tab0
12cd0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 0d 0a 0d 0a 71  ..----..-72....q
12ce0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12cf0 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
12d00 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72  * - col1 + + cor
12d10 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
12d20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12d30 2d 31 30 32 37 0d 0a 2d 35 32 0d 0a 2d 36 33 30  -1027..-52..-630
12d40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12d50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 30  ort..SELECT + 20
12d60 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
12d70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
12d80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
12d90 39 0d 0a 34 34 0d 0a 35 35 0d 0a 0d 0a 73 6b 69  9..44..55....ski
12da0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
12db0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
12dc0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
12dd0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
12de0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
12df0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
12e00 4c 20 38 39 20 63 6f 6c 31 20 46 52 4f 4d 20 74  L 89 col1 FROM t
12e10 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a  ab0, tab1 cor0..
12e20 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
12e30 61 73 68 69 6e 67 20 74 6f 20 35 63 38 34 32 38  ashing to 5c8428
12e40 65 39 66 31 65 37 64 65 33 64 30 39 63 62 30 38  e9f1e7de3d09cb08
12e50 31 34 62 34 63 63 31 37 34 33 0d 0a 0d 0a 71 75  14b4cc1743....qu
12e60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12e70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
12e80 6f 6c 32 20 2b 20 2b 20 31 35 20 46 52 4f 4d 20  ol2 + + 15 FROM 
12e90 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
12ea0 2d 2d 0d 0a 34 31 0d 0a 34 32 0d 0a 35 33 0d 0a  --..41..42..53..
12eb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12ec0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
12ed0 20 63 6f 6c 32 20 2a 20 2d 20 37 39 20 41 53 20   col2 * - 79 AS 
12ee0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
12ef0 2d 2d 2d 2d 0d 0a 2d 31 32 31 31 38 36 0d 0a 2d  ----..-121186..-
12f00 35 31 30 33 34 0d 0a 2d 36 36 31 32 33 0d 0a 0d  51034..-66123...
12f10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12f20 0d 0a 53 45 4c 45 43 54 20 37 32 20 46 52 4f 4d  ..SELECT 72 FROM
12f30 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
12f40 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
12f50 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
12f60 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 32  es hashing to 92
12f70 63 63 33 64 35 64 61 61 35 35 30 33 30 34 65 39  cc3d5daa550304e9
12f80 36 63 31 35 34 32 37 38 37 36 39 31 63 37 0d 0a  6c1542787691c7..
12f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12fa0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12fb0 43 54 20 63 6f 6c 31 20 2b 20 2d 20 32 38 20 41  CT col1 + - 28 A
12fc0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
12fd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12fe0 2d 31 31 0d 0a 33 0d 0a 33 31 0d 0a 0d 0a 71 75  -11..3..31....qu
12ff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13000 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 31 36  ELECT ALL + + 16
13010 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
13020 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
13030 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f   JOIN tab0 AS co
13040 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
13050 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 66  es hashing to 3f
13060 64 62 30 38 65 63 32 65 33 64 34 62 36 34 32 64  db08ec2e3d4b642d
13070 64 34 35 39 34 37 37 38 63 63 61 38 62 33 0d 0a  d4594778cca8b3..
13080 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
13090 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
130a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
130b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
130c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35  rowsort label-55
130d0 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  4..SELECT DISTIN
130e0 43 54 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20  CT - + col2 DIV 
130f0 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col1 col1 FROM t
13100 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
13110 2d 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -..-2..0....skip
13120 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
13130 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
13140 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
13150 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
13160 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
13170 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
13180 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
13190 6f 72 74 20 6c 61 62 65 6c 2d 35 35 34 0d 0a 53  ort label-554..S
131a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
131b0 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 63   + col2 / col1 c
131c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
131d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
131e0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
131f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
13200 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20  STINCT + col0 * 
13210 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f  + ( + col2 ) FRO
13220 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
13230 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32  -..35..7298..792
13240 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13250 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 31  ort..SELECT cor1
13260 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c  .col1 FROM tab0,
13270 20 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 30   tab1 cor0, tab0
13280 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
13290 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
132a0 67 20 74 6f 20 32 64 36 64 33 30 33 31 64 66 65  g to 2d6d3031dfe
132b0 39 30 65 30 63 30 32 64 62 31 33 61 61 36 33 39  90e0c02db13aa639
132c0 39 33 62 66 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  93bfd....onlyif 
132d0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
132e0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
132f0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
13300 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
13310 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13320 6c 2d 35 35 37 0d 0a 53 45 4c 45 43 54 20 44 49  l-557..SELECT DI
13330 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20  STINCT - + col1 
13340 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
13350 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30  SIGNED ) AS col0
13360 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
13370 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
13380 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
13390 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
133a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
133b0 20 6c 61 62 65 6c 2d 35 35 37 0d 0a 53 45 4c 45   label-557..SELE
133c0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
133d0 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55  col1 + CAST ( NU
133e0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
133f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
13400 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
13410 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
13420 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13430 20 35 39 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c   59 + + cor0.col
13440 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  1 * col1 FROM ta
13450 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  b0 cor0..----..7
13460 34 35 35 0d 0a 38 33 34 30 0d 0a 39 34 36 38 0d  455..8340..9468.
13470 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13480 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
13490 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c   cor0.col1 * col
134a0 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
134b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
134c0 0d 0a 2d 31 30 39 38 32 0d 0a 2d 32 35 39 34 37  ..-10982..-25947
134d0 0d 0a 2d 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72  ..-90506....quer
134e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
134f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
13500 20 39 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b   90 * - col1 + +
13510 20 32 35 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20   25 * + col1 AS 
13520 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
13530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 35  or0..----..-1105
13540 0d 0a 2d 32 30 31 35 0d 0a 2d 33 38 33 35 0d 0a  ..-2015..-3835..
13550 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13560 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
13570 31 36 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74  16 - col2 FROM t
13580 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
13590 2d 0d 0a 2d 33 38 0d 0a 2d 34 31 0d 0a 2d 38 30  -..-38..-41..-80
135a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
135b0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
135c0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
135d0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
135e0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
135f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13600 4c 45 43 54 20 41 4c 4c 20 2b 20 39 20 2b 20 2b  LECT ALL + 9 + +
13610 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
13620 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
13630 2d 2d 0d 0a 31 30 30 0d 0a 31 30 36 0d 0a 39 35  --..100..106..95
13640 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13650 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 30 20 2b  ort..SELECT 50 +
13660 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
13670 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
13680 0a 31 30 34 0d 0a 31 30 37 0d 0a 31 34 36 0d 0a  .104..107..146..
13690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
136a0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33 32  t..SELECT + - 32
136b0 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
136c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
136d0 2d 0d 0a 2d 34 39 0d 0a 2d 36 33 0d 0a 2d 39 31  -..-49..-63..-91
136e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
136f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13700 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20  INCT + - col2 + 
13710 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 32 32  + cor0.col2 * 22
13720 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
13730 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 36 0d 0a 35  r0..----..546..5
13740 36 37 0d 0a 37 39 38 0d 0a 0d 0a 71 75 65 72 79  67..798....query
13750 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
13760 43 54 20 2b 20 32 30 20 2d 20 63 6f 6c 31 20 2a  CT + 20 - col1 *
13770 20 35 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53   51 FROM tab2 AS
13780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
13790 36 31 0d 0a 2d 32 39 38 39 0d 0a 2d 38 34 37 0d  61..-2989..-847.
137a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
137b0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
137c0 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
137d0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
137e0 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a  ---..162..3648..
137f0 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7680....query I 
13800 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13810 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c  ( col1 ) * - col
13820 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62  1 + + col1 * tab
13830 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
13840 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
13850 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13860 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
13870 31 20 2a 20 39 32 20 46 52 4f 4d 20 74 61 62 30  1 * 92 FROM tab0
13880 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13890 37 39 31 32 0d 0a 38 33 37 32 0d 0a 38 39 32 34  7912..8372..8924
138a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
138b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
138c0 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * + col1 + + co
138d0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
138e0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 32 37 0d  tab2..----..327.
138f0 0a 33 35 30 37 0d 0a 39 38 38 0d 0a 0d 0a 6f 6e  .3507..988....on
13900 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
13910 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
13920 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
13930 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
13940 6f 72 74 20 6c 61 62 65 6c 2d 35 37 31 0d 0a 53  ort label-571..S
13950 45 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 2b  ELECT col0 DIV +
13960 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a   col0 + + col2 *
13970 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
13980 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
13990 39 30 0d 0a 32 30 32 39 0d 0a 33 30 30 33 0d 0a  90..2029..3003..
139a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
139b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
139c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
139d0 20 6c 61 62 65 6c 2d 35 37 31 0d 0a 53 45 4c 45   label-571..SELE
139e0 43 54 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30  CT col0 / + col0
139f0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   + + col2 * col0
13a00 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
13a10 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 39 30 0d 0a 32  b2..----..190..2
13a20 30 32 39 0d 0a 33 30 30 33 0d 0a 0d 0a 71 75 65  029..3003....que
13a30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13a40 4c 45 43 54 20 2b 20 36 38 20 2a 20 2b 20 63 6f  LECT + 68 * + co
13a50 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
13a60 2d 2d 0d 0a 31 37 36 38 0d 0a 31 38 33 36 0d 0a  --..1768..1836..
13a70 32 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 49  2584....query II
13a80 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
13a90 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
13aa0 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c  NCT * FROM tab0,
13ab0 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
13ac0 61 62 32 20 63 6f 72 31 2c 20 74 61 62 30 20 41  ab2 cor1, tab0 A
13ad0 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37  S cor2..----..97
13ae0 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
13af0 20 74 6f 20 33 38 30 32 34 31 62 62 63 35 30 33   to 380241bbc503
13b00 61 33 31 65 37 30 34 39 34 36 31 31 61 38 37 66  a31e70494611a87f
13b10 66 64 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  fd99....query I 
13b20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13b30 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col0 + cor0.col2
13b40 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
13b50 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
13b60 0a 31 31 31 33 0d 0a 33 36 0d 0a 36 38 31 33 0d  .1113..36..6813.
13b70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13b80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
13b90 4e 43 54 20 2d 20 2d 20 39 30 20 41 53 20 63 6f  NCT - - 90 AS co
13ba0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
13bb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a  cor0..----..90..
13bc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13bd0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
13be0 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
13bf0 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 - col0 AS col
13c00 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
13c10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 38 0d  or0..----..1168.
13c20 0a 31 34 30 31 0d 0a 35 30 36 0d 0a 0d 0a 71 75  .1401..506....qu
13c30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13c40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 38 20 2a  ELECT ALL + 28 *
13c50 20 39 38 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20   98 + - col1 AS 
13c60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
13c70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
13c80 34 37 0d 0a 32 36 35 33 0d 0a 32 36 35 38 0d 0a  47..2653..2658..
13c90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
13ca0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
13cb0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
13cc0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
13cd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
13ce0 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44  8..SELECT col2 D
13cf0 49 56 20 63 6f 6c 32 20 2b 20 74 61 62 31 2e 63  IV col2 + tab1.c
13d00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
13d10 2d 2d 2d 0d 0a 34 0d 0a 36 35 0d 0a 38 31 0d 0a  ---..4..65..81..
13d20 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
13d30 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
13d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13d50 20 6c 61 62 65 6c 2d 35 37 38 0d 0a 53 45 4c 45   label-578..SELE
13d60 43 54 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 2b  CT col2 / col2 +
13d70 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
13d80 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36  tab1..----..4..6
13d90 35 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  5..81....query I
13da0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13db0 20 2b 20 31 39 20 46 52 4f 4d 20 74 61 62 31 2c   + 19 FROM tab1,
13dc0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13dd0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
13de0 73 68 69 6e 67 20 74 6f 20 33 64 61 63 33 30 64  shing to 3dac30d
13df0 63 38 32 63 39 65 35 61 63 62 62 64 33 61 35 63  c82c9e5acbbd3a5c
13e00 35 64 31 61 65 65 65 31 31 0d 0a 0d 0a 6f 6e 6c  5d1aeee11....onl
13e10 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
13e20 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
13e30 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
13e40 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
13e50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13e60 6c 61 62 65 6c 2d 35 38 30 0d 0a 53 45 4c 45 43  label-580..SELEC
13e70 54 20 2b 20 43 41 53 54 28 20 2d 20 28 20 63 6f  T + CAST( - ( co
13e80 6c 30 20 29 20 41 53 20 53 49 47 4e 45 44 20 29  l0 ) AS SIGNED )
13e90 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
13ea0 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d  ..-24..-35..-89.
13eb0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
13ec0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
13ed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13ee0 74 20 6c 61 62 65 6c 2d 35 38 30 0d 0a 53 45 4c  t label-580..SEL
13ef0 45 43 54 20 2b 20 43 41 53 54 20 28 20 2d 20 28  ECT + CAST ( - (
13f00 20 63 6f 6c 30 20 29 20 41 53 20 49 4e 54 45 47   col0 ) AS INTEG
13f10 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  ER ) FROM tab0..
13f20 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a  ----..-24..-35..
13f30 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -89....query I r
13f40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
13f50 20 33 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   35 AS col1 FROM
13f60 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62   tab2, tab1, tab
13f70 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  2 AS cor0, tab1 
13f80 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor1..----..8
13f90 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
13fa0 20 74 6f 20 37 66 62 62 63 32 30 39 36 31 38 62   to 7fbbc209618b
13fb0 66 32 38 37 63 38 31 31 37 32 65 66 32 63 36 31  f287c81172ef2c61
13fc0 37 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7496....query I 
13fd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13fe0 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2b  - ( + col0 ) * +
13ff0 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20   col1 - col0 AS 
14000 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
14010 2d 2d 2d 2d 0d 0a 2d 31 31 32 30 0d 0a 2d 37 30  ----..-1120..-70
14020 34 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20  4..-81....query 
14030 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14040 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31 30 20  T DISTINCT + 10 
14050 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
14060 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 0d 0a 6f  1..----..10....o
14070 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
14080 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
14090 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
140a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
140b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
140c0 74 20 6c 61 62 65 6c 2d 35 38 34 0d 0a 53 45 4c  t label-584..SEL
140d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
140e0 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47  T( + col2 AS SIG
140f0 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
14100 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab2..----..2
14110 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69  6..27..38....ski
14120 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
14130 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
14140 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14150 6c 2d 35 38 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-584..SELECT DI
14160 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 2b 20  STINCT CAST ( + 
14170 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
14180 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
14190 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  ab2..----..26..2
141a0 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..38....query I
141b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
141c0 20 44 49 53 54 49 4e 43 54 20 2d 20 36 38 20 2b   DISTINCT - 68 +
141d0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
141e0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
141f0 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a 2d 35 31 0d  .----..-37..-51.
14200 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-9....query I r
14210 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
14220 4c 4c 20 2d 20 34 20 41 53 20 63 6f 6c 31 20 46  LL - 4 AS col1 F
14230 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
14240 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
14250 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
14260 6f 20 35 37 38 34 35 34 30 61 35 61 66 36 63 61  o 5784540a5af6ca
14270 32 62 65 38 34 33 39 39 64 33 31 34 61 63 64 32  2be84399d314acd2
14280 66 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  fd....query I ro
14290 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
142a0 6c 32 20 2b 20 2d 20 39 37 20 2a 20 2b 20 63 6f  l2 + - 97 * + co
142b0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
142c0 2d 2d 0d 0a 2d 38 33 30 39 0d 0a 2d 38 37 34 35  --..-8309..-8745
142d0 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 73 6b 69 70 69  ..-9408....skipi
142e0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
142f0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
14300 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
14310 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
14320 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
14330 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 39 31  ort..SELECT ( 91
14340 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
14350 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  0, tab1 AS cor0,
14360 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab2 cor1..----
14370 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
14380 69 6e 67 20 74 6f 20 64 65 65 62 62 63 66 62 39  ing to deebbcfb9
14390 63 37 38 30 33 61 33 34 64 63 61 36 62 64 38 36  c7803a34dca6bd86
143a0 30 38 34 39 61 66 65 0d 0a 0d 0a 71 75 65 72 79  0849afe....query
143b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
143c0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
143d0 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 74 61 62 31  r0.col0 * + tab1
143e0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c  .col0 FROM tab1,
143f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
14400 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
14410 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
14420 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 35 37  s hashing to a57
14430 34 37 63 30 31 63 63 35 39 63 37 64 64 36 61 63  47c01cc59c7dd6ac
14440 35 39 63 39 33 36 39 32 39 39 35 35 36 0d 0a 0d  59c9369299556...
14450 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
14460 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
14470 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
14480 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
14490 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
144a0 6f 72 74 20 6c 61 62 65 6c 2d 35 39 30 0d 0a 53  ort label-590..S
144b0 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  ELECT - col0 * c
144c0 6f 6c 30 20 2b 20 43 41 53 54 28 20 2d 20 63 6f  ol0 + CAST( - co
144d0 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l0 AS SIGNED ) A
144e0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
144f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 34 31  ..----..-12..-41
14500 36 30 0d 0a 2d 36 34 38 30 0d 0a 0d 0a 73 6b 69  60..-6480....ski
14510 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
14520 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
14530 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
14540 6c 2d 35 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-590..SELECT - 
14550 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 43 41  col0 * col0 + CA
14560 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20 49  ST ( - col0 AS I
14570 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31  NTEGER ) AS col1
14580 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
14590 0d 0a 2d 31 32 0d 0a 2d 34 31 36 30 0d 0a 2d 36  ..-12..-4160..-6
145a0 34 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  480....query I r
145b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39  owsort..SELECT 9
145c0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
145d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
145e0 2d 0d 0a 39 31 0d 0a 39 31 0d 0a 39 31 0d 0a 0d  -..91..91..91...
145f0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
14600 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
14610 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
14620 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
14630 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
14640 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14650 54 20 32 37 20 63 6f 6c 31 20 46 52 4f 4d 20 74  T 27 col1 FROM t
14660 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
14670 2d 0d 0a 32 37 0d 0a 32 37 0d 0a 32 37 0d 0a 0d  -..27..27..27...
14680 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14690 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
146a0 2a 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  * ( col0 ) FROM 
146b0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a  tab0..----..35..
146c0 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65  7298..792....que
146d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
146e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
146f0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
14700 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  0 FROM tab1, tab
14710 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
14720 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71  7..-31..-59....q
14730 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14740 53 45 4c 45 43 54 20 32 36 20 46 52 4f 4d 20 74  SELECT 26 FROM t
14750 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
14760 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
14770 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64 31  s hashing to 2d1
14780 63 33 31 32 39 65 64 31 37 66 64 37 32 31 64 34  c3129ed17fd721d4
14790 38 37 36 62 32 31 63 30 33 35 35 38 34 0d 0a 0d  876b21c035584...
147a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
147b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
147c0 20 63 6f 6c 30 20 2b 20 2b 20 32 20 46 52 4f 4d   col0 + + 2 FROM
147d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
147e0 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 33 33 0d 0a 2d  ---..-22..-33..-
147f0 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
14800 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
14810 63 6f 6c 30 20 2b 20 28 20 2b 20 63 6f 6c 30 20  col0 + ( + col0 
14820 29 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ) * + col2 + col
14830 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
14840 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14850 2d 0d 0a 37 33 30 30 0d 0a 38 35 34 0d 0a 39 37  -..7300..854..97
14860 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14870 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
14880 6c 32 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20  l2 + ( col0 ) * 
14890 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
148a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
148b0 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37 30  ..----..216..370
148c0 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71 75 65 72 79  5..7776....query
148d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
148e0 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a  CT col2 * col1 *
148f0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
14900 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14910 2d 2d 0d 0a 36 31 31 38 38 34 0d 0a 39 33 36 35  --..611884..9365
14920 34 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..97....skipif 
14930 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
14940 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
14950 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
14960 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
14970 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14980 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20  t..SELECT - + ( 
14990 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2b 20  - cor0.col1 ) + 
149a0 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  - col1 + col2 * 
149b0 2b 20 33 39 20 63 6f 6c 30 20 46 52 4f 4d 20 74  + 39 col0 FROM t
149c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
149d0 2d 0d 0a 31 32 38 37 0d 0a 33 31 39 38 0d 0a 33  -..1287..3198..3
149e0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
149f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39  sort..SELECT - 9
14a00 32 20 2a 20 2d 20 31 32 20 41 53 20 63 6f 6c 31  2 * - 12 AS col1
14a10 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
14a20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 34 0d 0a  r0..----..1104..
14a30 31 31 30 34 0d 0a 31 31 30 34 0d 0a 0d 0a 6f 6e  1104..1104....on
14a40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
14a50 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
14a60 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
14a70 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
14a80 6f 72 74 20 6c 61 62 65 6c 2d 36 30 32 0d 0a 53  ort label-602..S
14a90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
14aa0 20 28 20 32 39 20 29 20 44 49 56 20 63 6f 72 30   ( 29 ) DIV cor0
14ab0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
14ac0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
14ad0 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..9....skipif my
14ae0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
14af0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
14b00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 32 0d  wsort label-602.
14b10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
14b20 20 2b 20 28 20 32 39 20 29 20 2f 20 63 6f 72 30   + ( 29 ) / cor0
14b30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20  .col0 FROM tab1 
14b40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
14b50 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..9....query I r
14b60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
14b70 20 63 6f 6c 32 20 2a 20 39 35 20 2a 20 2d 20 63   col2 * 95 * - c
14b80 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
14b90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
14ba0 38 35 36 30 0d 0a 2d 31 33 33 33 38 30 0d 0a 2d  8560..-133380..-
14bb0 35 34 31 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49  54150....query I
14bc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14bd0 20 2b 20 2b 20 31 20 2b 20 63 6f 6c 32 20 46 52   + + 1 + col2 FR
14be0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
14bf0 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33  .----..27..28..3
14c00 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
14c10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
14c20 30 2e 63 6f 6c 32 20 2b 20 38 35 20 2b 20 2b 20  0.col2 + 85 + + 
14c30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
14c40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d 0a  or0..----..142..
14c50 32 30 36 0d 0a 32 36 31 0d 0a 0d 0a 71 75 65 72  206..261....quer
14c60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14c70 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  ECT - tab2.col1 
14c80 2a 20 2b 20 32 36 20 41 53 20 63 6f 6c 31 20 46  * + 26 AS col1 F
14c90 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
14ca0 2d 31 35 33 34 0d 0a 2d 34 34 32 0d 0a 2d 38 30  -1534..-442..-80
14cb0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
14cc0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
14cd0 6f 6c 31 20 2a 20 36 38 20 46 52 4f 4d 20 74 61  ol1 * 68 FROM ta
14ce0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 34 38 0d  b0..----..-5848.
14cf0 0a 2d 36 31 38 38 0d 0a 2d 36 35 39 36 0d 0a 0d  .-6188..-6596...
14d00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14d10 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
14d20 2d 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  - ( col1 ) AS co
14d30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
14d40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a  0..----..-2064..
14d50 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a  -3395..-8099....
14d60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14d70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
14d80 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 - col1 FROM t
14d90 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a  ab1..----..-20..
14da0 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72  -26..-52....quer
14db0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14dc0 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 30  ECT ALL - ( col0
14dd0 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f   ) + - col2 * co
14de0 6c 31 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l1 - col1 * col1
14df0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
14e00 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 35 38  b0..----..-10258
14e10 0d 0a 2d 31 35 38 33 32 0d 0a 2d 39 35 34 31 0d  ..-15832..-9541.
14e20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14e30 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 20 2a  rt..SELECT - 9 *
14e40 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   + col0 * col1 F
14e50 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
14e60 2d 31 38 35 37 36 0d 0a 2d 33 30 35 35 35 0d 0a  -18576..-30555..
14e70 2d 37 32 38 39 31 0d 0a 0d 0a 71 75 65 72 79 20  -72891....query 
14e80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
14e90 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62  T + col1 + - tab
14ea0 30 2e 63 6f 6c 31 20 2d 20 74 61 62 30 2e 63 6f  0.col1 - tab0.co
14eb0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
14ec0 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38  --..-24..-35..-8
14ed0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
14ee0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
14ef0 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2b   col0 + col2 * +
14f00 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41   col1 * + col1 A
14f10 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
14f20 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33 30 34 0d 0a 33  ..----..16304..3
14f30 36 35 30 37 0d 0a 35 37 36 34 0d 0a 0d 0a 6f 6e  6507..5764....on
14f40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
14f50 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
14f60 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
14f70 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
14f80 6f 72 74 20 6c 61 62 65 6c 2d 36 31 34 0d 0a 53  ort label-614..S
14f90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
14fa0 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 44   - col2 + col1 D
14fb0 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f  IV cor0.col2 FRO
14fc0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
14fd0 2d 2d 2d 2d 0d 0a 33 35 0d 0a 38 33 0d 0a 39 38  ----..35..83..98
14fe0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
14ff0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
15000 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
15010 72 74 20 6c 61 62 65 6c 2d 36 31 34 0d 0a 53 45  rt label-614..SE
15020 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
15030 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20  - col2 + col1 / 
15040 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
15050 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
15060 2d 0d 0a 33 35 0d 0a 38 33 0d 0a 39 38 0d 0a 0d  -..35..83..98...
15070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15080 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
15090 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 + + col2 * col
150a0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
150b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
150c0 2d 0d 0a 32 39 31 39 0d 0a 33 33 31 33 0d 0a 39  -..2919..3313..9
150d0 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  296....query I r
150e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
150f0 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
15100 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
15110 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36  0 cor0..----..86
15120 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  ..91..97....quer
15130 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15140 45 43 54 20 41 4c 4c 20 38 39 20 2a 20 2b 20 63  ECT ALL 89 * + c
15150 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
15160 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31   tab2..----..151
15170 33 0d 0a 32 37 35 39 0d 0a 35 32 35 31 0d 0a 0d  3..2759..5251...
15180 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
15190 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
151a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
151b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
151c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 38  owsort label-618
151d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
151e0 54 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 44  T - ( + col1 ) D
151f0 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
15200 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 73  0..----..-1....s
15210 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
15220 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
15230 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
15240 62 65 6c 2d 36 31 38 0d 0a 53 45 4c 45 43 54 20  bel-618..SELECT 
15250 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63  DISTINCT - ( + c
15260 6f 6c 31 20 29 20 2f 20 63 6f 6c 31 20 46 52 4f  ol1 ) / col1 FRO
15270 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
15280 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
15290 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
152a0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
152b0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
152c0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
152d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
152e0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  LECT + col1 + + 
152f0 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 74 61  tab0.col0 * - ta
15300 62 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f  b0.col2 col2 FRO
15310 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
15320 30 36 0d 0a 2d 37 32 30 37 0d 0a 36 32 0d 0a 0d  06..-7207..62...
15330 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15340 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
15350 6f 6c 30 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f  ol0 + col2 ) FRO
15360 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
15370 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75  1..176..57....qu
15380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15390 45 4c 45 43 54 20 41 4c 4c 20 34 38 20 2a 20 2b  ELECT ALL 48 * +
153a0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
153b0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
153c0 34 34 0d 0a 33 30 37 32 0d 0a 33 38 34 30 0d 0a  44..3072..3840..
153d0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
153e0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
153f0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
15400 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
15410 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
15420 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15430 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 33 36  CT - col2 * + 36
15440 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
15450 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
15460 31 39 34 34 0d 0a 2d 32 30 35 32 0d 0a 2d 33 34  1944..-2052..-34
15470 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
15480 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
15490 63 6f 6c 31 20 2b 20 2d 20 35 30 20 46 52 4f 4d  col1 + - 50 FROM
154a0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
154b0 0d 0a 33 36 0d 0a 34 31 0d 0a 34 37 0d 0a 0d 0a  ..36..41..47....
154c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
154d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
154e0 20 35 39 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20   59 + cor0.col2 
154f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
15500 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 36 0d  0..----..85..86.
15510 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
15520 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
15530 20 34 34 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20   44 + + col0 AS 
15540 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
15550 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a  or0..----..-37..
15560 33 34 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20  34..35....query 
15570 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15580 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 32 20  T DISTINCT - 12 
15590 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
155a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
155b0 0a 2d 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-12....skipif p
155c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
155d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
155e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
155f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
15600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15610 0d 0a 53 45 4c 45 43 54 20 2b 20 33 37 20 2b 20  ..SELECT + 37 + 
15620 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2d 20  + col1 * col2 - 
15630 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  + col0 col0 FROM
15640 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
15650 2d 2d 2d 0d 0a 31 32 30 35 0d 0a 31 34 33 38 0d  ---..1205..1438.
15660 0a 35 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .543....query I 
15670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15680 2d 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  - col1 * cor0.co
15690 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 + col0 FROM t
156a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
156b0 2d 0d 0a 2d 33 36 0d 0a 2d 36 37 33 0d 0a 2d 38  -..-36..-673..-8
156c0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
156d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
156e0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63  ol2 * + col2 + c
156f0 6f 6c 32 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 - col0 AS co
15700 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
15710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 36 37  cor0..----..2967
15720 0d 0a 33 32 34 32 0d 0a 39 32 33 32 0d 0a 0d 0a  ..3242..9232....
15730 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15740 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
15750 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   - col1 + col2 *
15760 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
15770 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
15780 0a 2d 2d 2d 2d 0d 0a 31 36 39 30 0d 0a 31 37 33  .----..1690..173
15790 33 0d 0a 34 31 35 37 0d 0a 0d 0a 71 75 65 72 79  3..4157....query
157a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
157b0 43 54 20 41 4c 4c 20 33 31 20 46 52 4f 4d 20 74  CT ALL 31 FROM t
157c0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 0d 0a 33  ab0..----..31..3
157d0 31 0d 0a 33 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..31....skipif 
157e0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
157f0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
15800 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
15810 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
15820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15830 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
15840 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 63 6f 6c 31  col2 * col1 col1
15850 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
15860 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  r0..----..1248..
15870 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65  1404..570....que
15880 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15890 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
158a0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d 20  col2 * col1 + - 
158b0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
158c0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
158d0 2d 0d 0a 2d 31 32 36 31 0d 0a 2d 31 34 33 30 0d  -..-1261..-1430.
158e0 0a 2d 35 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-580....onlyif 
158f0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
15900 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
15910 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
15920 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15930 61 62 65 6c 2d 36 33 34 0d 0a 53 45 4c 45 43 54  abel-634..SELECT
15940 20 44 49 53 54 49 4e 43 54 20 39 30 20 44 49 56   DISTINCT 90 DIV
15950 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
15960 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15970 2d 2d 0d 0a 31 0d 0a 32 0d 0a 35 0d 0a 0d 0a 73  --..1..2..5....s
15980 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
15990 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
159a0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
159b0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
159c0 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
159d0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
159e0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
159f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 34  owsort label-634
15a00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
15a10 54 20 39 30 20 2f 20 63 6f 6c 31 20 63 6f 6c 32  T 90 / col1 col2
15a20 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
15a30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a  r0..----..1..2..
15a40 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
15a50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15a60 54 49 4e 43 54 20 2b 20 37 34 20 2a 20 2b 20 63  TINCT + 74 * + c
15a70 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol1 + - col2 FRO
15a80 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
15a90 2d 0d 0a 31 38 37 30 0d 0a 36 38 33 0d 0a 38 36  -..1870..683..86
15aa0 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
15ab0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
15ac0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
15ad0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
15ae0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
15af0 2d 36 33 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -636..SELECT ALL
15b00 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30   + col0 DIV col0
15b10 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   + col2 + + cor0
15b20 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
15b30 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
15b40 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 0d 0a 36  .----..165..3..6
15b50 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
15b60 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
15b70 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
15b80 6f 72 74 20 6c 61 62 65 6c 2d 36 33 36 0d 0a 53  ort label-636..S
15b90 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
15ba0 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b   / col0 + col2 +
15bb0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
15bc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
15bd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
15be0 35 0d 0a 33 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72  5..3..67....quer
15bf0 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
15c00 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
15c10 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 57 48   tab2 AS cor0 WH
15c20 45 52 45 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20  ERE NULL NOT IN 
15c30 28 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  ( col0 * - col2 
15c40 2a 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  * - col2 )..----
15c50 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
15c60 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
15c70 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
15c80 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
15c90 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
15ca0 36 33 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  638..SELECT ALL 
15cb0 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20  + col1 DIV col0 
15cc0 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
15cd0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
15ce0 0d 0a 2d 32 33 0d 0a 2d 32 36 0d 0a 2d 33 38 0d  ..-23..-26..-38.
15cf0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
15d00 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
15d10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15d20 74 20 6c 61 62 65 6c 2d 36 33 38 0d 0a 53 45 4c  t label-638..SEL
15d30 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2f  ECT ALL + col1 /
15d40 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 46   col0 + - col2 F
15d50 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15d60 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 36  ..----..-23..-26
15d70 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-38....query I
15d80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15d90 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 74 61   ALL + col1 + ta
15da0 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  b1.col0 AS col1 
15db0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
15dc0 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71  .29..74..93....q
15dd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15de0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15df0 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 74 61  tab2.col2 * + ta
15e00 62 32 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31  b2.col2 + + col1
15e10 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
15e20 0d 0a 31 34 36 31 0d 0a 37 33 35 0d 0a 37 36 30  ..1461..735..760
15e30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15e40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
15e50 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  INCT + col0 * co
15e60 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l2 + - col1 FROM
15e70 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15e80 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36 39 0d 0a  ---..158..1969..
15e90 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2985....query I 
15ea0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15eb0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
15ec0 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  col1 - col1 FROM
15ed0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
15ee0 0d 0a 2d 32 30 0d 0a 2d 32 36 0d 0a 2d 35 32 0d  ..-20..-26..-52.
15ef0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
15f00 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
15f10 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
15f20 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
15f30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
15f40 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  43..SELECT DISTI
15f50 4e 43 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b  NCT + col1 DIV +
15f60 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   cor0.col0 + col
15f70 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
15f80 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 37 38 0d 0a  ..----..11..78..
15f90 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  79....skipif mys
15fa0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
15fb0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
15fc0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 33 0d 0a  sort label-643..
15fd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
15fe0 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 72 30 2e  + col1 / + cor0.
15ff0 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col0 + col0 FROM
16000 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
16010 0d 0a 31 31 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a  ..11..78..79....
16020 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
16030 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
16040 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
16050 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
16060 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 34 0d  wsort label-644.
16070 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16080 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c   cor0.col1 * col
16090 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  1 + + col0 * - c
160a0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol0 + + col2 DIV
160b0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
160c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
160d0 0a 2d 32 36 30 33 0d 0a 2d 35 39 35 32 0d 0a 39  .-2603..-5952..9
160e0 31 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  15....skipif mys
160f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
16100 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
16110 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 34 0d 0a  sort label-644..
16120 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16130 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31  cor0.col1 * col1
16140 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + + col0 * - co
16150 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2b 20  l0 + + col2 / + 
16160 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
16170 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
16180 36 30 33 0d 0a 2d 35 39 35 32 0d 0a 39 31 35 0d  603..-5952..915.
16190 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
161a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
161b0 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  NCT - cor0.col1 
161c0 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
161d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
161e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31  ..----..-119..-1
161f0 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79  73..-98....query
16200 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16210 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31  CT col0 + - col1
16220 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20   + tab0.col1 AS 
16230 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
16240 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
16250 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16260 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
16270 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
16280 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
16290 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
162a0 36 34 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  647..SELECT ALL 
162b0 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20  + col0 DIV col1 
162c0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
162d0 0a 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70  .0..1..4....skip
162e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
162f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16300 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16310 2d 36 34 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -647..SELECT ALL
16320 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 46   + col0 / col1 F
16330 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
16340 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  0..1..4....query
16350 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16360 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
16370 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 30   * col1 + - tab0
16380 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f  .col1 + col0 FRO
16390 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  M tab0..----..73
163a0 33 34 0d 0a 38 32 37 39 0d 0a 39 33 34 37 0d 0a  34..8279..9347..
163b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
163c0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
163d0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a   col0 + + col2 *
163e0 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31   - col0 + - col1
163f0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
16400 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 33 0d  b1..----..-1293.
16410 0a 2d 31 37 39 0d 0a 34 33 38 0d 0a 0d 0a 71 75  .-179..438....qu
16420 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16430 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  ELECT col0 * col
16440 30 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20  0 * - tab2.col0 
16450 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
16460 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 33 0d 0a 2d  2..----..-343..-
16470 34 37 34 35 35 32 0d 0a 2d 34 39 33 30 33 39 0d  474552..-493039.
16480 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16490 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
164a0 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52  * col0 + col0 FR
164b0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
164c0 34 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a  422..224..4680..
164d0 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
164e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
164f0 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32  INCT * FROM tab2
16500 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20   WHERE NOT col1 
16510 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 4e 4f  * - tab2.col0 NO
16520 54 20 49 4e 20 28 20 2b 20 63 6f 6c 32 20 29 0d  T IN ( + col2 ).
16530 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20  .----....skipif 
16540 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
16550 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
16560 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
16570 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
16580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16590 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
165a0 43 54 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 63  CT tab0.col1 + c
165b0 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 * + tab0.col
165c0 30 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20  0 + + col0 col2 
165d0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
165e0 0a 32 31 37 34 0d 0a 33 35 32 37 0d 0a 38 32 37  .2174..3527..827
165f0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
16600 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
16610 32 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20  2 + tab2.col0 * 
16620 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
16630 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32  ..----..6110..62
16640 37 39 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20  79..76....query 
16650 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16660 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
16670 31 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  1.col0 + + col0 
16680 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
16690 0a 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d 0a  .128..160..6....
166a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
166b0 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
166c0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 * + col0 AS 
166d0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
166e0 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
166f0 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  ..8099....query 
16700 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16710 54 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f 6c  T ALL + tab2.col
16720 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  0 * col2 AS col1
16730 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
16740 20 4e 4f 54 20 28 20 2b 20 63 6f 6c 30 20 2a 20   NOT ( + col0 * 
16750 2d 20 63 6f 6c 31 20 29 20 49 4e 20 28 20 74 61  - col1 ) IN ( ta
16760 62 32 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a  b2.col0 + col1 *
16770 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 31   col0 )..----..1
16780 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a  89..2028..3002..
16790 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
167a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
167b0 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41   * + tab1.col1 A
167c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
167d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31  ..----..-100..-1
167e0 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71 75 65 72  69..-676....quer
167f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16800 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ECT col1 * - col
16810 31 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  1 + col2 - col1 
16820 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
16830 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 34 39 0d 0a  0..----..-7449..
16840 2d 38 32 39 30 0d 0a 2d 39 35 30 35 0d 0a 0d 0a  -8290..-9505....
16850 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
16860 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
16870 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
16880 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
16890 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 30 0d  wsort label-660.
168a0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d  .SELECT col2 * -
168b0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2b   col2 * + col0 +
168c0 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31   col0 DIV - col1
168d0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a   + col1 * col1 *
168e0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
168f0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 39 34 32  1..----..-206942
16900 0d 0a 2d 37 33 35 30 38 39 0d 0a 38 38 32 38 0d  ..-735089..8828.
16910 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
16920 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
16930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16940 74 20 6c 61 62 65 6c 2d 36 36 30 0d 0a 53 45 4c  t label-660..SEL
16950 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ECT col2 * - col
16960 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  2 * + col0 + col
16970 30 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  0 / - col1 + col
16980 31 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  1 * col1 * + col
16990 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
169a0 2d 0d 0a 2d 32 30 36 39 34 32 0d 0a 2d 37 33 35  -..-206942..-735
169b0 30 38 39 0d 0a 38 38 32 38 0d 0a 0d 0a 71 75 65  089..8828....que
169c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
169d0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
169e0 32 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 - - cor0.col1 
169f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
16a00 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16a10 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75  .53..9..96....qu
16a20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16a30 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
16a40 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + - col0 * - co
16a50 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l0 * - col0 FROM
16a60 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16a70 2d 2d 2d 0d 0a 2d 33 37 34 0d 0a 2d 34 37 34 36  ---..-374..-4746
16a80 31 31 0d 0a 2d 34 39 33 30 35 36 0d 0a 0d 0a 71  11..-493056....q
16a90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16aa0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16ab0 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  col2 - cor0.col1
16ac0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
16ad0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16ae0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a  0..----..-1305..
16af0 2d 31 39 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 6f  -190..-4576....o
16b00 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
16b10 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
16b20 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
16b30 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
16b40 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 34 0d 0a  sort label-664..
16b50 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
16b60 31 20 44 49 56 20 2d 20 63 6f 6c 32 20 2b 20 2d  1 DIV - col2 + -
16b70 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20   col0 + col2 AS 
16b80 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
16b90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
16ba0 33 31 0d 0a 2d 38 0d 0a 37 0d 0a 0d 0a 73 6b 69  31..-8..7....ski
16bb0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
16bc0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
16bd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16be0 6c 2d 36 36 34 0d 0a 53 45 4c 45 43 54 20 41 4c  l-664..SELECT AL
16bf0 4c 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c  L + col1 / - col
16c00 32 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  2 + - col0 + col
16c10 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
16c20 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
16c30 2d 0d 0a 2d 31 33 31 0d 0a 2d 38 0d 0a 37 0d 0a  -..-131..-8..7..
16c40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16c50 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
16c60 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31  cor0.col0 * col1
16c70 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
16c80 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
16c90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33  0..----..1978..3
16ca0 32 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a 71 75 65  298..8008....que
16cb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16cc0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  LECT + - col0 + 
16cd0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
16ce0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
16cf0 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36  ..----..2..62..6
16d00 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
16d10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
16d20 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b  TINCT + + col1 +
16d30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
16d40 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  1 cor0..----..29
16d50 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72  ..74..93....quer
16d60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16d70 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
16d80 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
16d90 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
16da0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
16db0 0d 0a 2d 31 33 37 0d 0a 2d 33 38 0d 0a 2d 39 36  ..-137..-38..-96
16dc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
16dd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
16de0 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  INCT + col2 * + 
16df0 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
16e00 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l0 * col2 + - co
16e10 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
16e20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
16e30 2d 2d 0d 0a 2d 34 35 36 0d 0a 31 34 34 30 0d 0a  --..-456..1440..
16e40 32 37 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2700....query I 
16e50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16e60 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ALL + col1 * - c
16e70 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol2 + col0 * col
16e80 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
16e90 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
16ea0 2d 0d 0a 2d 36 32 30 0d 0a 33 30 36 38 0d 0a 36  -..-620..3068..6
16eb0 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
16ec0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
16ed0 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  L - cor0.col2 FR
16ee0 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74  OM tab0, tab2, t
16ef0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
16f00 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
16f10 68 69 6e 67 20 74 6f 20 34 34 66 64 63 64 37 63  hing to 44fdcd7c
16f20 64 36 30 33 33 35 32 64 34 64 31 32 37 38 31 31  d603352d4d127811
16f30 64 31 36 34 63 63 31 65 0d 0a 0d 0a 71 75 65 72  d164cc1e....quer
16f40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16f50 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
16f60 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d   + tab2.col1 * -
16f70 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
16f80 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
16f90 31 34 32 32 0d 0a 2d 32 32 34 0d 0a 2d 34 36 38  1422..-224..-468
16fa0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
16fb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
16fc0 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 32 2e 63   col0 + - tab2.c
16fd0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
16fe0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   tab2..----..-20
16ff0 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72  ..41..52....quer
17000 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17010 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 74  ECT + col2 * + t
17020 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  ab0.col1 AS col1
17030 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
17040 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37  ..2838..7462..97
17050 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
17060 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
17070 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col1 * - col2 + 
17080 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53  + col2 * col0 AS
17090 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
170a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
170b0 31 36 34 0d 0a 2d 32 30 34 36 0d 0a 2d 36 32 0d  164..-2046..-62.
170c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
170d0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
170e0 2a 20 63 6f 6c 32 20 2d 20 2d 20 74 61 62 30 2e  * col2 - - tab0.
170f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
17100 2d 2d 2d 2d 0d 0a 31 31 31 33 0d 0a 33 36 0d 0a  ----..1113..36..
17110 36 38 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  6813....onlyif m
17120 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
17130 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
17140 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
17150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17160 62 65 6c 2d 36 37 37 0d 0a 53 45 4c 45 43 54 20  bel-677..SELECT 
17170 2b 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f  + col1 * tab0.co
17180 6c 31 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20  l1 + col0 DIV - 
17190 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
171a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  M tab0..----..73
171b0 39 35 0d 0a 38 32 38 30 0d 0a 39 34 30 38 0d 0a  95..8280..9408..
171c0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
171d0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
171e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
171f0 20 6c 61 62 65 6c 2d 36 37 37 0d 0a 53 45 4c 45   label-677..SELE
17200 43 54 20 2b 20 63 6f 6c 31 20 2a 20 74 61 62 30  CT + col1 * tab0
17210 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f 20 2d  .col1 + col0 / -
17220 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
17230 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab0..----..7
17240 33 39 35 0d 0a 38 32 38 30 0d 0a 39 34 30 38 0d  395..8280..9408.
17250 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17260 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
17270 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
17280 4e 55 4c 4c 20 3c 20 4e 55 4c 4c 0d 0a 2d 2d 2d  NULL < NULL..---
17290 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
172a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
172b0 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  TINCT + col2 * c
172c0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 + - col1 FRO
172d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
172e0 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 31 30 30 33 0d  ----..-96..1003.
172f0 0a 36 36 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .6633....query I
17300 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17310 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 31   ALL + tab1.col1
17320 20 2a 20 2b 20 28 20 36 34 20 29 20 46 52 4f 4d   * + ( 64 ) FROM
17330 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 36   tab1..----..166
17340 34 0d 0a 36 34 30 0d 0a 38 33 32 0d 0a 0d 0a 71  4..640..832....q
17350 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17360 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 74 61  SELECT col0 + ta
17370 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  b1.col2 AS col2 
17380 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
17390 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
173a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
173b0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e  ..SELECT + tab0.
173c0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
173d0 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61  M tab0, tab2, ta
173e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
173f0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
17400 69 6e 67 20 74 6f 20 32 64 36 64 33 30 33 31 64  ing to 2d6d3031d
17410 66 65 39 30 65 30 63 30 32 64 62 31 33 61 61 36  fe90e0c02db13aa6
17420 33 39 39 33 62 66 64 0d 0a 0d 0a 71 75 65 72 79  3993bfd....query
17430 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17440 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
17450 62 30 2e 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63  b0.col1 * tab0.c
17460 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
17470 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
17480 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
17490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
174a0 45 43 54 20 41 4c 4c 20 2d 20 38 20 2b 20 2d 20  ECT ALL - 8 + - 
174b0 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
174c0 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
174d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
174e0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
174f0 67 20 74 6f 20 62 38 66 62 32 39 31 31 36 37 35  g to b8fb2911675
17500 34 39 38 32 36 32 30 62 32 33 62 37 65 31 39 30  4982620b23b7e190
17510 33 65 31 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49  3e177....query I
17520 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17530 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
17540 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
17550 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
17560 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
17570 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 65 31  s hashing to 1e1
17580 66 31 30 39 35 33 65 62 38 65 66 66 65 39 62 32  f10953eb8effe9b2
17590 30 65 37 34 36 66 38 61 37 66 64 38 33 0d 0a 0d  0e746f8a7fd83...
175a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
175b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
175c0 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20  T col1 * col2 * 
175d0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
175e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
175f0 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34 32 31  ----..36480..421
17600 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 71 75 65 72  2..99840....quer
17610 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17620 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ECT cor0.col0 * 
17630 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 46 52  col0 - - col0 FR
17640 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
17650 2d 2d 0d 0a 31 32 36 30 0d 0a 36 30 30 0d 0a 38  --..1260..600..8
17660 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  010....query I r
17670 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
17680 20 32 31 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c   21 + + tab1.col
17690 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
176a0 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  0 cor0 CROSS JOI
176b0 4e 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  N tab1..----..27
176c0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
176d0 74 6f 20 63 33 65 63 61 32 61 66 63 66 65 64 36  to c3eca2afcfed6
176e0 65 61 63 34 34 61 33 33 36 31 63 62 32 64 31 36  eac44a3361cb2d16
176f0 66 64 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  fd0....query I r
17700 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
17710 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63   col1 * col2 * c
17720 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
17730 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32   cor0..----..162
17740 32 34 0d 0a 33 36 35 30 34 0d 0a 35 37 30 30 0d  24..36504..5700.
17750 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17760 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 38 20  rt..SELECT + 58 
17770 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  * + col1 + - col
17780 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
17790 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
177a0 2d 0d 0a 31 34 38 32 0d 0a 35 37 30 0d 0a 37 34  -..1482..570..74
177b0 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
177c0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
177d0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
177e0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
177f0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
17800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17810 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  ELECT cor0.col1 
17820 2a 20 32 38 20 63 6f 6c 30 20 46 52 4f 4d 20 74  * 28 col0 FROM t
17830 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
17840 2d 0d 0a 31 36 35 32 0d 0a 34 37 36 0d 0a 38 36  -..1652..476..86
17850 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
17860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
17870 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
17880 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
17890 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c  7..78..79....onl
178a0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
178b0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
178c0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
178d0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
178e0 72 74 20 6c 61 62 65 6c 2d 36 39 33 0d 0a 53 45  rt label-693..SE
178f0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 44 49 56 20  LECT + col1 DIV 
17900 37 34 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  74 FROM tab2 cor
17910 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
17920 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
17930 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
17940 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
17950 72 74 20 6c 61 62 65 6c 2d 36 39 33 0d 0a 53 45  rt label-693..SE
17960 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2f 20 37 34  LECT + col1 / 74
17970 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
17980 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
17990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
179a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
179b0 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46   * col0 * col1 F
179c0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
179d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d 0a  ..----..-13520..
179e0 2d 32 30 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d 0a  -2028..-6400....
179f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
17a00 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
17a10 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
17a20 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
17a30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 35 0d  wsort label-695.
17a40 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31 31 20 44  .SELECT - - 11 D
17a50 49 56 20 38 37 20 46 52 4f 4d 20 74 61 62 32 20  IV 87 FROM tab2 
17a60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
17a70 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
17a80 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
17a90 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
17aa0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 35 0d  wsort label-695.
17ab0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31 31 20 2f  .SELECT - - 11 /
17ac0 20 38 37 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   87 FROM tab2 co
17ad0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
17ae0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
17af0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
17b00 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20   + - ( + col1 ) 
17b10 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17b20 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
17b30 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a  .-86..-91..-97..
17b40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17b50 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
17b60 37 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  79 AS col1 FROM 
17b70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 0d  tab1..----..-79.
17b80 0a 2d 37 39 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65  .-79..-79....que
17b90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17ba0 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20  LECT - ( col2 ) 
17bb0 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f  * ( + col0 ) FRO
17bc0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
17bd0 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38  ----..-35..-7298
17be0 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  ..-792....query 
17bf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17c00 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  T + + col2 * - c
17c10 6f 6c 32 20 2a 20 31 33 20 2b 20 2b 20 63 6f 6c  ol2 * 13 + + col
17c20 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
17c30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
17c40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32  cor0..----..-162
17c50 32 31 0d 0a 2d 33 34 30 38 0d 0a 2d 39 35 35 31  21..-3408..-9551
17c60 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
17c70 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
17c80 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
17c90 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
17ca0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17cb0 2d 37 30 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -700..SELECT DIS
17cc0 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  TINCT cor0.col1 
17cd0 44 49 56 20 2d 20 33 30 20 63 6f 6c 31 20 46 52  DIV - 30 col1 FR
17ce0 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
17cf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
17d00 0a 2d 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .-3....skipif po
17d10 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
17d20 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
17d30 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
17d40 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
17d50 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17d60 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17d70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17d80 61 62 65 6c 2d 37 30 30 0d 0a 53 45 4c 45 43 54  abel-700..SELECT
17d90 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
17da0 6f 6c 31 20 2f 20 2d 20 33 30 20 63 6f 6c 31 20  ol1 / - 30 col1 
17db0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
17dc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17dd0 32 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79 20 49  2..-3....query I
17de0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17df0 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 41   ALL cor0.col1 A
17e00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
17e10 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
17e20 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
17e30 61 73 68 69 6e 67 20 74 6f 20 63 36 31 64 32 37  ashing to c61d27
17e40 61 30 30 32 32 65 36 64 30 32 32 33 37 31 64 63  a0022e6d022371dc
17e50 35 38 38 31 39 61 62 32 37 32 0d 0a 0d 0a 71 75  58819ab272....qu
17e60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17e70 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 30 20  ELECT tab2.col0 
17e80 2b 20 38 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  + 82 FROM tab2, 
17e90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
17ea0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
17eb0 68 69 6e 67 20 74 6f 20 33 37 66 61 30 63 37 33  hing to 37fa0c73
17ec0 34 63 31 32 66 35 36 63 61 36 61 64 66 64 66 61  4c12f56ca6adfdfa
17ed0 35 63 32 30 37 32 65 30 0d 0a 0d 0a 71 75 65 72  5c2072e0....quer
17ee0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17ef0 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  ECT - col0 * - c
17f00 6f 6c 31 20 2b 20 2b 20 28 20 31 30 20 29 20 2a  ol1 + + ( 10 ) *
17f10 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
17f20 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
17f30 2d 2d 2d 2d 0d 0a 32 39 34 38 0d 0a 34 34 30 30  ----..2948..4400
17f40 0d 0a 39 30 39 38 0d 0a 0d 0a 71 75 65 72 79 20  ..9098....query 
17f50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17f60 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 33  T - ( col2 ) * 3
17f70 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
17f80 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
17f90 2d 0d 0a 2d 32 31 30 36 0d 0a 2d 32 32 32 33 0d  -..-2106..-2223.
17fa0 0a 2d 33 37 34 34 0d 0a 0d 0a 71 75 65 72 79 20  .-3744....query 
17fb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17fc0 54 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b  T ( + col1 ) * +
17fd0 20 32 35 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b   25 + + col2 * +
17fe0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
17ff0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
18000 0a 2d 2d 2d 2d 0d 0a 33 38 39 38 0d 0a 38 30 30  .----..3898..800
18010 35 0d 0a 38 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  5..812....onlyif
18020 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
18030 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
18040 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
18050 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18060 6c 61 62 65 6c 2d 37 30 36 0d 0a 53 45 4c 45 43  label-706..SELEC
18070 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
18080 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c  ol1 * col0 + col
18090 32 20 44 49 56 20 2b 20 28 20 63 6f 6c 30 20 29  2 DIV + ( col0 )
180a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
180b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
180c0 0d 0a 31 33 34 33 0d 0a 32 32 30 0d 0a 34 36 30  ..1343..220..460
180d0 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
180e0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
180f0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18100 6f 72 74 20 6c 61 62 65 6c 2d 37 30 36 0d 0a 53  ort label-706..S
18110 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
18120 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b   - col1 * col0 +
18130 20 63 6f 6c 32 20 2f 20 2b 20 28 20 63 6f 6c 30   col2 / + ( col0
18140 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
18150 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
18160 2d 2d 0d 0a 31 33 34 33 0d 0a 32 32 30 0d 0a 34  --..1343..220..4
18170 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
18180 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18190 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20  LL - - col1 * - 
181a0 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  col2 + col0 + + 
181b0 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a 20  ( cor0.col2 ) * 
181c0 36 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  62 AS col0 FROM 
181d0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
181e0 2d 2d 0d 0a 2d 32 32 38 39 0d 0a 2d 37 36 38 0d  --..-2289..-768.
181f0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
18200 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
18210 4c 20 2b 20 31 34 20 2a 20 63 6f 6c 31 20 41 53  L + 14 * col1 AS
18220 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
18230 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
18240 34 30 0d 0a 31 38 32 0d 0a 33 36 34 0d 0a 0d 0a  40..182..364....
18250 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18260 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
18270 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   + + cor0.col1 A
18280 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
18290 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
182a0 31 37 32 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d  172..182..194...
182b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
182c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
182d0 54 20 2b 20 37 32 20 41 53 20 63 6f 6c 30 20 46  T + 72 AS col0 F
182e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
182f0 0d 0a 2d 2d 2d 2d 0d 0a 37 32 0d 0a 0d 0a 71 75  ..----..72....qu
18300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18310 45 4c 45 43 54 20 31 39 20 41 53 20 63 6f 6c 30  ELECT 19 AS col0
18320 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
18330 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
18340 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
18350 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
18360 38 36 63 35 33 65 38 35 36 37 61 31 37 63 38 64  86c53e8567a17c8d
18370 39 31 66 63 35 61 66 66 31 31 39 65 30 34 39 38  91fc5aff119e0498
18380 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18390 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
183a0 2b 20 33 36 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 36 AS col1 FRO
183b0 4d 20 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72  M tab1, tab0 cor
183c0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
183d0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 65 65  s hashing to eee
183e0 39 36 61 38 35 35 31 39 66 39 32 38 35 36 61 37  96a85519f92856a7
183f0 35 30 30 64 63 38 62 36 63 66 37 35 32 0d 0a 0d  500dc8b6cf752...
18400 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18410 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
18420 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  ( col2 ) FROM ta
18430 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
18440 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37  ..1248..1404..57
18450 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
18460 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
18470 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 28 20 63  1 + - col0 * ( c
18480 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  ol2 ) FROM tab2.
18490 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 39  .----..-158..-19
184a0 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d 0a 71 75 65  69..-2985....que
184b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
184c0 4c 45 43 54 20 2b 20 34 33 20 2a 20 2d 20 34 20  LECT + 43 * - 4 
184d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
184e0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
184f0 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
18500 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
18510 67 20 74 6f 20 64 35 36 31 32 33 61 33 63 64 36  g to d56123a3cd6
18520 38 35 62 34 33 31 66 63 34 36 36 31 64 36 31 31  85b431fc4661d611
18530 37 65 64 66 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7edf2....onlyif 
18540 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
18550 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
18560 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
18570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
18580 61 62 65 6c 2d 37 31 36 0d 0a 53 45 4c 45 43 54  abel-716..SELECT
18590 20 41 4c 4c 20 2b 20 38 31 20 2a 20 63 6f 6c 30   ALL + 81 * col0
185a0 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c   DIV col2 AS col
185b0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
185c0 2d 0d 0a 32 38 33 35 0d 0a 35 38 0d 0a 38 37 0d  -..2835..58..87.
185d0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
185e0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
185f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18600 74 20 6c 61 62 65 6c 2d 37 31 36 0d 0a 53 45 4c  t label-716..SEL
18610 45 43 54 20 41 4c 4c 20 2b 20 38 31 20 2a 20 63  ECT ALL + 81 * c
18620 6f 6c 30 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 / col2 AS co
18630 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
18640 2d 2d 0d 0a 32 38 33 35 0d 0a 35 38 0d 0a 38 37  --..2835..58..87
18650 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18660 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
18670 2d 20 28 20 2b 20 35 32 20 29 20 41 53 20 63 6f  - ( + 52 ) AS co
18680 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
18690 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
186a0 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
186b0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
186c0 68 69 6e 67 20 74 6f 20 39 35 30 30 61 66 65 35  hing to 9500afe5
186d0 36 34 36 64 36 32 30 64 35 65 38 39 34 33 33 35  646d620d5e894335
186e0 31 61 32 39 64 30 38 32 0d 0a 0d 0a 71 75 65 72  1a29d082....quer
186f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18700 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34  ECT DISTINCT - 4
18710 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
18720 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a  ab1..----..-48..
18730 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
18740 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
18750 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
18760 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
18770 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
18780 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18790 43 54 20 2b 20 36 32 20 2a 20 63 6f 6c 30 20 63  CT + 62 * col0 c
187a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
187b0 2d 2d 2d 0d 0a 31 38 36 0d 0a 33 39 36 38 0d 0a  ---..186..3968..
187c0 34 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4960....query I 
187d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
187e0 2d 20 63 6f 6c 32 20 2b 20 37 37 20 46 52 4f 4d  - col2 + 77 FROM
187f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18800 2d 2d 2d 0d 0a 2d 35 0d 0a 34 34 0d 0a 37 36 0d  ---..-5..44..76.
18810 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18820 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
18830 2b 20 2d 20 32 39 20 41 53 20 63 6f 6c 30 20 46  + - 29 AS col0 F
18840 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
18850 35 37 0d 0a 36 32 0d 0a 36 38 0d 0a 0d 0a 71 75  57..62..68....qu
18860 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18870 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
18880 20 63 6f 6c 31 20 2a 20 2d 20 33 30 20 46 52 4f   col1 * - 30 FRO
18890 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
188a0 2d 2d 2d 2d 0d 0a 2d 31 36 39 32 0d 0a 2d 34 33  ----..-1692..-43
188b0 31 0d 0a 2d 39 32 33 0d 0a 0d 0a 71 75 65 72 79  1..-923....query
188c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
188d0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
188e0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col1 + col2 FROM
188f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
18900 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31  ---..-33..-4..21
18910 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18920 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18930 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  INCT - col1 * + 
18940 28 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  ( + col0 * + col
18950 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  1 ) AS col2 FROM
18960 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
18970 0d 0a 2d 31 37 37 35 30 34 0d 0a 2d 33 32 39 33  ..-177504..-3293
18980 31 35 0d 0a 2d 37 33 37 30 30 39 0d 0a 0d 0a 73  15..-737009....s
18990 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
189a0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
189b0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
189c0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
189d0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
189e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
189f0 41 4c 4c 20 2d 20 34 30 20 2b 20 35 34 20 63 6f  ALL - 40 + 54 co
18a00 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
18a10 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b2 AS cor0, tab0
18a20 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
18a30 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
18a40 67 20 74 6f 20 34 30 39 63 31 37 39 30 62 37 30  g to 409c1790b70
18a50 32 35 34 30 64 64 39 64 63 30 36 37 63 31 39 36  2540dd9dc067c196
18a60 35 62 37 63 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  5b7c0....skipif 
18a70 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
18a80 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
18a90 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
18aa0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
18ab0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18ac0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
18ad0 20 2b 20 36 34 20 2a 20 63 6f 6c 31 20 63 6f 6c   + 64 * col1 col
18ae0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
18af0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 39 30 0d  or0..----..5590.
18b00 0a 35 39 31 35 0d 0a 36 33 30 35 0d 0a 0d 0a 71  .5915..6305....q
18b10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18b20 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
18b30 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  * cor0.col2 * co
18b40 72 30 2e 63 6f 6c 31 20 2d 20 63 6f 72 30 2e 63  r0.col1 - cor0.c
18b50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
18b60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 37 39 35  r0..----..119795
18b70 0d 0a 33 32 34 38 30 0d 0a 37 35 37 39 30 0d 0a  ..32480..75790..
18b80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18b90 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 36  t..SELECT ALL 76
18ba0 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   + ( col0 ) FROM
18bb0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
18bc0 0d 0a 31 34 30 0d 0a 31 35 36 0d 0a 37 39 0d 0a  ..140..156..79..
18bd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18be0 74 0d 0a 53 45 4c 45 43 54 20 35 37 20 41 53 20  t..SELECT 57 AS 
18bf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
18c00 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
18c10 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  N tab1 AS cor1..
18c20 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
18c30 61 73 68 69 6e 67 20 74 6f 20 36 31 64 61 37 30  ashing to 61da70
18c40 63 36 32 34 61 64 36 30 36 30 34 61 36 36 38 66  c624ad60604a668f
18c50 37 66 38 66 32 39 33 39 32 61 0d 0a 0d 0a 6f 6e  7f8f29392a....on
18c60 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
18c70 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
18c80 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
18c90 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
18ca0 6f 72 74 20 6c 61 62 65 6c 2d 37 33 30 0d 0a 53  ort label-730..S
18cb0 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 63  ELECT col1 DIV c
18cc0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
18cd0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18ce0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
18cf0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
18d00 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
18d10 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18d20 6f 72 74 20 6c 61 62 65 6c 2d 37 33 30 0d 0a 53  ort label-730..S
18d30 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 63 6f 72  ELECT col1 / cor
18d40 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
18d50 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
18d60 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
18d70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18d80 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
18d90 4e 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20  NCT - tab1.col1 
18da0 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  * - col0 + - col
18db0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
18dc0 2d 0d 0a 31 30 32 37 0d 0a 35 32 0d 0a 36 33 30  -..1027..52..630
18dd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18de0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
18df0 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l1 * - col0 * + 
18e00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
18e10 2d 2d 2d 2d 0d 0a 2d 31 37 37 35 30 34 0d 0a 2d  ----..-177504..-
18e20 33 32 39 33 31 35 0d 0a 2d 37 33 37 30 30 39 0d  329315..-737009.
18e30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18e40 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
18e50 2b 20 2b 20 37 35 20 41 53 20 63 6f 6c 31 20 46  + + 75 AS col1 F
18e60 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
18e70 31 35 33 0d 0a 31 35 34 0d 0a 38 32 0d 0a 0d 0a  153..154..82....
18e80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
18e90 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
18ea0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
18eb0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
18ec0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
18ed0 72 74 20 6c 61 62 65 6c 2d 37 33 34 0d 0a 53 45  rt label-734..SE
18ee0 4c 45 43 54 20 2d 20 43 41 53 54 28 20 63 6f 6c  LECT - CAST( col
18ef0 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  0 AS SIGNED ) + 
18f00 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f  - tab2.col1 * co
18f10 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
18f20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31  tab2..----..-161
18f30 32 0d 0a 2d 37 32 35 0d 0a 2d 38 34 34 0d 0a 0d  2..-725..-844...
18f40 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
18f50 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
18f60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
18f70 6c 61 62 65 6c 2d 37 33 34 0d 0a 53 45 4c 45 43  label-734..SELEC
18f80 54 20 2d 20 43 41 53 54 20 28 20 63 6f 6c 30 20  T - CAST ( col0 
18f90 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
18fa0 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c   tab2.col1 * col
18fb0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
18fc0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 32  ab2..----..-1612
18fd0 0d 0a 2d 37 32 35 0d 0a 2d 38 34 34 0d 0a 0d 0a  ..-725..-844....
18fe0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18ff0 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63 6f  .SELECT + ( + co
19000 6c 31 20 29 20 2b 20 2d 20 38 34 20 41 53 20 63  l1 ) + - 84 AS c
19010 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
19020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 0d  r0..----..13..2.
19030 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .7....query I ro
19040 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
19050 6c 30 20 2a 20 2d 20 35 20 46 52 4f 4d 20 74 61  l0 * - 5 FROM ta
19060 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d  b1..----..-15..-
19070 33 32 30 0d 0a 2d 34 30 30 0d 0a 0d 0a 71 75 65  320..-400....que
19080 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19090 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
190a0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 74 61  col0 * col0 + ta
190b0 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  b0.col0 AS col0 
190c0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
190d0 0a 31 31 38 38 36 30 0d 0a 34 39 35 36 30 0d 0a  .118860..49560..
190e0 37 32 30 39 30 30 0d 0a 0d 0a 71 75 65 72 79 20  720900....query 
190f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19100 54 20 41 4c 4c 20 2d 20 33 33 20 41 53 20 63 6f  T ALL - 33 AS co
19110 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l1 FROM tab1, ta
19120 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
19130 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
19140 74 6f 20 38 30 33 35 63 36 36 35 61 37 35 64 32  to 8035c665a75d2
19150 32 62 65 35 39 32 32 62 65 31 61 34 65 35 37 34  2be5922be1a4e574
19160 65 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  e03....query I r
19170 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
19180 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a   col1 * + col2 *
19190 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52   - ( - col2 ) FR
191a0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36  OM tab0..----..6
191b0 31 31 38 38 34 0d 0a 39 33 36 35 34 0d 0a 39 37  11884..93654..97
191c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
191d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 34  ort..SELECT + 24
191e0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
191f0 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
19200 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
19210 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
19220 68 61 73 68 69 6e 67 20 74 6f 20 61 65 65 61 63  hashing to aeeac
19230 34 33 31 64 32 32 35 32 38 31 38 38 65 38 61 35  431d22528188e8a5
19240 61 32 61 36 30 64 32 64 30 38 30 0d 0a 0d 0a 73  a2a60d2d080....s
19250 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
19260 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
19270 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
19280 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
19290 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
192a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
192b0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
192c0 2d 20 63 6f 6c 30 20 2a 20 39 38 20 63 6f 6c 31  - col0 * 98 col1
192d0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
192e0 0d 0a 2d 31 38 35 32 32 0d 0a 2d 31 39 38 37 34  ..-18522..-19874
192f0 34 0d 0a 2d 32 39 34 31 39 36 0d 0a 0d 0a 71 75  4..-294196....qu
19300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19310 45 4c 45 43 54 20 2d 20 32 31 20 2a 20 63 6f 6c  ELECT - 21 * col
19320 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
19330 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31 36 38 30 0d  -..-1344..-1680.
19340 0a 2d 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-63....query I 
19350 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19360 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f  + tab2.col1 * co
19370 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 * col0 FROM t
19380 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36 35  ab2..----..11965
19390 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d 0a  2..51034..5859..
193a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
193b0 74 0d 0a 53 45 4c 45 43 54 20 36 20 41 53 20 63  t..SELECT 6 AS c
193c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
193d0 2d 2d 2d 0d 0a 36 0d 0a 36 0d 0a 36 0d 0a 0d 0a  ---..6..6..6....
193e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
193f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19400 20 2d 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 46   - + tab2.col0 F
19410 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20  ROM tab2, tab1, 
19420 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
19430 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39  --..-7..-78..-79
19440 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19450 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
19460 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  b0.col2 AS col0 
19470 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
19480 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
19490 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
194a0 74 6f 20 63 38 66 39 66 61 39 65 66 30 66 38 37  to c8f9fa9ef0f87
194b0 30 32 62 64 33 38 32 65 38 32 31 33 37 38 61 39  02bd382e821378a9
194c0 36 64 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  6d8....query I r
194d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
194e0 4c 4c 20 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63  LL col2 + tab2.c
194f0 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol0 - col0 * col
19500 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
19510 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 35 0d  ab2..----..-155.
19520 0a 2d 31 39 32 34 0d 0a 2d 32 38 38 35 0d 0a 0d  .-1924..-2885...
19530 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19540 0d 0a 53 45 4c 45 43 54 20 2d 20 31 37 20 2a 20  ..SELECT - 17 * 
19550 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
19560 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
19570 31 39 0d 0a 2d 31 33 32 36 0d 0a 2d 31 33 34 33  19..-1326..-1343
19580 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19590 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
195a0 49 4e 43 54 20 2d 20 2d 20 32 20 41 53 20 63 6f  INCT - - 2 AS co
195b0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
195c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 0d  cor0..----..2...
195d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
195e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
195f0 54 20 39 37 20 46 52 4f 4d 20 74 61 62 30 2c 20  T 97 FROM tab0, 
19600 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
19610 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32  b0 AS cor1, tab2
19620 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
19630 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
19640 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
19650 4c 20 2b 20 37 37 20 2a 20 63 6f 6c 31 20 46 52  L + 77 * col1 FR
19660 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
19670 0a 2d 2d 2d 2d 0d 0a 31 30 30 31 0d 0a 32 30 30  .----..1001..200
19680 32 0d 0a 37 37 30 0d 0a 0d 0a 71 75 65 72 79 20  2..770....query 
19690 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
196a0 54 20 41 4c 4c 20 2b 20 2b 20 37 36 20 2a 20 2d  T ALL + + 76 * -
196b0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   cor0.col2 + col
196c0 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  0 * col2 AS col2
196d0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
196e0 0a 2d 2d 2d 2d 0d 0a 2d 31 38 36 33 0d 0a 31 31  .----..-1863..11
196f0 34 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  4..52....query I
19700 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19710 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2d 20 2d 20   ALL - col2 - - 
19720 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
19730 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
19740 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a  -..-20..41..52..
19750 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19760 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19770 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63 6f  CT + col1 - - co
19780 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46  r0.col1 * col1 F
19790 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
197a0 0d 0a 2d 2d 2d 2d 0d 0a 37 34 38 32 0d 0a 38 33  ..----..7482..83
197b0 37 32 0d 0a 39 35 30 36 0d 0a 0d 0a 71 75 65 72  72..9506....quer
197c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
197d0 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a  ECT ALL - col1 *
197e0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   - cor0.col1 + c
197f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
19800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 35   cor0..----..355
19810 39 0d 0a 33 36 38 0d 0a 39 36 38 0d 0a 0d 0a 71  9..368..968....q
19820 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19830 53 45 4c 45 43 54 20 2b 20 2b 20 32 35 20 41 53  SELECT + + 25 AS
19840 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
19850 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
19860 35 0d 0a 32 35 0d 0a 32 35 0d 0a 0d 0a 71 75 65  5..25..25....que
19870 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19880 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
19890 2d 20 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  - 2 * + col0 AS 
198a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
198b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
198c0 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 6f 6e  ..156..158....on
198d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
198e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
198f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
19900 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
19910 6f 72 74 20 6c 61 62 65 6c 2d 37 35 38 0d 0a 53  ort label-758..S
19920 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c  ELECT col1 * col
19930 32 20 44 49 56 20 63 6f 6c 31 20 2d 20 2d 20 63  2 DIV col1 - - c
19940 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 44 49 56  ol0 * + col2 DIV
19950 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
19960 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
19970 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a  .171..36..57....
19980 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
19990 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
199a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
199b0 61 62 65 6c 2d 37 35 38 0d 0a 53 45 4c 45 43 54  abel-758..SELECT
199c0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f 20 63   col1 * col2 / c
199d0 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b  ol1 - - col0 * +
199e0 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 41   col2 / + col2 A
199f0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
19a00 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d  ..----..171..36.
19a10 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .57....onlyif my
19a20 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
19a30 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
19a40 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
19a50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19a60 65 6c 2d 37 35 39 0d 0a 53 45 4c 45 43 54 20 32  el-759..SELECT 2
19a70 30 20 44 49 56 20 74 61 62 31 2e 63 6f 6c 32 20  0 DIV tab1.col2 
19a80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19a90 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  1..----..0..0..0
19aa0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
19ab0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
19ac0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
19ad0 72 74 20 6c 61 62 65 6c 2d 37 35 39 0d 0a 53 45  rt label-759..SE
19ae0 4c 45 43 54 20 32 30 20 2f 20 74 61 62 31 2e 63  LECT 20 / tab1.c
19af0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
19b00 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab1..----..0..
19b10 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
19b20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19b30 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b  + ( + col1 ) * +
19b40 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20   col1 + col0 AS 
19b50 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
19b60 2d 2d 2d 2d 0d 0a 37 34 32 30 0d 0a 38 33 37 30  ----..7420..8370
19b70 0d 0a 39 34 34 34 0d 0a 0d 0a 71 75 65 72 79 20  ..9444....query 
19b80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19b90 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62  T DISTINCT + tab
19ba0 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20  1.col2 * col2 - 
19bb0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53  + col1 * col0 AS
19bc0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
19bd0 0a 2d 2d 2d 2d 0d 0a 32 36 30 39 0d 0a 32 38 33  .----..2609..283
19be0 38 0d 0a 38 31 37 36 0d 0a 0d 0a 6f 6e 6c 79 69  8..8176....onlyi
19bf0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
19c00 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
19c10 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
19c20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19c30 20 6c 61 62 65 6c 2d 37 36 32 0d 0a 53 45 4c 45   label-762..SELE
19c40 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 35  CT DISTINCT + 25
19c50 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d 20 31 38   DIV + col0 - 18
19c60 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
19c70 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d  b0..----..-17..-
19c80 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  18....skipif mys
19c90 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
19ca0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
19cb0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36 32 0d 0a  sort label-762..
19cc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
19cd0 2b 20 32 35 20 2f 20 2b 20 63 6f 6c 30 20 2d 20  + 25 / + col0 - 
19ce0 31 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  18 AS col2 FROM 
19cf0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  tab0..----..-17.
19d00 0a 2d 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-18....query I 
19d10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19d20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  - + col2 + + col
19d30 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
19d40 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
19d50 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 71 75 65  -9..34..7....que
19d60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19d70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
19d80 6c 32 20 2a 20 2b 20 32 34 20 41 53 20 63 6f 6c  l2 * + 24 AS col
19d90 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
19da0 2d 0d 0a 31 32 39 36 0d 0a 31 33 36 38 0d 0a 32  -..1296..1368..2
19db0 33 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  304....query I r
19dc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
19dd0 6f 6c 31 20 2a 20 32 33 20 46 52 4f 4d 20 74 61  ol1 * 23 FROM ta
19de0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 37 0d 0a  b2..----..1357..
19df0 33 39 31 0d 0a 37 31 33 0d 0a 0d 0a 71 75 65 72  391..713....quer
19e00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19e10 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
19e20 31 20 2b 20 2d 20 35 35 20 41 53 20 63 6f 6c 31  1 + - 55 AS col1
19e30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
19e40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d  r0..----..-29..-
19e50 34 32 0d 0a 2d 34 35 0d 0a 0d 0a 71 75 65 72 79  42..-45....query
19e60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19e70 43 54 20 41 4c 4c 20 2b 20 37 38 20 41 53 20 63  CT ALL + 78 AS c
19e80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
19e90 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
19ea0 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  0 cor1..----..27
19eb0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
19ec0 74 6f 20 64 38 65 35 65 66 34 64 62 33 34 31 39  to d8e5ef4db3419
19ed0 66 63 32 35 31 65 38 32 63 35 30 62 61 30 34 65  fc251e82c50ba04e
19ee0 30 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  048....query I r
19ef0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
19f00 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72   cor0.col1 * cor
19f10 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  0.col0 + cor0.co
19f20 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
19f30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30  cor0..----..1360
19f40 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71  ..248..4661....q
19f50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19f60 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
19f70 2b 20 36 38 20 2a 20 2b 20 63 6f 6c 30 20 41 53  + 68 * + col0 AS
19f80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
19f90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 35 0d  cor0..----..445.
19fa0 0a 35 32 34 35 0d 0a 35 33 35 35 0d 0a 0d 0a 6f  .5245..5355....o
19fb0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
19fc0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
19fd0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
19fe0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
19ff0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 30 0d 0a  sort label-770..
1a000 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1a010 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20  0 DIV cor0.col2 
1a020 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - + col0 FROM ta
1a030 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1a040 0d 0a 2d 32 34 0d 0a 2d 37 30 0d 0a 2d 39 30 0d  ..-24..-70..-90.
1a050 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1a060 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1a070 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a080 74 20 6c 61 62 65 6c 2d 37 37 30 0d 0a 53 45 4c  t label-770..SEL
1a090 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2f  ECT ALL - col0 /
1a0a0 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20 63   cor0.col2 - + c
1a0b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1a0c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
1a0d0 0d 0a 2d 37 30 0d 0a 2d 39 30 0d 0a 0d 0a 71 75  ..-70..-90....qu
1a0e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a0f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1a100 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( + col1 ) * co
1a110 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
1a120 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1a130 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a  --..-100..-169..
1a140 2d 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -676....query I 
1a150 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a160 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
1a170 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 * col1 FROM ta
1a180 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
1a190 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37  1534..-646..-837
1a1a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a1b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 34 20 2b  ort..SELECT 84 +
1a1c0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
1a1d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1a1e0 0a 31 37 30 0d 0a 31 37 35 0d 0a 31 38 31 0d 0a  .170..175..181..
1a1f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1a200 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1a210 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1a220 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1a230 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37  rowsort label-77
1a240 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  4..SELECT ALL + 
1a250 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 63 6f  col0 DIV col0 co
1a260 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1a270 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
1a280 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..1....skipif po
1a290 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1a2a0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1a2b0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1a2c0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1a2d0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1a2e0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1a2f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1a300 61 62 65 6c 2d 37 37 34 0d 0a 53 45 4c 45 43 54  abel-774..SELECT
1a310 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2f 20 63 6f   ALL + col0 / co
1a320 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
1a330 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1a340 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .1..1..1....quer
1a350 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a360 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT - - cor0.col
1a370 30 20 2a 20 2d 20 39 31 20 46 52 4f 4d 20 74 61  0 * - 91 FROM ta
1a380 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
1a390 32 37 33 0d 0a 2d 35 38 32 34 0d 0a 2d 37 32 38  273..-5824..-728
1a3a0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1a3b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1a3c0 20 2d 20 28 20 33 31 20 29 20 46 52 4f 4d 20 74   - ( 31 ) FROM t
1a3d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1a3e0 2d 0d 0a 2d 33 31 0d 0a 2d 33 31 0d 0a 2d 33 31  -..-31..-31..-31
1a3f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1a400 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1a410 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1a420 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1a430 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1a440 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 37  owsort label-777
1a450 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1a460 54 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 32  T + CAST( - col2
1a470 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
1a480 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1a490 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1a4a0 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a  89..2028..3002..
1a4b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1a4c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1a4d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a4e0 20 6c 61 62 65 6c 2d 37 37 37 0d 0a 53 45 4c 45   label-777..SELE
1a4f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
1a500 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20 49  ST ( - col2 AS I
1a510 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c  NTEGER ) * - col
1a520 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1a530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d 0a  or0..----..189..
1a540 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 6f 6e  2028..3002....on
1a550 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1a560 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1a570 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1a580 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1a590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a5a0 20 6c 61 62 65 6c 2d 37 37 38 0d 0a 53 45 4c 45   label-778..SELE
1a5b0 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT - CAST( NULL 
1a5c0 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2b 20 63  AS DECIMAL ) + c
1a5d0 6f 6c 32 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 / col0 FROM 
1a5e0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
1a5f0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
1a600 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1a610 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1a620 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1a630 61 62 65 6c 2d 37 37 38 0d 0a 53 45 4c 45 43 54  abel-778..SELECT
1a640 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
1a650 53 20 52 45 41 4c 20 29 20 2b 20 63 6f 6c 32 20  S REAL ) + col2 
1a660 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  / col0 FROM tab0
1a670 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1a680 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
1a690 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a6a0 45 43 54 20 2d 20 35 34 20 2a 20 2d 20 63 6f 6c  ECT - 54 * - col
1a6b0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
1a6c0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 36 0d  ab0..----..1296.
1a6d0 0a 31 38 39 30 0d 0a 34 38 30 36 0d 0a 0d 0a 71  .1890..4806....q
1a6e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a6f0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
1a700 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53  - col1 * col1 AS
1a710 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
1a720 0a 2d 2d 2d 2d 0d 0a 2d 37 34 32 30 0d 0a 2d 38  .----..-7420..-8
1a730 33 37 30 0d 0a 2d 39 34 34 34 0d 0a 0d 0a 71 75  370..-9444....qu
1a740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a750 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20  ELECT ALL + ( - 
1a760 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31  col0 ) FROM tab1
1a770 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
1a780 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-80....skipif p
1a790 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1a7a0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1a7b0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1a7c0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1a7d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a7e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1a7f0 54 20 38 38 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  T 88 * + cor0.co
1a800 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
1a810 31 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  1, tab2, tab2 AS
1a820 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 38   cor0..----..228
1a830 38 0d 0a 32 33 37 36 0d 0a 33 33 34 34 0d 0a 0d  8..2376..3344...
1a840 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a850 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
1a860 63 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f  col1 * + tab0.co
1a870 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
1a880 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31  tab0..----..2871
1a890 0d 0a 37 35 34 34 0d 0a 39 38 0d 0a 0d 0a 71 75  ..7544..98....qu
1a8a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a8b0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20  ELECT ALL - ( + 
1a8c0 36 37 20 29 20 2a 20 63 6f 6c 31 20 41 53 20 63  67 ) * col1 AS c
1a8d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1a8e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
1a8f0 34 32 0d 0a 2d 36 37 30 0d 0a 2d 38 37 31 0d 0a  42..-670..-871..
1a900 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a910 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1a920 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 30 20  CT + - ( + col0 
1a930 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  ) FROM tab2 cor0
1a940 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d  ..----..-7..-78.
1a950 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .-79....query II
1a960 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f  IIIIIIIIIIIII ro
1a970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
1a980 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
1a990 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f  AS cor0, tab1 co
1a9a0 72 31 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41  r1, tab2, tab1 A
1a9b0 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36  S cor2..----..36
1a9c0 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
1a9d0 67 20 74 6f 20 33 35 37 30 37 61 64 65 31 33 38  g to 35707ade138
1a9e0 66 65 63 34 62 33 37 30 66 35 31 34 30 61 34 63  fec4b370f5140a4c
1a9f0 64 32 39 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  d2963....onlyif 
1aa00 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1aa10 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1aa20 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1aa30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1aa40 61 62 65 6c 2d 37 38 37 0d 0a 53 45 4c 45 43 54  abel-787..SELECT
1aa50 20 41 4c 4c 20 2d 20 2b 20 38 31 20 44 49 56 20   ALL - + 81 DIV 
1aa60 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  - cor0.col1 AS c
1aa70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1aa80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
1aa90 32 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  2..4....skipif m
1aaa0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1aab0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1aac0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 37  owsort label-787
1aad0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
1aae0 20 38 31 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c   81 / - cor0.col
1aaf0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1ab00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ab10 2d 0d 0a 31 0d 0a 32 0d 0a 34 0d 0a 0d 0a 73 6b  -..1..2..4....sk
1ab20 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1ab30 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1ab40 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1ab50 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1ab60 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1ab70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1ab80 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31  ISTINCT - - col1
1ab90 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 63   + - cor0.col1 c
1aba0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1abb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
1abc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1abd0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
1abe0 20 2b 20 63 6f 6c 31 20 2a 20 32 20 2a 20 2d 20   + col1 * 2 * - 
1abf0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1ac00 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1ac10 2d 2d 2d 2d 0d 0a 2d 31 32 37 35 0d 0a 2d 31 36  ----..-1275..-16
1ac20 34 33 0d 0a 2d 33 30 30 39 0d 0a 0d 0a 71 75 65  43..-3009....que
1ac30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ac40 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 34 37 20  LECT ALL - + 47 
1ac50 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
1ac60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1ac70 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 33 34  ..----..-21..-34
1ac80 0d 0a 2d 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-37....query I
1ac90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1aca0 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2b 20   ALL - - col1 + 
1acb0 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
1acc0 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 * col0 AS col
1acd0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1ace0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 30  or0..----..-1060
1acf0 38 30 0d 0a 2d 31 34 38 38 0d 0a 2d 33 35 38 38  80..-1488..-3588
1ad00 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
1ad10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1ad20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  ( - col2 ) * col
1ad30 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  2 * cor0.col0 AS
1ad40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1ad50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1ad60 30 37 39 33 36 0d 0a 37 33 37 32 38 30 0d 0a 38  07936..737280..8
1ad70 37 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  748....onlyif my
1ad80 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1ad90 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1ada0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1adb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1adc0 65 6c 2d 37 39 33 0d 0a 53 45 4c 45 43 54 20 44  el-793..SELECT D
1add0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 44  ISTINCT + col1 D
1ade0 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  IV col2 AS col0 
1adf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1ae00 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b  0..----..0....sk
1ae10 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1ae20 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1ae30 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1ae40 65 6c 2d 37 39 33 0d 0a 53 45 4c 45 43 54 20 44  el-793..SELECT D
1ae50 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2f  ISTINCT + col1 /
1ae60 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
1ae70 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1ae80 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
1ae90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1aea0 45 43 54 20 32 32 20 2a 20 2b 20 63 6f 6c 32 20  ECT 22 * + col2 
1aeb0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1aec0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30 34 0d 0a 32  0..----..1804..2
1aed0 32 0d 0a 37 32 36 0d 0a 0d 0a 71 75 65 72 79 20  2..726....query 
1aee0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1aef0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
1af00 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 + + col2 * col
1af10 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1af20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d  or0..----..1152.
1af30 0a 31 33 35 30 0d 0a 35 31 33 0d 0a 0d 0a 6f 6e  .1350..513....on
1af40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1af50 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1af60 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1af70 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1af80 6f 72 74 20 6c 61 62 65 6c 2d 37 39 36 0d 0a 53  ort label-796..S
1af90 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 63  ELECT col2 DIV c
1afa0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
1afb0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1afc0 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
1afd0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1afe0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1aff0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b000 61 62 65 6c 2d 37 39 36 0d 0a 53 45 4c 45 43 54  abel-796..SELECT
1b010 20 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 41 53 20   col2 / col2 AS 
1b020 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1b030 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
1b040 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..1....query I
1b050 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b060 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
1b070 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46   + col0 * col2 F
1b080 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1b090 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 33 36 33  ..----..136..363
1b0a0 38 0d 0a 37 36 36 37 0d 0a 0d 0a 73 6b 69 70 69  8..7667....skipi
1b0b0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1b0c0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1b0d0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1b0e0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1b0f0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1b100 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
1b110 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2a 20  col0 ) * col1 * 
1b120 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
1b130 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1b140 2d 0d 0a 31 30 36 30 39 37 0d 0a 31 35 31 39 0d  -..106097..1519.
1b150 0a 33 35 38 39 35 36 0d 0a 0d 0a 71 75 65 72 79  .358956....query
1b160 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b170 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20 38 35 20  CT ALL + ( + 85 
1b180 2a 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31  * col2 ) AS col1
1b190 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1b1a0 0d 0a 32 32 31 30 0d 0a 32 32 39 35 0d 0a 33 32  ..2210..2295..32
1b1b0 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
1b1c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1b1d0 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f 6c 32  col2 * tab2.col2
1b1e0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1b1f0 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32 33 0d 0a  2..----..-1523..
1b200 2d 37 33 36 0d 0a 2d 37 35 34 0d 0a 0d 0a 71 75  -736..-754....qu
1b210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b220 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 35 37  ELECT ALL - - 57
1b230 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
1b240 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
1b250 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d 33  ..----..-171..-3
1b260 36 34 38 0d 0a 2d 34 35 36 30 0d 0a 0d 0a 6f 6e  648..-4560....on
1b270 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1b280 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1b290 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1b2a0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1b2b0 6f 72 74 20 6c 61 62 65 6c 2d 38 30 32 0d 0a 53  ort label-802..S
1b2c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1b2d0 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 44 49 56   col0 + col2 DIV
1b2e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1b2f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
1b300 0d 0a 36 39 0d 0a 38 37 0d 0a 0d 0a 73 6b 69 70  ..69..87....skip
1b310 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1b320 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1b330 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1b340 2d 38 30 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -802..SELECT DIS
1b350 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63  TINCT + col0 + c
1b360 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 / col1 FROM 
1b370 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1b380 2d 2d 0d 0a 35 0d 0a 36 39 0d 0a 38 37 0d 0a 0d  --..5..69..87...
1b390 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b3a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1b3b0 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  1 + col2 * - col
1b3c0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
1b3d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 30  or0..----..-2890
1b3e0 0d 0a 2d 33 32 33 39 0d 0a 2d 39 32 30 33 0d 0a  ..-3239..-9203..
1b3f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b400 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1b410 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  CT + + col0 * + 
1b420 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20  ( col1 ) + col0 
1b430 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1b440 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  2 cor0..----..14
1b450 32 32 0d 0a 32 32 34 0d 0a 34 36 38 30 0d 0a 0d  22..224..4680...
1b460 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1b470 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1b480 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1b490 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1b4a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 35  owsort label-805
1b4b0 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
1b4c0 31 20 2b 20 38 36 20 2a 20 63 6f 72 30 2e 63 6f  1 + 86 * cor0.co
1b4d0 6c 30 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d  l0 DIV col1 FROM
1b4e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1b4f0 2d 2d 2d 0d 0a 2d 31 37 0d 0a 35 31 36 0d 0a 35  ---..-17..516..5
1b500 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  40....skipif mys
1b510 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1b520 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1b530 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 35 0d 0a  sort label-805..
1b540 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
1b550 2b 20 38 36 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  + 86 * cor0.col0
1b560 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   / col1 FROM tab
1b570 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1b580 0a 2d 31 37 0d 0a 35 31 36 0d 0a 35 34 30 0d 0a  .-17..516..540..
1b590 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b5a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1b5b0 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30  CT col1 * - col0
1b5c0 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   + col1 + - col2
1b5d0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1b5e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1b5f0 0d 0a 2d 32 30 31 31 0d 0a 2d 33 32 39 39 0d 0a  ..-2011..-3299..
1b600 2d 38 30 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -8090....skipif 
1b610 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1b620 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1b630 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1b640 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1b650 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b660 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1b670 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2d 20 63 6f  CT - - col0 - co
1b680 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
1b690 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1b6a0 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 6f 6e  .-9..34..7....on
1b6b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1b6c0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1b6d0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1b6e0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1b6f0 6f 72 74 20 6c 61 62 65 6c 2d 38 30 38 0d 0a 53  ort label-808..S
1b700 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 33  ELECT col1 + - 3
1b710 35 20 44 49 56 20 28 20 2d 20 63 6f 6c 30 20 29  5 DIV ( - col0 )
1b720 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1b730 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1b740 0d 0a 31 37 0d 0a 33 36 0d 0a 35 39 0d 0a 0d 0a  ..17..36..59....
1b750 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1b760 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1b770 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b780 61 62 65 6c 2d 38 30 38 0d 0a 53 45 4c 45 43 54  abel-808..SELECT
1b790 20 63 6f 6c 31 20 2b 20 2d 20 33 35 20 2f 20 28   col1 + - 35 / (
1b7a0 20 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   - col0 ) AS col
1b7b0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1b7c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33  or0..----..17..3
1b7d0 36 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  6..59....query I
1b7e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b7f0 20 2b 20 63 6f 6c 31 20 2b 20 34 32 20 41 53 20   + col1 + 42 AS 
1b800 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1b810 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1b820 38 0d 0a 31 33 33 0d 0a 31 33 39 0d 0a 0d 0a 6f  8..133..139....o
1b830 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1b840 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1b850 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1b860 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1b870 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 30 0d 0a  sort label-810..
1b880 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
1b890 44 49 56 20 2b 20 35 34 20 2b 20 31 32 20 46 52  DIV + 54 + 12 FR
1b8a0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
1b8b0 32 0d 0a 31 33 0d 0a 31 33 0d 0a 0d 0a 73 6b 69  2..13..13....ski
1b8c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1b8d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1b8e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b8f0 6c 2d 38 31 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-810..SELECT AL
1b900 4c 20 63 6f 6c 30 20 2f 20 2b 20 35 34 20 2b 20  L col0 / + 54 + 
1b910 31 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  12 FROM tab2..--
1b920 2d 2d 0d 0a 31 32 0d 0a 31 33 0d 0a 31 33 0d 0a  --..12..13..13..
1b930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b940 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
1b950 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * - col1 + + co
1b960 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
1b970 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1b980 0a 31 33 38 31 0d 0a 32 34 34 0d 0a 34 36 32 38  .1381..244..4628
1b990 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b9a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1b9b0 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 30 20  INCT col0 * - 0 
1b9c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1b9d0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
1b9e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b9f0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
1ba00 6f 6c 32 20 2b 20 2d 20 28 20 38 20 29 20 41 53  ol2 + - ( 8 ) AS
1ba10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1ba20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
1ba30 36 0d 0a 34 39 0d 0a 38 38 0d 0a 0d 0a 6f 6e 6c  6..49..88....onl
1ba40 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1ba50 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1ba60 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1ba70 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1ba80 72 74 20 6c 61 62 65 6c 2d 38 31 34 0d 0a 53 45  rt label-814..SE
1ba90 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  LECT + - col1 * 
1baa0 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49  col1 + + col2 DI
1bab0 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  V col1 FROM tab0
1bac0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1bad0 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39  -7396..-8281..-9
1bae0 34 30 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  409....skipif my
1baf0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1bb00 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1bb10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 34 0d  wsort label-814.
1bb20 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31  .SELECT + - col1
1bb30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   * col1 + + col2
1bb40 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   / col1 FROM tab
1bb50 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1bb60 0a 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d  .-7396..-8281..-
1bb70 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9409....query I 
1bb80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1bb90 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d  ALL + - col1 * -
1bba0 20 31 39 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d   19 - - col2 * -
1bbb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1bbc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1bbd0 31 32 30 34 0d 0a 2d 35 37 33 33 0d 0a 31 37 34  1204..-5733..174
1bbe0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
1bbf0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1bc00 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1bc10 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1bc20 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1bc30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1bc40 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 35 33 20  ELECT col1 + 53 
1bc50 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  * + col1 col1 FR
1bc60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1bc70 0a 2d 2d 2d 2d 0d 0a 31 36 37 34 0d 0a 33 31 38  .----..1674..318
1bc80 36 0d 0a 39 31 38 0d 0a 0d 0a 71 75 65 72 79 20  6..918....query 
1bc90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bca0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
1bcb0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  + col0 * col0 + 
1bcc0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
1bcd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1bce0 0d 0a 2d 2d 2d 2d 0d 0a 36 31 38 38 0d 0a 36 33  ..----..6188..63
1bcf0 35 38 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20  58..83....query 
1bd00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bd10 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
1bd20 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63  ol1 * + col1 * c
1bd30 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
1bd40 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1bd50 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35 39 34  ---..10982..2594
1bd60 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72  7..90506....quer
1bd70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1bd80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1bd90 6f 6c 30 20 2b 20 2b 20 32 30 20 2a 20 2b 20 63  ol0 + + 20 * + c
1bda0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
1bdb0 2d 2d 2d 0d 0a 31 30 38 33 0d 0a 31 32 30 34 0d  ---..1083..1204.
1bdc0 0a 32 30 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .2000....query I
1bdd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bde0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
1bdf0 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   * - cor0.col1 +
1be00 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f   col2 * col2 FRO
1be10 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
1be20 2d 0d 0a 31 35 31 32 0d 0a 32 36 37 39 0d 0a 37  -..1512..2679..7
1be30 39 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  968....query I r
1be40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34  owsort..SELECT 4
1be50 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
1be60 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 34 32 0d 0a  ..----..42..42..
1be70 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  42....query I ro
1be80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1be90 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 74 61  l1 * - col1 * ta
1bea0 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  b0.col1 AS col2 
1beb0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1bec0 0a 2d 36 33 36 30 35 36 0d 0a 2d 37 35 33 35 37  .-636056..-75357
1bed0 31 0d 0a 2d 39 31 32 36 37 33 0d 0a 0d 0a 71 75  1..-912673....qu
1bee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1bef0 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  ELECT - tab2.col
1bf00 32 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  2 * + col1 * + c
1bf10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
1bf20 2d 2d 2d 0d 0a 2d 31 30 39 38 32 0d 0a 2d 32 35  ---..-10982..-25
1bf30 39 34 37 0d 0a 2d 39 30 35 30 36 0d 0a 0d 0a 71  947..-90506....q
1bf40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1bf50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1bf60 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 35 34  col0 + col1 * 54
1bf70 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41   + - tab2.col1 A
1bf80 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1bf90 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 30 0d 0a 33 32  ..----..1650..32
1bfa0 30 35 0d 0a 39 38 30 0d 0a 0d 0a 73 6b 69 70 69  05..980....skipi
1bfb0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1bfc0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1bfd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bfe0 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 20  T DISTINCT CAST 
1bff0 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ( + cor0.col0 * 
1c000 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 52  - cor0.col0 AS R
1c010 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 31 2c  EAL ) FROM tab1,
1c020 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1c030 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36  ---..-1225..-576
1c040 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79  ..-7921....query
1c050 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c060 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
1c070 20 2a 20 37 33 20 2b 20 74 61 62 31 2e 63 6f 6c   * 73 + tab1.col
1c080 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  0 * col2 AS col1
1c090 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1c0a0 0d 0a 31 34 36 38 38 0d 0a 34 31 30 34 0d 0a 37  ..14688..4104..7
1c0b0 38 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  809....query I r
1c0c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1c0d0 20 63 6f 6c 31 20 2a 20 2d 20 38 36 20 2b 20 2b   col1 * - 86 + +
1c0e0 20 38 34 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f   84 * + col1 FRO
1c0f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  M tab0..----..14
1c100 36 32 30 0d 0a 31 35 34 37 30 0d 0a 31 36 34 39  620..15470..1649
1c110 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1c120 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1c130 20 2d 20 37 20 41 53 20 63 6f 6c 32 20 46 52 4f   - 7 AS col2 FRO
1c140 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
1c150 0d 0a 2d 37 0d 0a 2d 37 0d 0a 0d 0a 71 75 65 72  ..-7..-7....quer
1c160 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c170 45 43 54 20 2b 20 37 33 20 46 52 4f 4d 20 74 61  ECT + 73 FROM ta
1c180 62 30 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41  b0, tab1, tab2 A
1c190 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
1c1a0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1c1b0 74 6f 20 33 39 33 33 61 39 30 36 64 31 37 61 38  to 3933a906d17a8
1c1c0 32 30 63 63 66 39 35 34 36 37 65 32 32 30 36 64  20ccf95467e2206d
1c1d0 66 38 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  f8f....query I r
1c1e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1c1f0 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 38 37 20  or0.col2 * + 87 
1c200 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1c210 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1c220 0a 32 32 36 32 0d 0a 32 33 34 39 0d 0a 33 33 30  .2262..2349..330
1c230 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
1c240 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1c250 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1c260 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1c270 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1c280 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33  rowsort label-83
1c290 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  1..SELECT col2 *
1c2a0 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
1c2b0 20 44 45 43 49 4d 41 4c 20 29 20 2a 20 28 20 63   DECIMAL ) * ( c
1c2c0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
1c2d0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1c2e0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1c2f0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
1c300 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1c310 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1c320 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 31  owsort label-831
1c330 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
1c340 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
1c350 20 52 45 41 4c 20 29 20 2a 20 28 20 63 6f 6c 30   REAL ) * ( col0
1c360 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
1c370 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
1c380 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
1c390 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
1c3a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1c3b0 6f 6c 30 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c  ol0 + - tab0.col
1c3c0 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 + col1 FROM ta
1c3d0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 37  b0..----..131..7
1c3e0 37 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  7..98....query I
1c3f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c400 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   - col0 * + col0
1c410 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + + col2 * col1
1c420 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1c430 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 32 36 0d  b1..----..-3526.
1c440 0a 2d 35 31 35 32 0d 0a 31 33 39 35 0d 0a 0d 0a  .-5152..1395....
1c450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c460 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
1c470 20 63 6f 6c 31 20 2b 20 2b 20 34 31 20 41 53 20   col1 + + 41 AS 
1c480 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
1c490 2d 2d 2d 2d 0d 0a 31 30 30 32 0d 0a 33 33 30 0d  ----..1002..330.
1c4a0 0a 33 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .3522....query I
1c4b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c4c0 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e 63   DISTINCT tab0.c
1c4d0 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 * col0 AS co
1c4e0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
1c4f0 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d 0a 37  --..1225..576..7
1c500 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  921....query I r
1c510 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1c520 49 53 54 49 4e 43 54 20 2b 20 33 30 20 41 53 20  ISTINCT + 30 AS 
1c530 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
1c540 2d 2d 2d 2d 0d 0a 33 30 0d 0a 0d 0a 71 75 65 72  ----..30....quer
1c550 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c560 45 43 54 20 2b 20 28 20 2b 20 33 31 20 29 20 46  ECT + ( + 31 ) F
1c570 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
1c580 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
1c590 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1c5a0 6f 20 64 31 65 62 64 31 63 65 61 34 61 39 37 37  o d1ebd1cea4a977
1c5b0 33 30 36 39 61 66 33 34 66 62 66 38 65 61 33 35  3069af34fbf8ea35
1c5c0 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  40....onlyif mys
1c5d0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1c5e0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1c5f0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1c600 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1c610 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1c620 33 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  38..SELECT - col
1c630 31 20 2a 20 2b 20 43 41 53 54 28 20 2b 20 63 6f  1 * + CAST( + co
1c640 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47  l2 + col0 AS SIG
1c650 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
1c660 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1c670 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 34 0d 0a 2d 31  .----..-1054..-1
1c680 39 38 39 0d 0a 2d 36 31 33 36 0d 0a 0d 0a 73 6b  989..-6136....sk
1c690 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1c6a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1c6b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1c6c0 65 6c 2d 38 33 38 0d 0a 53 45 4c 45 43 54 20 2d  el-838..SELECT -
1c6d0 20 63 6f 6c 31 20 2a 20 2b 20 43 41 53 54 20 28   col1 * + CAST (
1c6e0 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41   + col2 + col0 A
1c6f0 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63  S INTEGER ) AS c
1c700 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1c710 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
1c720 35 34 0d 0a 2d 31 39 38 39 0d 0a 2d 36 31 33 36  54..-1989..-6136
1c730 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c740 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1c750 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  - cor0.col2 * + 
1c760 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
1c770 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1c780 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34  ----..-1534..-64
1c790 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79  6..-837....query
1c7a0 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
1c7b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c7c0 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31   ALL * FROM tab1
1c7d0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
1c7e0 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
1c7f0 6f 72 31 2c 20 74 61 62 32 2c 20 74 61 62 30 20  or1, tab2, tab0 
1c800 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
1c810 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
1c820 6e 67 20 74 6f 20 37 36 64 65 31 38 63 35 62 66  ng to 76de18c5bf
1c830 32 63 66 32 36 32 30 65 31 66 34 31 31 64 37 62  2cf2620e1f411d7b
1c840 64 65 38 36 65 37 0d 0a 0d 0a 71 75 65 72 79 20  de86e7....query 
1c850 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c860 54 20 63 6f 6c 31 20 2a 20 2b 20 36 31 20 41 53  T col1 * + 61 AS
1c870 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
1c880 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1c890 30 33 37 0d 0a 31 38 39 31 0d 0a 33 35 39 39 0d  037..1891..3599.
1c8a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c8b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1c8c0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41   col1 * - col1 A
1c8d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
1c8e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c8f0 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39  -7396..-8281..-9
1c900 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
1c910 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1c920 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
1c930 20 2d 20 31 34 20 46 52 4f 4d 20 74 61 62 32 20   - 14 FROM tab2 
1c940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1c950 31 30 39 32 0d 0a 2d 31 31 30 36 0d 0a 2d 39 38  1092..-1106..-98
1c960 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1c970 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
1c980 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 39   + cor0.col1 * 9
1c990 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  5 AS col1 FROM t
1c9a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1c9b0 2d 0d 0a 31 30 30 37 0d 0a 31 33 33 31 0d 0a 32  -..1007..1331..2
1c9c0 35 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  524....query I r
1c9d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1c9e0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
1c9f0 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f   tab2.col0 AS co
1ca00 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
1ca10 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a  --..-49..-6084..
1ca20 2d 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -6241....query I
1ca30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ca40 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 30   ALL + tab1.col0
1ca50 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   * col2 * - col2
1ca60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1ca70 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33  b1..----..-20793
1ca80 36 0d 0a 2d 37 33 37 32 38 30 0d 0a 2d 38 37 34  6..-737280..-874
1ca90 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
1caa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1cab0 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63   col2 * col1 + c
1cac0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20  ol1 + + col1 AS 
1cad0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 57  col2 FROM tab0 W
1cae0 48 45 52 45 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  HERE - col2 * co
1caf0 6c 32 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f  l2 + col0 / + co
1cb00 6c 32 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f  l2 NOT IN ( + co
1cb10 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 29 0d 0a 2d  l1 * + col1 )..-
1cb20 2d 2d 2d 0d 0a 32 39 31 0d 0a 33 30 31 30 0d 0a  ---..291..3010..
1cb30 37 36 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7644....query I 
1cb40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cb50 41 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20  ALL - tab1.col1 
1cb60 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  * - tab1.col2 FR
1cb70 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
1cb80 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a  248..1404..570..
1cb90 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
1cba0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1cbb0 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52  * FROM tab1 WHER
1cbc0 45 20 4e 4f 54 20 63 6f 6c 31 20 2b 20 2b 20 63  E NOT col1 + + c
1cbd0 6f 6c 30 20 2a 20 63 6f 6c 31 20 4e 4f 54 20 49  ol0 * col1 NOT I
1cbe0 4e 20 28 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d  N ( col1 )..----
1cbf0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cc00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1cc10 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 * - col2 AS c
1cc20 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
1cc30 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
1cc40 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
1cc50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1cc60 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
1cc70 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 63   - tab1.col1 * c
1cc80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
1cc90 2d 2d 2d 0d 0a 31 33 35 32 30 0d 0a 32 30 32 38  ---..13520..2028
1cca0 0d 0a 36 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20  ..6400....query 
1ccb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ccc0 54 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  T col1 FROM tab1
1ccd0 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20   WHERE NOT NULL 
1cce0 3d 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d  = ( NULL )..----
1ccf0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1cd00 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1cd10 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1cd20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1cd30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1cd40 38 35 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  853..SELECT col2
1cd50 20 44 49 56 20 74 61 62 31 2e 63 6f 6c 30 20 2b   DIV tab1.col0 +
1cd60 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
1cd70 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1cd80 0a 2d 33 36 0d 0a 2d 35 37 0d 0a 2d 39 35 0d 0a  .-36..-57..-95..
1cd90 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1cda0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1cdb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cdc0 20 6c 61 62 65 6c 2d 38 35 33 0d 0a 53 45 4c 45   label-853..SELE
1cdd0 43 54 20 63 6f 6c 32 20 2f 20 74 61 62 31 2e 63  CT col2 / tab1.c
1cde0 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 + - col2 AS 
1cdf0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
1ce00 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a  ----..-36..-57..
1ce10 2d 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -95....query I r
1ce20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1ce30 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 74 61  LL + col2 * - ta
1ce40 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
1ce50 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a  1..----..-1248..
1ce60 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71  -1404..-570....q
1ce70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ce80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ce90 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 74 61  tab1.col1 * - ta
1cea0 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b1.col0 FROM tab
1ceb0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a  1..----..-1040..
1cec0 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65  -640..-78....que
1ced0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1cee0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1cef0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45  l0 FROM tab2 WHE
1cf00 52 45 20 28 20 4e 55 4c 4c 20 29 20 3e 20 28 20  RE ( NULL ) > ( 
1cf10 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 29 0d  - col2 * col0 ).
1cf20 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
1cf30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1cf40 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 32 20 41   ALL tab1.col2 A
1cf50 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1cf60 20 57 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c   WHERE NOT + col
1cf70 32 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  2 + + col2 + col
1cf80 30 20 2a 20 2b 20 63 6f 6c 32 20 3c 3d 20 28 20  0 * + col2 <= ( 
1cf90 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  NULL )..----....
1cfa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1cfb0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
1cfc0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41   - col1 + col2 A
1cfd0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
1cfe0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d  ..----..-1152..-
1cff0 31 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 71 75  1350..-513....qu
1d000 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d010 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63  ELECT + col1 * c
1d020 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b  ol0 + + col2 * +
1d030 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1d040 0a 2d 2d 2d 2d 0d 0a 31 30 35 34 0d 0a 31 39 38  .----..1054..198
1d050 39 0d 0a 36 31 33 36 0d 0a 0d 0a 71 75 65 72 79  9..6136....query
1d060 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d070 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1d080 6c 32 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31  l2 + + tab1.col1
1d090 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1d0a0 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d  ..-28..-47..-83.
1d0b0 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
1d0c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1d0d0 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45   * FROM tab2 WHE
1d0e0 52 45 20 4e 55 4c 4c 20 3e 20 63 6f 6c 31 0d 0a  RE NULL > col1..
1d0f0 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ----....skipif p
1d100 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1d110 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1d120 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1d130 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1d140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d150 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e  ..SELECT + tab0.
1d160 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
1d170 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  ab0..----..24..3
1d180 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..89....query I
1d190 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1d1a0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57  CT * FROM tab2 W
1d1b0 48 45 52 45 20 4e 55 4c 4c 20 3e 20 63 6f 6c 32  HERE NULL > col2
1d1c0 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
1d1d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d1e0 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 63  T ALL - col1 + c
1d1f0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63  ol0 * col1 * - c
1d200 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
1d210 2d 2d 2d 0d 0a 2d 31 33 35 33 33 0d 0a 2d 32 30  ---..-13533..-20
1d220 35 34 0d 0a 2d 36 34 31 30 0d 0a 0d 0a 6f 6e 6c  54..-6410....onl
1d230 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1d240 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1d250 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1d260 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1d270 72 74 20 6c 61 62 65 6c 2d 38 36 35 0d 0a 53 45  rt label-865..SE
1d280 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 74 61  LECT col1 DIV ta
1d290 62 32 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46  b2.col1 - col1 F
1d2a0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
1d2b0 2d 31 36 0d 0a 2d 33 30 0d 0a 2d 35 38 0d 0a 0d  -16..-30..-58...
1d2c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1d2d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1d2e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1d2f0 6c 61 62 65 6c 2d 38 36 35 0d 0a 53 45 4c 45 43  label-865..SELEC
1d300 54 20 63 6f 6c 31 20 2f 20 74 61 62 32 2e 63 6f  T col1 / tab2.co
1d310 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 - col1 FROM t
1d320 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a  ab2..----..-16..
1d330 2d 33 30 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72  -30..-58....quer
1d340 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d350 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b  ECT ALL col0 * +
1d360 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 2d   col0 - col2 * -
1d370 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
1d380 0a 2d 2d 2d 2d 0d 0a 31 34 31 33 0d 0a 34 36 36  .----..1413..466
1d390 36 0d 0a 37 36 34 38 0d 0a 0d 0a 6f 6e 6c 79 69  6..7648....onlyi
1d3a0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1d3b0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1d3c0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1d3d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d3e0 20 6c 61 62 65 6c 2d 38 36 37 0d 0a 53 45 4c 45   label-867..SELE
1d3f0 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20  CT - col2 DIV + 
1d400 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20 63  col0 - col1 AS c
1d410 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
1d420 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 34 0d 0a 2d  ---..-17..-34..-
1d430 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  59....skipif mys
1d440 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1d450 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1d460 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 37 0d 0a  sort label-867..
1d470 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20  SELECT - col2 / 
1d480 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53  + col0 - col1 AS
1d490 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
1d4a0 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 34 0d  .----..-17..-34.
1d4b0 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-59....query I 
1d4c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d4d0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 2b 20  col0 * col1 * + 
1d4e0 33 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  34 FROM tab2 AS 
1d4f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 34  cor0..----..1564
1d500 36 38 0d 0a 34 35 36 36 32 0d 0a 37 33 37 38 0d  68..45662..7378.
1d510 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d520 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1d530 20 38 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   83 AS col2 FROM
1d540 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1d550 2d 2d 2d 0d 0a 38 33 0d 0a 38 33 0d 0a 38 33 0d  ---..83..83..83.
1d560 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d570 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1d580 4e 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  NCT col2 + - col
1d590 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1d5a0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1d5b0 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75  -7..16..51....qu
1d5c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d5d0 45 4c 45 43 54 20 2d 20 2b 20 28 20 2d 20 63 6f  ELECT - + ( - co
1d5e0 6c 30 20 29 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l0 ) + col2 * + 
1d5f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1d600 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
1d610 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d  5..3712..7760...
1d620 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1d630 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1d640 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1d650 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1d660 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1d670 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d680 54 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  T col2 + cor0.co
1d690 6c 30 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20 46  l0 * col0 col1 F
1d6a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1d6b0 0d 0a 2d 2d 2d 2d 0d 0a 34 31 35 33 0d 0a 36 33  ..----..4153..63
1d6c0 0d 0a 36 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20  ..6496....query 
1d6d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d6e0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72  T DISTINCT + cor
1d6f0 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  0.col2 * + cor0.
1d700 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1d710 4d 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72  M tab1, tab2 cor
1d720 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36  0..----..1444..6
1d730 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79  76..729....query
1d740 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d750 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32  CT col2 + + col2
1d760 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
1d770 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1d780 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d  or0..----..1560.
1d790 0a 36 38 34 0d 0a 38 36 34 0d 0a 0d 0a 73 6b 69  .684..864....ski
1d7a0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1d7b0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1d7c0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1d7d0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1d7e0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1d7f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1d800 6c 31 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 2a  l1 * tab1.col1 *
1d810 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
1d820 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 30  tab1..----..1000
1d830 0d 0a 31 37 35 37 36 0d 0a 32 31 39 37 0d 0a 0d  ..17576..2197...
1d840 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
1d850 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1d860 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  NCT * FROM tab2 
1d870 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e  WHERE NOT NULL N
1d880 4f 54 20 49 4e 20 28 20 63 6f 6c 30 20 2a 20 63  OT IN ( col0 * c
1d890 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol1 )..----....q
1d8a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d8b0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
1d8c0 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 * + col0 AS co
1d8d0 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
1d8e0 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a  --..2064..3395..
1d8f0 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
1d900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d910 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 37 38 20  + ( col0 ) * 78 
1d920 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1d930 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34  2 cor0..----..54
1d940 36 0d 0a 36 30 38 34 0d 0a 36 31 36 32 0d 0a 0d  6..6084..6162...
1d950 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1d960 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1d970 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1d980 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1d990 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37 39  owsort label-879
1d9a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1d9b0 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 44 49 56  ol1 - - col2 DIV
1d9c0 20 43 41 53 54 28 20 63 6f 6c 30 20 2b 20 63 6f   CAST( col0 + co
1d9d0 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  l0 AS SIGNED ) F
1d9e0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
1d9f0 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d  -86..-91..-97...
1da00 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1da10 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1da20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1da30 6c 61 62 65 6c 2d 38 37 39 0d 0a 53 45 4c 45 43  label-879..SELEC
1da40 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2d 20 2d  T ALL - col1 - -
1da50 20 63 6f 6c 32 20 2f 20 43 41 53 54 20 28 20 63   col2 / CAST ( c
1da60 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e  ol0 + col0 AS IN
1da70 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
1da80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39  0..----..-86..-9
1da90 31 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  1..-97....onlyif
1daa0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1dab0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1dac0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1dad0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1dae0 6c 61 62 65 6c 2d 38 38 30 0d 0a 53 45 4c 45 43  label-880..SELEC
1daf0 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T + col2 * - col
1db00 30 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 31 20  0 + ( cor0.col1 
1db10 29 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f  ) DIV + col0 FRO
1db20 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1db30 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 37 32 39 37  ----..-33..-7297
1db40 0d 0a 2d 37 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..-789....skipif
1db50 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1db60 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1db70 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1db80 38 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  80..SELECT + col
1db90 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 28 20 63  2 * - col0 + ( c
1dba0 6f 72 30 2e 63 6f 6c 31 20 29 20 2f 20 2b 20 63  or0.col1 ) / + c
1dbb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1dbc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33   cor0..----..-33
1dbd0 0d 0a 2d 37 32 39 37 0d 0a 2d 37 38 39 0d 0a 0d  ..-7297..-789...
1dbe0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1dbf0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1dc00 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1dc10 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1dc20 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1dc30 6f 72 74 20 6c 61 62 65 6c 2d 38 38 31 0d 0a 53  ort label-881..S
1dc40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1dc50 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
1dc60 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20  IGNED ) AS col0 
1dc70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1dc80 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
1dc90 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
1dca0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1dcb0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1dcc0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1dcd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38  rowsort label-88
1dce0 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
1dcf0 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT - CAST ( NULL
1dd00 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
1dd10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1dd20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
1dd30 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  IN tab0 AS cor1.
1dd40 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
1dd50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1dd60 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32 38 20  SELECT ALL + 28 
1dd70 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
1dd80 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1dd90 31 37 39 32 0d 0a 32 32 34 30 0d 0a 38 34 0d 0a  1792..2240..84..
1dda0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1ddb0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1ddc0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1ddd0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1dde0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1ddf0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 33 0d 0a  sort label-883..
1de00 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
1de10 6c 31 20 2d 20 63 6f 6c 32 20 2f 20 43 41 53 54  l1 - col2 / CAST
1de20 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
1de30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
1de40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
1de50 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
1de60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1de70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1de80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1de90 61 62 65 6c 2d 38 38 33 0d 0a 53 45 4c 45 43 54  abel-883..SELECT
1dea0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 63   - cor0.col1 - c
1deb0 6f 6c 32 20 2f 20 43 41 53 54 20 28 20 4e 55 4c  ol2 / CAST ( NUL
1dec0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
1ded0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1dee0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1def0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
1df00 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1df10 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1df20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1df30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1df40 74 20 6c 61 62 65 6c 2d 38 38 34 0d 0a 53 45 4c  t label-884..SEL
1df50 45 43 54 20 37 35 20 44 49 56 20 2d 20 63 6f 72  ECT 75 DIV - cor
1df60 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
1df70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1df80 2d 31 0d 0a 2d 32 35 0d 0a 30 0d 0a 0d 0a 73 6b  -1..-25..0....sk
1df90 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1dfa0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1dfb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1dfc0 65 6c 2d 38 38 34 0d 0a 53 45 4c 45 43 54 20 37  el-884..SELECT 7
1dfd0 35 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  5 / - cor0.col0 
1dfe0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1dff0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 35  0..----..-1..-25
1e000 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
1e010 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35  owsort..SELECT 5
1e020 30 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  0 - + col1 * col
1e030 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1e040 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d  or0..----..-119.
1e050 0a 2d 35 30 0d 0a 2d 36 32 36 0d 0a 0d 0a 71 75  .-50..-626....qu
1e060 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e070 45 4c 45 43 54 20 2b 20 37 31 20 2a 20 63 6f 6c  ELECT + 71 * col
1e080 31 20 2b 20 2d 20 34 39 20 41 53 20 63 6f 6c 32  1 + - 49 AS col2
1e090 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1e0a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 38 0d 0a  r0..----..1158..
1e0b0 32 31 35 32 0d 0a 34 31 34 30 0d 0a 0d 0a 71 75  2152..4140....qu
1e0c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e0d0 45 4c 45 43 54 20 2b 20 2d 20 36 36 20 46 52 4f  ELECT + - 66 FRO
1e0e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1e0f0 2d 2d 2d 2d 0d 0a 2d 36 36 0d 0a 2d 36 36 0d 0a  ----..-66..-66..
1e100 2d 36 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -66....skipif po
1e110 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1e120 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1e130 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1e140 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1e150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e160 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 33 20 63  .SELECT ALL 23 c
1e170 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol2 FROM tab1, t
1e180 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1e190 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
1e1a0 69 6e 67 20 74 6f 20 64 39 34 66 61 64 63 63 31  ing to d94fadcc1
1e1b0 63 38 63 63 34 66 63 35 31 62 37 38 62 38 33 65  c8cc4fc51b78b83e
1e1c0 30 34 37 39 35 66 32 0d 0a 0d 0a 6f 6e 6c 79 69  04795f2....onlyi
1e1d0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1e1e0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1e1f0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1e200 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1e210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1e220 62 65 6c 2d 38 38 39 0d 0a 53 45 4c 45 43 54 20  bel-889..SELECT 
1e230 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 63  col2 * - CAST( c
1e240 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
1e250 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e260 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
1e270 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d  838..-7462..-97.
1e280 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1e290 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1e2a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e2b0 74 20 6c 61 62 65 6c 2d 38 38 39 0d 0a 53 45 4c  t label-889..SEL
1e2c0 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53  ECT col2 * - CAS
1e2d0 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  T ( col1 AS INTE
1e2e0 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
1e2f0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1e300 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32  --..-2838..-7462
1e310 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-97....query I
1e320 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e330 20 2d 20 2b 20 34 31 20 46 52 4f 4d 20 74 61 62   - + 41 FROM tab
1e340 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1e350 0a 2d 34 31 0d 0a 2d 34 31 0d 0a 2d 34 31 0d 0a  .-41..-41..-41..
1e360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e370 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 31  t..SELECT - cor1
1e380 2e 63 6f 6c 31 20 2a 20 28 20 2d 20 35 36 20 29  .col1 * ( - 56 )
1e390 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1e3a0 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
1e3b0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
1e3c0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1e3d0 68 61 73 68 69 6e 67 20 74 6f 20 34 36 30 35 65  hashing to 4605e
1e3e0 30 62 30 61 64 36 31 62 65 35 64 66 66 38 36 64  0b0ad61be5dff86d
1e3f0 30 66 37 36 62 61 32 37 31 37 64 0d 0a 0d 0a 73  0f76ba2717d....s
1e400 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1e410 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1e420 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1e430 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1e440 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1e450 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e460 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
1e470 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
1e480 31 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  1, tab2 cor0..--
1e490 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a  --..17..31..59..
1e4a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e4b0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
1e4c0 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
1e4d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1e4e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
1e4f0 31 33 36 0d 0a 33 35 0d 0a 35 39 38 34 33 36 0d  136..35..598436.
1e500 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e510 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
1e520 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
1e530 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62  , tab0 cor0, tab
1e540 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
1e550 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
1e560 6e 67 20 74 6f 20 39 66 63 31 64 63 64 37 36 66  ng to 9fc1dcd76f
1e570 65 61 66 34 33 65 35 63 35 64 63 30 36 30 61 30  eaf43e5c5dc060a0
1e580 32 30 31 34 63 64 0d 0a 0d 0a 6f 6e 6c 79 69 66  2014cd....onlyif
1e590 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1e5a0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1e5b0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1e5c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1e5d0 6c 61 62 65 6c 2d 38 39 35 0d 0a 53 45 4c 45 43  label-895..SELEC
1e5e0 54 20 63 6f 6c 30 20 44 49 56 20 74 61 62 30 2e  T col0 DIV tab0.
1e5f0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
1e600 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab0..----..0..0.
1e610 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .0....skipif pos
1e620 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1e630 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1e640 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1e650 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
1e660 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1e670 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1e680 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1e690 62 65 6c 2d 38 39 35 0d 0a 53 45 4c 45 43 54 20  bel-895..SELECT 
1e6a0 63 6f 6c 30 20 2f 20 74 61 62 30 2e 63 6f 6c 31  col0 / tab0.col1
1e6b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
1e6c0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
1e6d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e6e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1e6f0 43 54 20 2d 20 31 32 20 2a 20 74 61 62 32 2e 63  CT - 12 * tab2.c
1e700 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1e710 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
1e720 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a  or0..----..-84..
1e730 2d 39 33 36 0d 0a 2d 39 34 38 0d 0a 0d 0a 71 75  -936..-948....qu
1e740 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e750 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a  ELECT - - col0 *
1e760 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41   - col1 + col1 A
1e770 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1e780 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e790 2d 31 39 37 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38  -1978..-3298..-8
1e7a0 30 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  008....query I r
1e7b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e7c0 20 37 39 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b   79 - + col0 * +
1e7d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1e7e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1e7f0 31 33 30 34 0d 0a 2d 36 35 35 0d 0a 2d 38 30 30  1304..-655..-800
1e800 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1e810 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
1e820 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1e830 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1e840 2d 0d 0a 33 32 0d 0a 33 32 0d 0a 33 32 0d 0a 0d  -..32..32..32...
1e850 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1e860 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1e870 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1e880 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1e890 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 30  owsort label-900
1e8a0 0d 0a 53 45 4c 45 43 54 20 2b 20 34 20 44 49 56  ..SELECT + 4 DIV
1e8b0 20 2d 20 36 20 41 53 20 63 6f 6c 31 20 46 52 4f   - 6 AS col1 FRO
1e8c0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
1e8d0 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
1e8e0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1e8f0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1e900 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30  rowsort label-90
1e910 30 0d 0a 53 45 4c 45 43 54 20 2b 20 34 20 2f 20  0..SELECT + 4 / 
1e920 2d 20 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  - 6 AS col1 FROM
1e930 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab0..----..0..
1e940 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
1e950 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e960 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
1e970 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + - cor0.col0 AS
1e980 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1e990 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1e9a0 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75 65  34..-7..9....que
1e9b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e9c0 4c 45 43 54 20 2d 20 35 36 20 41 53 20 63 6f 6c  LECT - 56 AS col
1e9d0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
1e9e0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
1e9f0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
1ea00 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1ea10 20 74 6f 20 33 64 33 64 61 62 34 30 30 65 65 66   to 3d3dab400eef
1ea20 39 33 63 30 39 38 61 63 62 62 62 61 33 66 63 39  93c098acbbba3fc9
1ea30 62 64 63 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  bdc6....query I 
1ea40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ea50 44 49 53 54 49 4e 43 54 20 2d 20 36 39 20 46 52  DISTINCT - 69 FR
1ea60 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  OM tab1 AS cor0 
1ea70 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20  CROSS JOIN tab1 
1ea80 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor1..----..-
1ea90 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  69....query I ro
1eaa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1eab0 4c 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 2d 20  L tab0.col1 * - 
1eac0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1ead0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
1eae0 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39  064..-3395..-809
1eaf0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1eb00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1eb10 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 33 31 20 41   - - col1 + 31 A
1eb20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
1eb30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1eb40 34 38 0d 0a 36 32 0d 0a 39 30 0d 0a 0d 0a 71 75  48..62..90....qu
1eb50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1eb60 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
1eb70 20 2b 20 37 37 20 41 53 20 63 6f 6c 31 20 46 52   + 77 AS col1 FR
1eb80 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1eb90 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 32 30 0d 0a  .----..-19..20..
1eba0 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
1ebb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1ebc0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
1ebd0 63 6f 6c 32 20 2a 20 35 37 20 2a 20 2d 20 63 6f  col2 * 57 * - co
1ebe0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1ebf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 39  cor0..----..-369
1ec00 30 31 0d 0a 2d 34 37 37 31 36 0d 0a 2d 38 37 35  01..-47716..-875
1ec10 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
1ec20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1ec30 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
1ec40 2b 20 35 36 20 2b 20 35 34 20 41 53 20 63 6f 6c  + 56 + 54 AS col
1ec50 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
1ec60 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 39 34 0d 0a 2d  ..----..-1794..-
1ec70 32 0d 0a 2d 34 35 33 38 0d 0a 0d 0a 6f 6e 6c 79  2..-4538....only
1ec80 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1ec90 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1eca0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1ecb0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1ecc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ecd0 61 62 65 6c 2d 39 30 39 0d 0a 53 45 4c 45 43 54  abel-909..SELECT
1ece0 20 2d 20 63 6f 6c 30 20 2b 20 43 41 53 54 28 20   - col0 + CAST( 
1ecf0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1ed00 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   / cor0.col0 col
1ed10 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1ed20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
1ed30 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
1ed40 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1ed50 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1ed60 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1ed70 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1ed80 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
1ed90 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1eda0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1edb0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 39  owsort label-909
1edc0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
1edd0 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
1ede0 20 49 4e 54 45 47 45 52 20 29 20 2f 20 63 6f 72   INTEGER ) / cor
1edf0 30 2e 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  0.col0 col2 FROM
1ee00 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1ee10 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
1ee20 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1ee30 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1ee40 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1ee50 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1ee60 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1ee70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ee80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1ee90 63 6f 6c 31 20 2b 20 31 38 20 2a 20 63 6f 6c 30  col1 + 18 * col0
1eea0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1eeb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1eec0 31 36 32 0d 0a 31 34 35 33 0d 0a 38 30 0d 0a 0d  162..1453..80...
1eed0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1eee0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1eef0 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol0 - col1 * col
1ef00 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
1ef10 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1ef20 2d 0d 0a 2d 31 33 32 38 0d 0a 2d 31 34 30 37 0d  -..-1328..-1407.
1ef30 0a 2d 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .-634....query I
1ef40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ef50 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
1ef60 20 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   4 AS col0 FROM 
1ef70 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1ef80 0a 31 34 0d 0a 31 37 0d 0a 33 30 0d 0a 0d 0a 71  .14..17..30....q
1ef90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1efa0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
1efb0 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  * - col0 * col0 
1efc0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1efd0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d 0a 2d  0..----..-234..-
1efe0 34 30 39 36 30 0d 0a 2d 38 33 32 30 30 0d 0a 0d  40960..-83200...
1eff0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f000 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f010 54 20 2b 20 63 6f 6c 32 20 2b 20 39 38 20 2a 20  T + col2 + 98 * 
1f020 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
1f030 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f040 33 34 38 0d 0a 36 33 32 39 0d 0a 37 39 33 36 0d  348..6329..7936.
1f050 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f060 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1f070 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 31  NCT - - col2 + 1
1f080 38 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  8 AS col0 FROM t
1f090 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
1f0a0 31 30 30 0d 0a 31 39 0d 0a 35 31 0d 0a 0d 0a 71  100..19..51....q
1f0b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f0c0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1f0d0 32 20 2b 20 2d 20 38 35 20 2a 20 63 6f 6c 32 20  2 + - 85 * col2 
1f0e0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1f0f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 33 36 0d 0a  0..----..-2236..
1f100 2d 32 33 32 32 0d 0a 2d 33 32 36 38 0d 0a 0d 0a  -2322..-3268....
1f110 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
1f120 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
1f130 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a  ELECT DISTINCT *
1f140 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
1f150 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
1f160 53 20 63 6f 72 31 2c 20 74 61 62 31 2c 20 74 61  S cor1, tab1, ta
1f170 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b0 AS cor2..----
1f180 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
1f190 73 68 69 6e 67 20 74 6f 20 65 36 36 30 62 35 39  shing to e660b59
1f1a0 34 34 65 33 34 64 64 38 64 37 35 37 34 30 32 38  44e34dd8d7574028
1f1b0 36 38 36 32 62 33 32 35 32 0d 0a 0d 0a 71 75 65  6862b3252....que
1f1c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f1d0 4c 45 43 54 20 2d 20 2d 20 28 20 37 20 29 20 46  LECT - - ( 7 ) F
1f1e0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1f1f0 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 0d 0a 37 0d  ..----..7..7..7.
1f200 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f210 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1f220 4e 43 54 20 2b 20 36 39 20 46 52 4f 4d 20 74 61  NCT + 69 FROM ta
1f230 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1f240 0d 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..69....query I 
1f250 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f260 2d 20 2d 20 35 39 20 2b 20 63 6f 6c 31 20 46 52  - - 59 + col1 FR
1f270 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f280 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 37 36 0d 0a  .----..118..76..
1f290 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
1f2a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1f2b0 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  ( + col2 ) * + c
1f2c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1f2d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
1f2e0 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a  34..-646..-837..
1f2f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f300 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1f310 43 54 20 2b 20 2d 20 28 20 38 32 20 29 20 2a 20  CT + - ( 82 ) * 
1f320 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1f330 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
1f340 37 34 0d 0a 2d 36 33 39 36 0d 0a 2d 36 34 37 38  74..-6396..-6478
1f350 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f360 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
1f370 6c 30 20 2b 20 28 20 2d 20 74 61 62 32 2e 63 6f  l0 + ( - tab2.co
1f380 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
1f390 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab2..----..0.
1f3a0 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
1f3b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f3c0 20 44 49 53 54 49 4e 43 54 20 33 36 20 41 53 20   DISTINCT 36 AS 
1f3d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
1f3e0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1f3f0 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .36....query I r
1f400 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1f410 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a  ISTINCT + col1 *
1f420 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   - cor0.col0 + c
1f430 6f 72 30 2e 63 6f 6c 32 20 2a 20 33 31 20 41 53  or0.col2 * 31 AS
1f440 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
1f450 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1f460 31 36 35 0d 0a 2d 33 37 39 36 0d 0a 36 32 30 0d  165..-3796..620.
1f470 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f480 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 32  rt..SELECT - - 2
1f490 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  6 FROM tab0 AS c
1f4a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
1f4b0 36 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  6..26....query I
1f4c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f4d0 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20   ALL - - col2 * 
1f4e0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1f4f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1f500 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d  ----..1444..676.
1f510 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .729....query I 
1f520 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f530 41 4c 4c 20 37 35 20 2b 20 63 6f 6c 32 20 2a 20  ALL 75 + col2 * 
1f540 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
1f550 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1f560 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a 31 34  ..----..1323..14
1f570 37 39 0d 0a 36 34 35 0d 0a 0d 0a 6f 6e 6c 79 69  79..645....onlyi
1f580 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1f590 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1f5a0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1f5b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f5c0 20 6c 61 62 65 6c 2d 39 32 39 0d 0a 53 45 4c 45   label-929..SELE
1f5d0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20  CT ALL col2 DIV 
1f5e0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
1f5f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f600 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73 6b  -2..-5..-7....sk
1f610 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1f620 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1f630 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1f640 65 6c 2d 39 32 39 0d 0a 53 45 4c 45 43 54 20 41  el-929..SELECT A
1f650 4c 4c 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31  LL col2 / - col1
1f660 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1f670 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35  r0..----..-2..-5
1f680 0d 0a 2d 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-7....query I 
1f690 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f6a0 44 49 53 54 49 4e 43 54 20 2d 20 32 33 20 46 52  DISTINCT - 23 FR
1f6b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1f6c0 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 0d 0a 73 6b  .----..-23....sk
1f6d0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1f6e0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1f6f0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1f700 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1f710 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1f720 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1f730 4c 4c 20 2b 20 2d 20 34 35 20 63 6f 6c 32 20 46  LL + - 45 col2 F
1f740 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1f750 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d 0a 2d 34 35  ..----..-45..-45
1f760 0d 0a 2d 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-45....query I
1f770 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f780 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20   ALL - + col1 * 
1f790 2b 20 63 6f 6c 30 20 2b 20 2d 20 28 20 2b 20 63  + col0 + - ( + c
1f7a0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
1f7b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f7c0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 32 0d 0a 2d 32  .----..-1422..-2
1f7d0 32 34 0d 0a 2d 34 36 38 30 0d 0a 0d 0a 71 75 65  24..-4680....que
1f7e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f7f0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  LECT + col1 * - 
1f800 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52  col0 + - col0 FR
1f810 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1f820 2d 2d 0d 0a 2d 31 34 32 32 0d 0a 2d 32 32 34 0d  --..-1422..-224.
1f830 0a 2d 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20  .-4680....query 
1f840 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f850 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
1f860 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  0 + col2 AS col1
1f870 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1f880 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a  .----..171..36..
1f890 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  57....onlyif mys
1f8a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1f8b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1f8c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1f8d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f8e0 6c 2d 39 33 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-935..SELECT + 
1f8f0 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f  + col2 + cor0.co
1f900 6c 31 20 2a 20 35 36 20 44 49 56 20 2b 20 63 6f  l1 * 56 DIV + co
1f910 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1f920 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f930 2d 2d 0d 0a 32 37 35 0d 0a 35 30 0d 0a 36 38 0d  --..275..50..68.
1f940 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1f950 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1f960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f970 74 20 6c 61 62 65 6c 2d 39 33 35 0d 0a 53 45 4c  t label-935..SEL
1f980 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63  ECT + + col2 + c
1f990 6f 72 30 2e 63 6f 6c 31 20 2a 20 35 36 20 2f 20  or0.col1 * 56 / 
1f9a0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
1f9b0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1f9c0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 35 0d 0a 35 30 0d  ..----..275..50.
1f9d0 0a 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .68....skipif po
1f9e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1f9f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1fa00 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1fa10 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1fa20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1fa30 0a 53 45 4c 45 43 54 20 2d 20 38 36 20 63 6f 6c  .SELECT - 86 col
1fa40 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
1fa50 2d 0d 0a 2d 38 36 0d 0a 2d 38 36 0d 0a 2d 38 36  -..-86..-86..-86
1fa60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fa70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1fa80 49 4e 43 54 20 2d 20 38 33 20 2a 20 63 6f 6c 30  INCT - 83 * col0
1fa90 20 2b 20 2d 20 35 33 20 41 53 20 63 6f 6c 31 20   + - 53 AS col1 
1faa0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1fab0 0a 2d 32 30 34 35 0d 0a 2d 32 39 35 38 0d 0a 2d  .-2045..-2958..-
1fac0 37 34 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7440....query I 
1fad0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fae0 44 49 53 54 49 4e 43 54 20 28 20 31 39 20 29 20  DISTINCT ( 19 ) 
1faf0 2a 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20 63  * cor1.col1 AS c
1fb00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
1fb10 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
1fb20 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
1fb30 0a 31 36 33 34 0d 0a 31 37 32 39 0d 0a 31 38 34  .1634..1729..184
1fb40 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
1fb50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1fb60 54 49 4e 43 54 20 2d 20 28 20 63 6f 6c 31 20 29  TINCT - ( col1 )
1fb70 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1fb80 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d  b0..----..-86..-
1fb90 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  91..-97....query
1fba0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fbb0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20  CT ALL col0 + + 
1fbc0 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab1.col1 AS col
1fbd0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
1fbe0 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d  -..29..74..93...
1fbf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fc00 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1fc10 54 20 2d 20 28 20 39 30 20 29 20 46 52 4f 4d 20  T - ( 90 ) FROM 
1fc20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f  tab1, tab1 AS co
1fc30 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
1fc40 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 30 0d 0a 0d 0a 71  ..----..-90....q
1fc50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fc60 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
1fc70 2a 20 34 36 20 46 52 4f 4d 20 74 61 62 30 20 41  * 46 FROM tab0 A
1fc80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1fc90 31 30 34 0d 0a 2d 31 36 31 30 0d 0a 2d 34 30 39  104..-1610..-409
1fca0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1fcb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1fcc0 54 49 4e 43 54 20 2d 20 28 20 28 20 2b 20 63 6f  TINCT - ( ( + co
1fcd0 72 31 2e 63 6f 6c 31 20 29 20 29 20 46 52 4f 4d  r1.col1 ) ) FROM
1fce0 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
1fcf0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53  OSS JOIN tab1 AS
1fd00 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor1..----..-10
1fd10 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75  ..-13..-26....qu
1fd20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1fd30 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  ELECT col1 * - c
1fd40 6f 6c 30 20 2a 20 2b 20 28 20 2b 20 74 61 62 32  ol0 * + ( + tab2
1fd50 2e 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 32  .col1 ) + - col2
1fd60 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
1fd70 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
1fd80 2d 0d 0a 2d 31 39 38 32 39 0d 0a 2d 32 36 39 34  -..-19829..-2694
1fd90 39 30 0d 0a 2d 36 35 33 38 0d 0a 0d 0a 71 75 65  90..-6538....que
1fda0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1fdb0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 38  LECT DISTINCT 78
1fdc0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
1fdd0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d 0a 31 35  1..----..142..15
1fde0 38 0d 0a 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..81....onlyif 
1fdf0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1fe00 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1fe10 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1fe20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1fe30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fe40 6c 2d 39 34 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-946..SELECT + 
1fe50 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43 41 53 54  cor0.col2 + CAST
1fe60 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
1fe70 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61   ) FROM tab2, ta
1fe80 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b1 cor0..----..9
1fe90 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1fea0 74 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31  to cd7a7901e47c1
1feb0 35 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66  5155404aff0d216f
1fec0 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  e0b....skipif my
1fed0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1fee0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1fef0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 34 36 0d  wsort label-946.
1ff00 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
1ff10 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ol2 + CAST ( NUL
1ff20 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
1ff30 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63  ROM tab2, tab1 c
1ff40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
1ff50 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
1ff60 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35  d7a7901e47c15155
1ff70 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d  404aff0d216fe0b.
1ff80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ff90 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1ffa0 30 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b  0 * ( - col2 ) +
1ffb0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
1ffc0 32 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 0d 0a 32 31  2..----..196..21
1ffd0 30 36 0d 0a 33 30 38 31 0d 0a 0d 0a 71 75 65 72  06..3081....quer
1ffe0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1fff0 45 43 54 20 44 49 53 54 49 4e 43 54 20 31 31 20  ECT DISTINCT 11 
20000 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
20010 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  0, tab2 AS cor0.
20020 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 0d 0a 71 75 65  .----..11....que
20030 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20040 4c 45 43 54 20 41 4c 4c 20 35 35 20 46 52 4f 4d  LECT ALL 55 FROM
20050 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
20060 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
20070 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
20080 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 33  es hashing to 83
20090 32 31 32 38 61 64 62 31 64 64 63 36 35 63 33 31  2128adb1ddc65c31
200a0 30 35 65 32 39 63 63 32 63 38 62 33 61 33 0d 0a  05e29cc2c8b3a3..
200b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
200c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
200d0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  col2 + col2 * + 
200e0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
200f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
20100 2d 2d 2d 2d 0d 0a 31 34 30 36 0d 0a 36 35 30 0d  ----..1406..650.
20110 0a 37 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .702....onlyif m
20120 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
20130 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
20140 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
20150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
20160 62 65 6c 2d 39 35 31 0d 0a 53 45 4c 45 43 54 20  bel-951..SELECT 
20170 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
20180 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  DIV + col2 AS co
20190 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
201a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
201b0 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69  -2..-97....skipi
201c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
201d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
201e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
201f0 39 35 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  951..SELECT DIST
20200 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2b 20  INCT - col1 / + 
20210 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
20220 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
20230 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39  ----..-1..-2..-9
20240 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
20250 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
20260 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   - col1 + + col1
20270 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
20280 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20290 0a 31 34 37 35 0d 0a 36 32 39 0d 0a 38 30 36 0d  .1475..629..806.
202a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
202b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
202c0 6f 6c 30 20 2a 20 2d 20 39 36 20 41 53 20 63 6f  ol0 * - 96 AS co
202d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
202e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 30 34 0d 0a  0..----..-2304..
202f0 2d 33 33 36 30 0d 0a 2d 38 35 34 34 0d 0a 0d 0a  -3360..-8544....
20300 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
20310 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
20320 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
20330 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
20340 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
20350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20360 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30   + + col2 + cor0
20370 2e 63 6f 6c 30 20 2a 20 2b 20 32 30 20 63 6f 6c  .col0 * + 20 col
20380 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
20390 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 36 32 0d  or0..----..1862.
203a0 0a 35 31 33 0d 0a 37 30 31 0d 0a 0d 0a 71 75 65  .513..701....que
203b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
203c0 4c 45 43 54 20 34 32 20 41 53 20 63 6f 6c 32 20  LECT 42 AS col2 
203d0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
203e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
203f0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
20400 74 6f 20 36 34 63 32 39 64 62 39 66 31 63 64 37  to 64c29db9f1cd7
20410 65 64 34 64 64 65 62 31 37 33 35 65 33 65 30 64  ed4ddeb1735e3e0d
20420 34 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  442....query I r
20430 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
20440 49 53 54 49 4e 43 54 20 2d 20 32 30 20 2b 20 2b  ISTINCT - 20 + +
20450 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
20460 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  tab1..----..-17.
20470 0a 34 34 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79  .44..60....query
20480 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20490 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 32 30  CT - col0 * + 20
204a0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
204b0 0d 0a 2d 31 34 30 0d 0a 2d 31 35 36 30 0d 0a 2d  ..-140..-1560..-
204c0 31 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1580....query I 
204d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
204e0 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2b 20  + tab0.col1 + + 
204f0 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab0.col1 FROM t
20500 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a  ab0..----..172..
20510 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 6f 6e 6c 79  182..194....only
20520 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
20530 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
20540 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
20550 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
20560 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
20570 61 62 65 6c 2d 39 35 39 0d 0a 53 45 4c 45 43 54  abel-959..SELECT
20580 20 41 4c 4c 20 2d 20 43 41 53 54 28 20 4e 55 4c   ALL - CAST( NUL
20590 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2a  L AS DECIMAL ) *
205a0 20 2b 20 34 38 20 2d 20 63 6f 6c 32 20 2a 20 2d   + 48 - col2 * -
205b0 20 31 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   14 AS col0 FROM
205c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab0..----..NUL
205d0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
205e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
205f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
20600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20610 6c 61 62 65 6c 2d 39 35 39 0d 0a 53 45 4c 45 43  label-959..SELEC
20620 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e  T ALL - CAST ( N
20630 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ULL AS REAL ) * 
20640 2b 20 34 38 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  + 48 - col2 * - 
20650 31 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  14 AS col0 FROM 
20660 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
20670 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
20680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20690 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
206a0 20 2d 20 38 37 20 2d 20 63 6f 6c 31 20 46 52 4f   - 87 - col1 FRO
206b0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
206c0 30 30 0d 0a 2d 31 31 33 0d 0a 2d 39 37 0d 0a 0d  00..-113..-97...
206d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
206e0 0d 0a 53 45 4c 45 43 54 20 33 36 20 2b 20 39 35  ..SELECT 36 + 95
206f0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
20700 0d 0a 31 33 31 0d 0a 31 33 31 0d 0a 31 33 31 0d  ..131..131..131.
20710 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20720 72 74 0d 0a 53 45 4c 45 43 54 20 31 20 2b 20 63  rt..SELECT 1 + c
20730 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 + + col2 FRO
20740 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
20750 32 0d 0a 31 37 37 0d 0a 35 38 0d 0a 0d 0a 6f 6e  2..177..58....on
20760 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
20770 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
20780 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
20790 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
207a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
207b0 20 6c 61 62 65 6c 2d 39 36 33 0d 0a 53 45 4c 45   label-963..SELE
207c0 43 54 20 2b 20 43 41 53 54 28 20 38 32 20 2a 20  CT + CAST( 82 * 
207d0 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44  + col0 AS SIGNED
207e0 20 29 20 2d 20 2d 20 36 39 20 46 52 4f 4d 20 74   ) - - 69 FROM t
207f0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 34 33 0d 0a  ab2..----..643..
20800 36 34 36 35 0d 0a 36 35 34 37 0d 0a 0d 0a 73 6b  6465..6547....sk
20810 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
20820 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
20830 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
20840 65 6c 2d 39 36 33 0d 0a 53 45 4c 45 43 54 20 2b  el-963..SELECT +
20850 20 43 41 53 54 20 28 20 38 32 20 2a 20 2b 20 63   CAST ( 82 * + c
20860 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
20870 20 2d 20 2d 20 36 39 20 46 52 4f 4d 20 74 61 62   - - 69 FROM tab
20880 32 0d 0a 2d 2d 2d 2d 0d 0a 36 34 33 0d 0a 36 34  2..----..643..64
20890 36 35 0d 0a 36 35 34 37 0d 0a 0d 0a 71 75 65 72  65..6547....quer
208a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
208b0 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 34 31 20  ECT col1 * - 41 
208c0 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20  + col1 * ( col1 
208d0 29 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20  ) + - tab0.col2 
208e0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
208f0 0a 33 38 33 37 0d 0a 34 34 36 38 0d 0a 35 34 33  .3837..4468..543
20900 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
20910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
20920 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63  ol1 + + col2 * c
20930 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 * - col0 FRO
20940 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
20950 2d 0d 0a 2d 31 33 32 0d 0a 2d 32 36 32 32 32 0d  -..-132..-26222.
20960 0a 2d 35 39 38 35 32 37 0d 0a 0d 0a 71 75 65 72  .-598527....quer
20970 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20980 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 37  ECT - col0 + + 7
20990 36 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  6 * col0 FROM ta
209a0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30 30 0d 0a  b0..----..1800..
209b0 32 36 32 35 0d 0a 36 36 37 35 0d 0a 0d 0a 6f 6e  2625..6675....on
209c0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
209d0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
209e0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
209f0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
20a00 6f 72 74 20 6c 61 62 65 6c 2d 39 36 37 0d 0a 53  ort label-967..S
20a10 45 4c 45 43 54 20 2b 20 2b 20 38 34 20 44 49 56  ELECT + + 84 DIV
20a20 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
20a30 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20a40 0a 31 0d 0a 31 0d 0a 32 38 0d 0a 0d 0a 73 6b 69  .1..1..28....ski
20a50 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
20a60 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
20a70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
20a80 6c 2d 39 36 37 0d 0a 53 45 4c 45 43 54 20 2b 20  l-967..SELECT + 
20a90 2b 20 38 34 20 2f 20 2b 20 63 6f 6c 30 20 46 52  + 84 / + col0 FR
20aa0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
20ab0 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 32 38 0d  .----..1..1..28.
20ac0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20ad0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 35 20  rt..SELECT + 85 
20ae0 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  * - col0 + + col
20af0 32 20 2d 20 2d 20 32 37 20 46 52 4f 4d 20 74 61  2 - - 27 FROM ta
20b00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
20b10 0d 0a 2d 31 37 34 0d 0a 2d 35 33 35 36 0d 0a 2d  ..-174..-5356..-
20b20 36 36 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6677....query I 
20b30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20b40 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72  ALL - col0 * cor
20b50 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
20b60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
20b70 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39  64..-3395..-8099
20b80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20b90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
20ba0 49 4e 43 54 20 38 35 20 2a 20 63 6f 6c 32 20 2b  INCT 85 * col2 +
20bb0 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f   ( + col0 ) * co
20bc0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
20bd0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 34  tab2..----..2344
20be0 0d 0a 38 32 39 34 0d 0a 39 34 37 31 0d 0a 0d 0a  ..8294..9471....
20bf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20c00 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
20c10 20 2d 20 2d 20 31 30 20 46 52 4f 4d 20 74 61 62   - - 10 FROM tab
20c20 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  0 cor0..----..10
20c30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
20c40 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
20c50 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
20c60 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
20c70 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
20c80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20c90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
20ca0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col0 * col1 + co
20cb0 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
20cc0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20cd0 0a 31 30 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d  .104..1053..650.
20ce0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
20cf0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
20d00 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
20d10 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
20d20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
20d30 37 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  73..SELECT ALL -
20d40 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 72 30   - col0 DIV cor0
20d50 2e 63 6f 6c 31 20 2b 20 2d 20 33 32 20 2a 20 63  .col1 + - 32 * c
20d60 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 - col1 FROM 
20d70 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
20d80 2d 2d 0d 0a 2d 33 32 34 0d 0a 2d 34 32 33 0d 0a  --..-324..-423..
20d90 2d 38 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  -858....skipif m
20da0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
20db0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
20dc0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 33  owsort label-973
20dd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
20de0 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c   col0 / cor0.col
20df0 31 20 2b 20 2d 20 33 32 20 2a 20 63 6f 6c 31 20  1 + - 32 * col1 
20e00 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
20e10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20e20 2d 33 32 34 0d 0a 2d 34 32 33 0d 0a 2d 38 35 38  -324..-423..-858
20e30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
20e40 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
20e50 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
20e60 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
20e70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20e80 39 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  974..SELECT ALL 
20e90 2d 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  - - col2 + + col
20ea0 31 20 44 49 56 20 2b 20 36 39 20 46 52 4f 4d 20  1 DIV + 69 FROM 
20eb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
20ec0 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
20ed0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
20ee0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
20ef0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20f00 20 6c 61 62 65 6c 2d 39 37 34 0d 0a 53 45 4c 45   label-974..SELE
20f10 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20  CT ALL - - col2 
20f20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 36 39 20  + + col1 / + 69 
20f30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
20f40 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d  0..----..26..27.
20f50 0a 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .38....query I r
20f60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
20f70 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30  ISTINCT + - cor0
20f80 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a  .col1 + - col0 *
20f90 20 2b 20 38 38 20 41 53 20 63 6f 6c 31 20 46 52   + 88 AS col1 FR
20fa0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
20fb0 0a 2d 2d 2d 2d 0d 0a 2d 36 34 37 0d 0a 2d 36 39  .----..-647..-69
20fc0 32 33 0d 0a 2d 36 39 36 39 0d 0a 0d 0a 71 75 65  23..-6969....que
20fd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20fe0 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  LECT col2 * - co
20ff0 6c 31 20 2a 20 33 32 20 2b 20 2b 20 63 6f 6c 30  l1 * 32 + + col0
21000 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a   + col0 * col1 *
21010 20 37 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   73 AS col0 FROM
21020 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
21030 2d 2d 2d 0d 0a 32 34 34 37 36 36 0d 0a 33 35 32  ---..244766..352
21040 35 33 32 0d 0a 35 39 38 38 30 0d 0a 0d 0a 73 6b  532..59880....sk
21050 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
21060 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
21070 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
21080 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
21090 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
210a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
210b0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 63   col2 * col0 - c
210c0 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol1 col2 FROM ta
210d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
210e0 0d 0a 2d 32 30 38 37 0d 0a 2d 32 32 30 0d 0a 2d  ..-2087..-220..-
210f0 33 30 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3019....onlyif m
21100 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
21110 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
21120 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
21130 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
21140 62 65 6c 2d 39 37 38 0d 0a 53 45 4c 45 43 54 20  bel-978..SELECT 
21150 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
21160 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  0 * cor0.col2 DI
21170 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  V col0 AS col0 F
21180 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
21190 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d  ..----..-1..-33.
211a0 0a 2d 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-82....skipif m
211b0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
211c0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
211d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 37 38  owsort label-978
211e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
211f0 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72  T + - col0 * cor
21200 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 41 53  0.col2 / col0 AS
21210 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
21220 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
21230 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71  1..-33..-82....q
21240 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21250 53 45 4c 45 43 54 20 2b 20 37 39 20 2a 20 63 6f  SELECT + 79 * co
21260 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l0 + - cor0.col2
21270 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
21280 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
21290 37 36 0d 0a 34 37 39 37 0d 0a 35 34 38 36 0d 0a  76..4797..5486..
212a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
212b0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
212c0 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 37 34 20 2b   - col2 * - 74 +
212d0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20   col2 * col0 AS 
212e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
212f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
21300 37 39 37 0d 0a 34 31 38 34 0d 0a 37 38 37 36 0d  797..4184..7876.
21310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21320 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
21330 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f  ol2 + + col0 FRO
21340 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
21350 2d 0d 0a 2d 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a  -..-20..41..52..
21360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21370 74 0d 0a 53 45 4c 45 43 54 20 32 36 20 2a 20 2b  t..SELECT 26 * +
21380 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20   col0 + col1 AS 
21390 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
213a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
213b0 34 0d 0a 31 36 37 34 0d 0a 32 30 39 33 0d 0a 0d  4..1674..2093...
213c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
213d0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
213e0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
213f0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
21400 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
21410 6f 72 74 20 6c 61 62 65 6c 2d 39 38 33 0d 0a 53  ort label-983..S
21420 45 4c 45 43 54 20 43 41 53 54 28 20 2d 20 35 32  ELECT CAST( - 52
21430 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63   AS SIGNED ) + c
21440 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
21450 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
21460 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 32 35 0d 0a 2d  ---..-14..-25..-
21470 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
21480 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
21490 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
214a0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 33 0d 0a  sort label-983..
214b0 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 2d 20  SELECT CAST ( - 
214c0 35 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  52 AS INTEGER ) 
214d0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
214e0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
214f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 32 35  ..----..-14..-25
21500 0d 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-26....query I
21510 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21520 20 44 49 53 54 49 4e 43 54 20 36 30 20 2a 20 2d   DISTINCT 60 * -
21530 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
21540 0a 2d 2d 2d 2d 0d 0a 2d 33 32 34 30 0d 0a 2d 33  .----..-3240..-3
21550 34 32 30 0d 0a 2d 35 37 36 30 0d 0a 0d 0a 71 75  420..-5760....qu
21560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21570 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20 38  ELECT col0 * - 8
21580 33 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  3 + col1 FROM ta
21590 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
215a0 0d 0a 2d 35 35 30 0d 0a 2d 36 34 31 35 0d 0a 2d  ..-550..-6415..-
215b0 36 35 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6540....query I 
215c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
215d0 2d 20 39 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 90 AS col2 FRO
215e0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
215f0 2d 0d 0a 2d 39 30 0d 0a 2d 39 30 0d 0a 2d 39 30  -..-90..-90..-90
21600 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
21610 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
21620 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
21630 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72  M tab2, tab1 cor
21640 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c  0, tab2 AS cor1,
21650 20 74 61 62 31 20 63 6f 72 32 0d 0a 2d 2d 2d 2d   tab1 cor2..----
21660 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73  ..972 values has
21670 68 69 6e 67 20 74 6f 20 34 63 30 38 31 33 62 32  hing to 4c0813b2
21680 31 37 39 33 30 33 66 64 66 35 38 66 30 38 32 64  179303fdf58f082d
21690 38 31 64 36 64 30 33 63 0d 0a 0d 0a 6f 6e 6c 79  81d6d03c....only
216a0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
216b0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
216c0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
216d0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
216e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
216f0 61 62 65 6c 2d 39 38 38 0d 0a 53 45 4c 45 43 54  abel-988..SELECT
21700 20 2b 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53   + CAST( col2 AS
21710 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30   SIGNED ) + col0
21720 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
21730 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36 0d 0a 31  1..----..1136..1
21740 33 32 0d 0a 36 39 37 0d 0a 0d 0a 73 6b 69 70 69  32..697....skipi
21750 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
21760 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
21770 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21780 39 38 38 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  988..SELECT + CA
21790 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54  ST ( col2 AS INT
217a0 45 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 2a 20  EGER ) + col0 * 
217b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
217c0 2d 2d 2d 2d 0d 0a 31 31 33 36 0d 0a 31 33 32 0d  ----..1136..132.
217d0 0a 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .697....query I 
217e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
217f0 36 38 20 2b 20 39 33 20 41 53 20 63 6f 6c 32 20  68 + 93 AS col2 
21800 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
21810 0a 31 36 31 0d 0a 31 36 31 0d 0a 31 36 31 0d 0a  .161..161..161..
21820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21830 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 38 20 2a  t..SELECT - 98 *
21840 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46   col1 * + col2 F
21850 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
21860 2d 31 32 32 33 30 34 0d 0a 2d 31 33 37 35 39 32  -122304..-137592
21870 0d 0a 2d 35 35 38 36 30 0d 0a 0d 0a 71 75 65 72  ..-55860....quer
21880 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21890 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 74  ECT ALL col0 * t
218a0 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ab1.col0 AS col0
218b0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
218c0 0d 0a 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39 0d  ..4096..6400..9.
218d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
218e0 72 74 0d 0a 53 45 4c 45 43 54 20 34 39 20 2a 20  rt..SELECT 49 * 
218f0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
21900 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21910 2d 31 34 37 0d 0a 2d 33 31 33 36 0d 0a 2d 33 39  -147..-3136..-39
21920 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
21930 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
21940 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 * - cor0.col0
21950 20 2b 20 2d 20 37 30 20 2a 20 63 6f 6c 32 20 2a   + - 70 * col2 *
21960 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b   col0 + col0 * +
21970 20 37 33 20 46 52 4f 4d 20 74 61 62 32 20 63 6f   73 FROM tab2 co
21980 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 36 38  r0..----..-12768
21990 0d 0a 2d 31 34 32 33 35 30 0d 0a 2d 32 31 30 36  ..-142350..-2106
219a0 31 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  14....onlyif mys
219b0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
219c0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
219d0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
219e0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
219f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
21a00 39 34 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  94..SELECT + CAS
21a10 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
21a20 44 20 29 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29  D ) * ( + col2 )
21a30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
21a40 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
21a50 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
21a60 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
21a70 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
21a80 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 34 0d 0a  sort label-994..
21a90 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20  SELECT + CAST ( 
21aa0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
21ab0 29 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 46  ) * ( + col2 ) F
21ac0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
21ad0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
21ae0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21af0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 38 20 2a  ort..SELECT 58 *
21b00 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
21b10 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
21b20 0a 2d 31 35 30 38 0d 0a 2d 35 38 30 0d 0a 2d 37  .-1508..-580..-7
21b30 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  54....onlyif mys
21b40 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
21b50 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
21b60 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
21b70 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
21b80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
21b90 39 36 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  96..SELECT + + c
21ba0 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28 20 4e 55  ol1 * - CAST( NU
21bb0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
21bc0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
21bd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21be0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
21bf0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21c00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21c10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
21c20 72 74 20 6c 61 62 65 6c 2d 39 39 36 0d 0a 53 45  rt label-996..SE
21c30 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  LECT + + col1 * 
21c40 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
21c50 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
21c60 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
21c70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
21c80 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
21c90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21ca0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
21cb0 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53   + ( + col2 ) AS
21cc0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
21cd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
21ce0 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71  21..176..57....q
21cf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21d00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
21d10 37 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  73 AS col1 FROM 
21d20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 33 0d 0a  tab2..----..73..
21d30 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
21d40 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
21d50 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
21d60 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
21d70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39  rowsort label-99
21d80 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44  9..SELECT col2 D
21d90 49 56 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  IV - col1 + + co
21da0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
21db0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  tab0..----..1..3
21dc0 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..82....skipif 
21dd0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
21de0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
21df0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39  rowsort label-99
21e00 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f  9..SELECT col2 /
21e10 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   - col1 + + col2
21e20 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
21e30 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d  b0..----..1..33.
21e40 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .82....query I r
21e50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
21e60 49 53 54 49 4e 43 54 20 2d 20 74 61 62 30 2e 63  ISTINCT - tab0.c
21e70 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
21e80 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61 62   tab0, tab2, tab
21e90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
21ea0 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d  .-1..-33..-82...
21eb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21ec0 0d 0a 53 45 4c 45 43 54 20 2d 20 36 31 20 41 53  ..SELECT - 61 AS
21ed0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
21ee0 0a 2d 2d 2d 2d 0d 0a 2d 36 31 0d 0a 2d 36 31 0d  .----..-61..-61.
21ef0 0a 2d 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-61....query I 
21f00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21f10 63 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 32 31 20  col1 * + ( + 21 
21f20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
21f30 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 39 0d  ab2..----..1239.
21f40 0a 33 35 37 0d 0a 36 35 31 0d 0a 0d 0a 71 75 65  .357..651....que
21f50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21f60 4c 45 43 54 20 41 4c 4c 20 2d 20 34 33 20 46 52  LECT ALL - 43 FR
21f70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
21f80 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20  CROSS JOIN tab1 
21f90 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
21fa0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
21fb0 61 62 30 63 33 31 34 64 32 62 35 38 39 63 63 65  ab0c314d2b589cce
21fc0 64 62 39 61 38 37 35 62 65 65 62 31 66 38 36 61  db9a875beeb1f86a
21fd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21fe0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
21ff0 20 2a 20 2d 20 28 20 63 6f 6c 30 20 2b 20 2b 20   * - ( col0 + + 
22000 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30  col2 ) FROM tab0
22010 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 32 32 0d 0a  ..----..-14022..
22020 2d 31 38 38 31 0d 0a 2d 33 36 0d 0a 0d 0a 71 75  -1881..-36....qu
22030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22040 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
22050 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
22060 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
22070 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74  OSS JOIN tab1, t
22080 61 62 30 20 63 6f 72 31 2c 20 74 61 62 31 20 41  ab0 cor1, tab1 A
22090 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor2..----..81
220a0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
220b0 74 6f 20 63 34 65 36 62 31 66 31 64 32 38 65 37  to c4e6b1f1d28e7
220c0 33 31 36 36 34 61 31 35 61 36 66 37 63 64 61 34  31664a15a6f7cda4
220d0 64 61 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  da9....skipif po
220e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
220f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
22100 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
22110 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
22120 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22130 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22140 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 74 61 62   tab1.col1 + tab
22150 31 2e 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f 6c  1.col0 + ( - col
22160 31 20 2a 20 28 20 2b 20 63 6f 6c 31 20 29 20 29  1 * ( + col1 ) )
22170 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
22180 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 36 34 37  .----..-26..-647
22190 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-76....query I
221a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
221b0 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f   ALL - col2 + co
221c0 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46  r0.col1 + col2 F
221d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
221e0 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a  ..----..86..91..
221f0 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
22200 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
22210 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  L - + col1 * - c
22220 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20  ol0 - + col0 AS 
22230 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
22240 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
22250 34 30 0d 0a 33 33 36 30 0d 0a 38 30 31 30 0d 0a  40..3360..8010..
22260 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
22270 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
22280 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
22290 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
222a0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
222b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
222c0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
222d0 63 6f 6c 30 20 2d 20 28 20 2d 20 63 6f 6c 30 20  col0 - ( - col0 
222e0 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  ) col1 FROM tab1
222f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22300 31 32 38 0d 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 71  128..160..6....q
22310 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22320 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
22330 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  - cor0.col1 AS c
22340 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
22350 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
22360 39 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a  9..-173..-98....
22370 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22380 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20 32  .SELECT col1 - 2
22390 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
223a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
223b0 2d 0d 0a 2d 31 32 0d 0a 2d 39 0d 0a 34 0d 0a 0d  -..-12..-9..4...
223c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
223d0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
223e0 2a 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a  * - ( + col1 ) *
223f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
22400 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22410 31 33 35 32 30 0d 0a 2d 32 30 32 38 0d 0a 2d 36  13520..-2028..-6
22420 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  400....query I r
22430 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
22440 4c 4c 20 2b 20 31 36 20 2a 20 2d 20 39 36 20 46  LL + 16 * - 96 F
22450 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
22460 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
22470 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
22480 6f 20 30 37 64 37 61 64 30 37 36 66 33 38 64 36  o 07d7ad076f38d6
22490 65 65 37 63 61 62 61 62 64 34 61 61 33 37 63 36  ee7cababd4aa37c6
224a0 62 66 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  bf....query I ro
224b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
224c0 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 34 31 20  L - col1 * + 41 
224d0 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  - - col1 AS col0
224e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
224f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  r0..----..-1040.
22500 0a 2d 34 30 30 0d 0a 2d 35 32 30 0d 0a 0d 0a 71  .-400..-520....q
22510 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22520 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22530 2d 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b  - - ( + col2 ) +
22540 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41   - col2 * col0 A
22550 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
22560 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22570 2d 31 36 32 0d 0a 2d 32 30 30 32 0d 0a 2d 32 39  -162..-2002..-29
22580 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
22590 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
225a0 4c 20 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2b  L ( - col1 ) + +
225b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
225c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
225d0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
225e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
225f0 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T + - cor0.col1 
22600 2a 20 2d 20 32 37 20 46 52 4f 4d 20 74 61 62 31  * - 27 FROM tab1
22610 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22620 32 37 30 0d 0a 33 35 31 0d 0a 37 30 32 0d 0a 0d  270..351..702...
22630 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22640 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
22650 54 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  T + col2 - - col
22660 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
22670 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a  or0..----..164..
22680 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  2..66....query I
22690 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
226a0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20   + col0 + + ( + 
226b0 36 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  61 ) AS col1 FRO
226c0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab1..----..12
226d0 35 0d 0a 31 34 31 0d 0a 36 34 0d 0a 0d 0a 71 75  5..141..64....qu
226e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
226f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
22700 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 2d   col2 * col1 * -
22710 20 33 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   30 FROM tab0..-
22720 2d 2d 2d 0d 0a 32 32 33 38 36 30 0d 0a 32 39 31  ---..223860..291
22730 30 0d 0a 38 35 31 34 30 0d 0a 0d 0a 71 75 65 72  0..85140....quer
22740 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22750 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74  ECT DISTINCT - t
22760 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 39 34 20  ab0.col0 * - 94 
22770 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
22780 0a 32 32 35 36 0d 0a 33 32 39 30 0d 0a 38 33 36  .2256..3290..836
22790 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
227a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28  sort..SELECT + (
227b0 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 31   col0 ) * + col1
227c0 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2b   + - tab0.col0 +
227d0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
227e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 33 0d 0a 33  0..----..2073..3
227f0 33 36 31 0d 0a 38 30 39 32 0d 0a 0d 0a 71 75 65  361..8092....que
22800 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22810 4c 45 43 54 20 2d 20 32 38 20 2d 20 2d 20 28 20  LECT - 28 - - ( 
22820 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53  + cor0.col0 ) AS
22830 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
22840 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22850 34 0d 0a 36 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72  4..61..7....quer
22860 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
22870 45 43 54 20 2b 20 38 38 20 2b 20 63 6f 6c 31 20  ECT + 88 + col1 
22880 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
22890 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
228a0 0a 31 37 34 0d 0a 31 37 39 0d 0a 31 38 35 0d 0a  .174..179..185..
228b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
228c0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
228d0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
228e0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
228f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
22900 32 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  25..SELECT ALL c
22910 6f 6c 30 20 44 49 56 20 38 38 20 2d 20 63 6f 6c  ol0 DIV 88 - col
22920 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
22930 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d  -..-7..-78..-79.
22940 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
22950 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
22960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22970 74 20 6c 61 62 65 6c 2d 31 30 32 35 0d 0a 53 45  t label-1025..SE
22980 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2f 20  LECT ALL col0 / 
22990 38 38 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  88 - col0 FROM t
229a0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  ab2..----..-7..-
229b0 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69  78..-79....skipi
229c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
229d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
229e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
229f0 54 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 32 20  T + CAST ( col2 
22a00 41 53 20 52 45 41 4c 20 29 20 2a 20 2d 20 63 6f  AS REAL ) * - co
22a10 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
22a20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
22a30 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a  -1089..-6724....
22a40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22a50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22a60 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63   cor0.col1 + - c
22a70 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
22a80 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
22a90 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
22aa0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
22ab0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 20 2a  T DISTINCT - 6 *
22ac0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63   col1 * + cor0.c
22ad0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
22ae0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34   cor0..----..-44
22af0 33 37 36 0d 0a 2d 34 39 36 38 36 0d 0a 2d 35 36  376..-49686..-56
22b00 34 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  454....query I r
22b10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31  owsort..SELECT 1
22b20 30 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 - + col2 AS co
22b30 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
22b40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d  cor0..----..-44.
22b50 0a 2d 34 37 0d 0a 2d 38 36 0d 0a 0d 0a 6f 6e 6c  .-47..-86....onl
22b60 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
22b70 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
22b80 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
22b90 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
22ba0 72 74 20 6c 61 62 65 6c 2d 31 30 33 30 0d 0a 53  rt label-1030..S
22bb0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20  ELECT ALL + - ( 
22bc0 2d 20 63 6f 6c 30 20 29 20 44 49 56 20 2b 20 63  - col0 ) DIV + c
22bd0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
22be0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
22bf0 0d 0a 30 0d 0a 31 0d 0a 33 35 0d 0a 0d 0a 73 6b  ..0..1..35....sk
22c00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
22c10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
22c20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
22c30 65 6c 2d 31 30 33 30 0d 0a 53 45 4c 45 43 54 20  el-1030..SELECT 
22c40 41 4c 4c 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 30  ALL + - ( - col0
22c50 20 29 20 2f 20 2b 20 63 6f 6c 32 20 41 53 20 63   ) / + col2 AS c
22c60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
22c70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
22c80 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
22c90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
22ca0 31 35 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63  15 + + col0 AS c
22cb0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
22cc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d   cor0..----..18.
22cd0 0a 37 39 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79  .79..95....query
22ce0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22cf0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
22d00 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 + col2 AS col
22d10 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
22d20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a  or0..----..119..
22d30 31 37 33 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69  173..98....onlyi
22d40 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
22d50 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
22d60 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
22d70 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
22d80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22d90 62 65 6c 2d 31 30 33 33 0d 0a 53 45 4c 45 43 54  bel-1033..SELECT
22da0 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54 28 20 4e   ALL - - CAST( N
22db0 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
22dc0 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   / - col1 + col0
22dd0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
22de0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
22df0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
22e00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
22e10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
22e20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
22e30 65 6c 2d 31 30 33 33 0d 0a 53 45 4c 45 43 54 20  el-1033..SELECT 
22e40 41 4c 4c 20 2d 20 2d 20 43 41 53 54 20 28 20 4e  ALL - - CAST ( N
22e50 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2f 20  ULL AS REAL ) / 
22e60 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52  - col1 + col0 FR
22e70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
22e80 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
22e90 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
22ea0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
22eb0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
22ec0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
22ed0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
22ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
22ef0 62 65 6c 2d 31 30 33 34 0d 0a 53 45 4c 45 43 54  bel-1034..SELECT
22f00 20 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   - + CAST( NULL 
22f10 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20  AS SIGNED ) + + 
22f20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
22f30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
22f40 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
22f50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
22f60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
22f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22f80 20 6c 61 62 65 6c 2d 31 30 33 34 0d 0a 53 45 4c   label-1034..SEL
22f90 45 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20 4e  ECT - + CAST ( N
22fa0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
22fb0 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
22fc0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
22fd0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
22fe0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
22ff0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
23000 20 63 6f 6c 32 20 2a 20 2b 20 36 31 20 46 52 4f   col2 * + 61 FRO
23010 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
23020 2d 2d 2d 2d 0d 0a 32 30 31 33 0d 0a 35 30 30 32  ----..2013..5002
23030 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..61....query I 
23040 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23050 2b 20 35 39 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 59 AS col2 FRO
23060 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
23070 2d 0d 0a 35 39 0d 0a 35 39 0d 0a 35 39 0d 0a 0d  -..59..59..59...
23080 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23090 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
230a0 2a 20 63 6f 6c 30 20 2b 20 36 37 20 46 52 4f 4d  * col0 + 67 FROM
230b0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
230c0 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 35 37 33 0d 0a  ---..-11..-573..
230d0 2d 39 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -973....query I 
230e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
230f0 2d 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  - - ( - cor0.col
23100 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  1 ) FROM tab1 AS
23110 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
23120 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 71 75  ..-13..-26....qu
23130 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23140 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 72  ELECT col2 + cor
23150 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
23160 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23170 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a  119..173..98....
23180 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23190 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63  .SELECT col0 + c
231a0 6f 6c 32 20 2a 20 38 36 20 46 52 4f 4d 20 74 61  ol2 * 86 FROM ta
231b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
231c0 0d 0a 34 36 34 37 0d 0a 34 39 36 36 0d 0a 38 33  ..4647..4966..83
231d0 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  36....query IIII
231e0 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
231f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
23200 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  INCT * FROM tab1
23210 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
23220 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61  tab1 AS cor1, ta
23230 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 32  b0, tab2 AS cor2
23240 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
23250 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31  ues hashing to 1
23260 34 39 32 39 38 66 63 30 32 32 34 65 39 33 66 33  49298fc0224e93f3
23270 62 63 32 64 66 32 34 61 33 65 62 65 65 62 38 0d  bc2df24a3ebeeb8.
23280 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
23290 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
232a0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
232b0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
232c0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
232d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 32  wsort label-1042
232e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
232f0 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  * + CAST( NULL A
23300 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
23310 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
23320 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
23330 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
23340 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
23350 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
23360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
23370 61 62 65 6c 2d 31 30 34 32 0d 0a 53 45 4c 45 43  abel-1042..SELEC
23380 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53  T - col0 * + CAS
23390 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
233a0 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52  GER ) AS col2 FR
233b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
233c0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
233d0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
233e0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
233f0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
23400 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
23410 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23420 20 6c 61 62 65 6c 2d 31 30 34 33 0d 0a 53 45 4c   label-1043..SEL
23430 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c  ECT ALL tab0.col
23440 32 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f  2 DIV col2 AS co
23450 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
23460 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73  --..1..1..1....s
23470 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
23480 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
23490 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
234a0 62 65 6c 2d 31 30 34 33 0d 0a 53 45 4c 45 43 54  bel-1043..SELECT
234b0 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 32 20 2f   ALL tab0.col2 /
234c0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
234d0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
234e0 0d 0a 31 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..1..1....onlyif
234f0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
23500 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
23510 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
23520 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23530 6c 61 62 65 6c 2d 31 30 34 34 0d 0a 53 45 4c 45  label-1044..SELE
23540 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63  CT tab1.col0 + c
23550 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol1 + tab1.col0 
23560 44 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  DIV col1 AS col0
23570 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
23580 0d 0a 32 39 0d 0a 38 30 0d 0a 39 39 0d 0a 0d 0a  ..29..80..99....
23590 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
235a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
235b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
235c0 61 62 65 6c 2d 31 30 34 34 0d 0a 53 45 4c 45 43  abel-1044..SELEC
235d0 54 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 63 6f  T tab1.col0 + co
235e0 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2f  l1 + tab1.col0 /
235f0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
23600 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
23610 39 0d 0a 38 30 0d 0a 39 39 0d 0a 0d 0a 73 6b 69  9..80..99....ski
23620 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
23630 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
23640 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
23650 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
23660 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
23670 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23680 4c 20 2d 20 28 20 32 34 20 29 20 63 6f 6c 32 20  L - ( 24 ) col2 
23690 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
236a0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 32  0..----..-24..-2
236b0 34 0d 0a 2d 32 34 0d 0a 0d 0a 71 75 65 72 79 20  4..-24....query 
236c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
236d0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
236e0 63 6f 6c 32 20 2b 20 2b 20 37 37 20 41 53 20 63  col2 + + 77 AS c
236f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
23700 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31  r0..----..131..1
23710 33 34 0d 0a 31 37 33 0d 0a 0d 0a 6f 6e 6c 79 69  34..173....onlyi
23720 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
23730 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
23740 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
23750 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23760 20 6c 61 62 65 6c 2d 31 30 34 37 0d 0a 53 45 4c   label-1047..SEL
23770 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 44  ECT ALL + col1 D
23780 49 56 20 2d 20 34 32 20 41 53 20 63 6f 6c 30 20  IV - 42 AS col0 
23790 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
237a0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
237b0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
237c0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
237d0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
237e0 72 74 20 6c 61 62 65 6c 2d 31 30 34 37 0d 0a 53  rt label-1047..S
237f0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
23800 20 2f 20 2d 20 34 32 20 41 53 20 63 6f 6c 30 20   / - 42 AS col0 
23810 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23820 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
23830 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
23840 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 39  ort..SELECT + 59
23850 20 2b 20 2d 20 38 31 20 2a 20 2d 20 63 6f 6c 31   + - 81 * - col1
23860 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
23870 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
23880 0d 0a 31 34 33 36 0d 0a 32 35 37 30 0d 0a 34 38  ..1436..2570..48
23890 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
238a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
238b0 33 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  31 + col1 FROM t
238c0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
238d0 34 31 0d 0a 34 34 0d 0a 35 37 0d 0a 0d 0a 6f 6e  41..44..57....on
238e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
238f0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
23900 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
23910 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
23920 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23930 20 6c 61 62 65 6c 2d 31 30 35 30 0d 0a 53 45 4c   label-1050..SEL
23940 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20  ECT ALL - CAST( 
23950 32 37 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  27 AS SIGNED ) *
23960 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
23970 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
23980 31 30 32 36 0d 0a 2d 37 30 32 0d 0a 2d 37 32 39  1026..-702..-729
23990 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
239a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
239b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
239c0 72 74 20 6c 61 62 65 6c 2d 31 30 35 30 0d 0a 53  rt label-1050..S
239d0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
239e0 20 28 20 32 37 20 41 53 20 49 4e 54 45 47 45 52   ( 27 AS INTEGER
239f0 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) * col2 FROM t
23a00 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
23a10 2d 0d 0a 2d 31 30 32 36 0d 0a 2d 37 30 32 0d 0a  -..-1026..-702..
23a20 2d 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -729....query I 
23a30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23a40 2d 20 32 34 20 2a 20 63 6f 6c 31 20 2a 20 63 6f  - 24 * col1 * co
23a50 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
23a60 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
23a70 2d 2d 0d 0a 2d 31 33 36 38 30 0d 0a 2d 32 39 39  --..-13680..-299
23a80 35 32 0d 0a 2d 33 33 36 39 36 0d 0a 0d 0a 6f 6e  52..-33696....on
23a90 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
23aa0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
23ab0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
23ac0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
23ad0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23ae0 20 6c 61 62 65 6c 2d 31 30 35 32 0d 0a 53 45 4c   label-1052..SEL
23af0 45 43 54 20 43 41 53 54 28 20 2d 20 63 6f 6c 30  ECT CAST( - col0
23b00 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
23b10 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
23b20 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d  -..-7..-78..-79.
23b30 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
23b40 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
23b50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23b60 74 20 6c 61 62 65 6c 2d 31 30 35 32 0d 0a 53 45  t label-1052..SE
23b70 4c 45 43 54 20 43 41 53 54 20 28 20 2d 20 63 6f  LECT CAST ( - co
23b80 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
23b90 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
23ba0 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d  ----..-7..-78..-
23bb0 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  79....onlyif mys
23bc0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
23bd0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
23be0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
23bf0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23c00 6c 2d 31 30 35 33 0d 0a 53 45 4c 45 43 54 20 2d  l-1053..SELECT -
23c10 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29   - ( cor0.col2 )
23c20 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2b 20   DIV - col0 + + 
23c30 63 6f 6c 32 20 2a 20 31 32 20 2a 20 2d 20 63 6f  col2 * 12 * - co
23c40 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
23c50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 37  cor0..----..-227
23c60 31 0d 0a 2d 32 34 33 33 36 0d 0a 2d 33 36 30 32  1..-24336..-3602
23c70 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
23c80 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
23c90 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
23ca0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 33 0d 0a  ort label-1053..
23cb0 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 63 6f 72  SELECT - - ( cor
23cc0 30 2e 63 6f 6c 32 20 29 20 2f 20 2d 20 63 6f 6c  0.col2 ) / - col
23cd0 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 31 32 20  0 + + col2 * 12 
23ce0 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
23cf0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
23d00 0d 0a 2d 32 32 37 31 0d 0a 2d 32 34 33 33 36 0d  ..-2271..-24336.
23d10 0a 2d 33 36 30 32 34 0d 0a 0d 0a 71 75 65 72 79  .-36024....query
23d20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23d30 43 54 20 2b 20 31 31 20 41 53 20 63 6f 6c 30 20  CT + 11 AS col0 
23d40 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23d50 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 31 0d  0..----..11..11.
23d60 0a 31 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .11....onlyif my
23d70 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
23d80 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
23d90 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
23da0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23db0 65 6c 2d 31 30 35 35 0d 0a 53 45 4c 45 43 54 20  el-1055..SELECT 
23dc0 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20  col1 DIV col1 + 
23dd0 2d 20 39 38 20 2a 20 63 6f 6c 31 20 63 6f 6c 30  - 98 * col1 col0
23de0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
23df0 0d 0a 2d 31 32 37 33 0d 0a 2d 32 35 34 37 0d 0a  ..-1273..-2547..
23e00 2d 39 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -979....skipif p
23e10 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
23e20 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
23e30 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
23e40 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
23e50 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
23e60 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
23e70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23e80 6c 61 62 65 6c 2d 31 30 35 35 0d 0a 53 45 4c 45  label-1055..SELE
23e90 43 54 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b  CT col1 / col1 +
23ea0 20 2d 20 39 38 20 2a 20 63 6f 6c 31 20 63 6f 6c   - 98 * col1 col
23eb0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
23ec0 2d 0d 0a 2d 31 32 37 33 0d 0a 2d 32 35 34 37 0d  -..-1273..-2547.
23ed0 0a 2d 39 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .-979....query I
23ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23ef0 20 41 4c 4c 20 2d 20 2b 20 39 38 20 2a 20 63 6f   ALL - + 98 * co
23f00 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
23f10 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
23f20 2d 2d 0d 0a 2d 31 36 36 36 0d 0a 2d 33 30 33 38  --..-1666..-3038
23f30 0d 0a 2d 35 37 38 32 0d 0a 0d 0a 71 75 65 72 79  ..-5782....query
23f40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23f50 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 37  CT DISTINCT + 67
23f60 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
23f70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23f80 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  67....query I ro
23f90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
23fa0 2d 20 39 35 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  - 95 + + col1 * 
23fb0 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  5 AS col2 FROM t
23fc0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
23fd0 2d 0d 0a 2d 33 30 0d 0a 2d 34 35 0d 0a 33 35 0d  -..-30..-45..35.
23fe0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23ff0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
24000 2a 20 2d 20 33 39 20 2b 20 63 6f 6c 32 20 46 52  * - 39 + col2 FR
24010 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
24020 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 34 0d 0a 2d 33  .----..-1364..-3
24030 33 38 39 0d 0a 2d 39 30 33 0d 0a 0d 0a 71 75 65  389..-903....que
24040 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24050 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
24060 62 32 2e 63 6f 6c 31 20 2d 20 2b 20 74 61 62 32  b2.col1 - + tab2
24070 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d  .col0 FROM tab2.
24080 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d  .----..-19..-62.
24090 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .24....query I r
240a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
240b0 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 74 61 62 30  LL - col2 * tab0
240c0 2e 63 6f 6c 31 20 2b 20 34 33 20 2a 20 63 6f 6c  .col1 + 43 * col
240d0 32 20 2a 20 34 35 20 2d 20 2d 20 35 37 20 46 52  2 * 45 - - 57 FR
240e0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
240f0 35 31 32 36 35 0d 0a 31 38 39 35 0d 0a 36 31 30  51265..1895..610
24100 37 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  74....skipif pos
24110 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
24120 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
24130 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
24140 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
24150 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24160 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24170 63 6f 6c 32 20 2d 20 2b 20 74 61 62 30 2e 63 6f  col2 - + tab0.co
24180 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
24190 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37  0..----..-34..-7
241a0 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..9....query I r
241b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
241c0 49 53 54 49 4e 43 54 20 2d 20 74 61 62 31 2e 63  ISTINCT - tab1.c
241d0 6f 6c 31 20 2b 20 2d 20 28 20 2b 20 74 61 62 31  ol1 + - ( + tab1
241e0 2e 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 2a  .col0 ) + col0 *
241f0 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f   - tab1.col2 FRO
24200 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
24210 39 31 0d 0a 2d 33 37 32 32 0d 0a 2d 37 37 37 33  91..-3722..-7773
24220 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24230 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
24240 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
24250 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
24260 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24270 31 30 36 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1064..SELECT + c
24280 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2b 20 63  ol1 DIV col0 + c
24290 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
242a0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
242b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 39 32  r0..----..89..92
242c0 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..99....skipif m
242d0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
242e0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
242f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36  owsort label-106
24300 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  4..SELECT + col1
24310 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63   / col0 + cor0.c
24320 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
24330 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
24340 2d 2d 2d 0d 0a 38 39 0d 0a 39 32 0d 0a 39 39 0d  ---..89..92..99.
24350 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
24360 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
24370 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
24380 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
24390 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
243a0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
243b0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
243c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
243d0 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2d 20 2b 20  CT - + col1 - + 
243e0 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 52  CAST ( col2 AS R
243f0 45 41 4c 20 29 20 2a 20 63 6f 6c 32 20 63 6f 6c  EAL ) * col2 col
24400 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
24410 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 34 32  or0..----..-2942
24420 0d 0a 2d 33 32 35 39 0d 0a 2d 39 32 32 39 0d 0a  ..-3259..-9229..
24430 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
24440 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
24450 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
24460 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
24470 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
24480 36 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  66..SELECT DISTI
24490 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 2d  NCT + + col1 - -
244a0 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 63   cor0.col0 DIV c
244b0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
244c0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
244d0 0d 0a 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a 0d 0a  ..87..92..98....
244e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
244f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
24500 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24510 61 62 65 6c 2d 31 30 36 36 0d 0a 53 45 4c 45 43  abel-1066..SELEC
24520 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
24530 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 - - cor0.col
24540 30 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  0 / col0 AS col0
24550 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
24560 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39  .----..87..92..9
24570 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
24580 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
24590 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b  TINCT + col0 * +
245a0 20 31 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53   10 FROM tab0 AS
245b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30   cor0..----..240
245c0 0d 0a 33 35 30 0d 0a 38 39 30 0d 0a 0d 0a 6f 6e  ..350..890....on
245d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
245e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
245f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
24600 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
24610 6f 72 74 20 6c 61 62 65 6c 2d 31 30 36 38 0d 0a  ort label-1068..
24620 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24630 2d 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 28  - - col1 DIV - (
24640 20 2b 20 37 33 20 29 20 2d 20 2b 20 63 6f 6c 30   + 73 ) - + col0
24650 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
24660 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d  r0..----..-25..-
24670 33 36 0d 0a 2d 39 30 0d 0a 0d 0a 73 6b 69 70 69  36..-90....skipi
24680 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24690 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
246a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
246b0 31 30 36 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  1068..SELECT DIS
246c0 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2f  TINCT - - col1 /
246d0 20 2d 20 28 20 2b 20 37 33 20 29 20 2d 20 2b 20   - ( + 73 ) - + 
246e0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
246f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
24700 35 0d 0a 2d 33 36 0d 0a 2d 39 30 0d 0a 0d 0a 71  5..-36..-90....q
24710 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24720 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
24730 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f  + - ( col2 ) FRO
24740 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
24750 2d 0d 0a 2d 31 36 34 0d 0a 2d 32 0d 0a 2d 36 36  -..-164..-2..-66
24760 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24770 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
24780 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
24790 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
247a0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
247b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37  owsort label-107
247c0 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  0..SELECT ALL CA
247d0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
247e0 45 44 20 29 20 2a 20 2d 20 37 36 20 41 53 20 63  ED ) * - 76 AS c
247f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
24800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
24810 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
24820 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
24830 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
24840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24850 6c 61 62 65 6c 2d 31 30 37 30 0d 0a 53 45 4c 45  label-1070..SELE
24860 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 4e 55  CT ALL CAST ( NU
24870 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
24880 2a 20 2d 20 37 36 20 41 53 20 63 6f 6c 30 20 46  * - 76 AS col0 F
24890 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
248a0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
248b0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
248c0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
248d0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
248e0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
248f0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
24900 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
24910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
24920 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol2 + + col1 col
24930 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
24940 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a  or0..----..-28..
24950 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72  -47..-83....quer
24960 79 20 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  y IIIIIIIII rows
24970 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
24980 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  * FROM tab2, tab
24990 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  0, tab0 AS cor0 
249a0 57 48 45 52 45 20 4e 4f 54 20 63 6f 72 30 2e 63  WHERE NOT cor0.c
249b0 6f 6c 31 20 3c 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  ol1 < NULL..----
249c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
249d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
249e0 49 4e 43 54 20 36 31 20 46 52 4f 4d 20 74 61 62  INCT 61 FROM tab
249f0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31  1 cor0..----..61
24a00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24a10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f  ort..SELECT ( co
24a20 6c 30 20 29 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  l0 ) * col2 + - 
24a30 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
24a40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 37  or0..----..34..7
24a50 32 31 36 0d 0a 37 35 39 0d 0a 0d 0a 6f 6e 6c 79  216..759....only
24a60 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
24a70 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
24a80 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
24a90 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
24aa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24ab0 61 62 65 6c 2d 31 30 37 35 0d 0a 53 45 4c 45 43  abel-1075..SELEC
24ac0 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2d 20 28 20  T ALL + - ( - ( 
24ad0 2b 20 63 6f 6c 30 20 29 20 29 20 2a 20 2d 20 43  + col0 ) ) * - C
24ae0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
24af0 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52  NED ) AS col2 FR
24b00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
24b10 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
24b20 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
24b30 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24b40 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24b50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24b60 31 30 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1075..SELECT ALL
24b70 20 2b 20 2d 20 28 20 2d 20 28 20 2b 20 63 6f 6c   + - ( - ( + col
24b80 30 20 29 20 29 20 2a 20 2d 20 43 41 53 54 20 28  0 ) ) * - CAST (
24b90 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
24ba0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
24bb0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
24bc0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
24bd0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  NULL....skipif p
24be0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
24bf0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
24c00 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
24c10 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
24c20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24c30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
24c40 35 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  5 col2 FROM tab2
24c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35   cor0..----..155
24c60 0d 0a 32 39 35 0d 0a 38 35 0d 0a 0d 0a 71 75 65  ..295..85....que
24c70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24c80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
24c90 28 20 28 20 63 6f 6c 32 20 29 20 29 20 2b 20 2d  ( ( col2 ) ) + -
24ca0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
24cb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
24cc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24cd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 31 20 2a  ort..SELECT 51 *
24ce0 20 32 34 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f   24 - - col2 FRO
24cf0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
24d00 2d 0d 0a 31 32 35 30 0d 0a 31 32 35 31 0d 0a 31  -..1250..1251..1
24d10 32 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  262....query I r
24d20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24d30 4c 4c 20 28 20 2d 20 33 32 20 29 20 2b 20 63 6f  LL ( - 32 ) + co
24d40 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41  r0.col2 * col2 A
24d50 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
24d60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24d70 2d 33 31 0d 0a 31 30 35 37 0d 0a 36 36 39 32 0d  -31..1057..6692.
24d80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24d90 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
24da0 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 63  NCT + col1 - - c
24db0 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 * col1 FROM 
24dc0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 33  tab2..----..1593
24dd0 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a 0d 0a 6f 6e  ..663..868....on
24de0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
24df0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
24e00 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
24e10 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
24e20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24e30 20 6c 61 62 65 6c 2d 31 30 38 31 0d 0a 53 45 4c   label-1081..SEL
24e40 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53  ECT DISTINCT CAS
24e50 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
24e60 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  D ) AS col1 FROM
24e70 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
24e80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
24e90 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
24ea0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
24eb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24ec0 74 20 6c 61 62 65 6c 2d 31 30 38 31 0d 0a 53 45  t label-1081..SE
24ed0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
24ee0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
24ef0 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46  EGER ) AS col1 F
24f00 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
24f10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
24f20 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
24f30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
24f40 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
24f50 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  col2 - col1 FROM
24f60 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   tab2..----..-15
24f70 39 33 0d 0a 2d 36 36 33 0d 0a 2d 38 36 38 0d 0a  93..-663..-868..
24f80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24f90 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 32 33  t..SELECT + - 23
24fa0 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   - + col1 AS col
24fb0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
24fc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d 0a  or0..----..-40..
24fd0 2d 35 34 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72  -54..-82....quer
24fe0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24ff0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
25000 20 63 6f 6c 32 20 2a 20 33 31 20 2b 20 2d 20 63   col2 * 31 + - c
25010 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
25020 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
25030 34 37 0d 0a 2d 32 36 33 31 0d 0a 2d 36 36 0d 0a  47..-2631..-66..
25040 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25050 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
25060 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT - + cor0.col1
25070 20 2a 20 36 32 20 2b 20 63 6f 6c 30 20 2a 20 2d   * 62 + col0 * -
25080 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
25090 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
250a0 2d 2d 0d 0a 2d 31 32 39 34 30 0d 0a 2d 36 30 34  --..-12940..-604
250b0 39 0d 0a 2d 36 31 32 34 0d 0a 0d 0a 6f 6e 6c 79  9..-6124....only
250c0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
250d0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
250e0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
250f0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
25100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
25110 61 62 65 6c 2d 31 30 38 36 0d 0a 53 45 4c 45 43  abel-1086..SELEC
25120 54 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  T + + CAST( NULL
25130 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 28   AS SIGNED ) - (
25140 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 43   cor0.col2 + - C
25150 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
25160 49 4d 41 4c 20 29 20 29 20 2f 20 63 6f 6c 32 20  IMAL ) ) / col2 
25170 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
25180 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
25190 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
251a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
251b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
251c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
251d0 6c 2d 31 30 38 36 0d 0a 53 45 4c 45 43 54 20 2b  l-1086..SELECT +
251e0 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
251f0 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 28 20  S INTEGER ) - ( 
25200 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 43 41  cor0.col2 + - CA
25210 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
25220 4c 20 29 20 29 20 2f 20 63 6f 6c 32 20 46 52 4f  L ) ) / col2 FRO
25230 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
25240 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
25250 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
25260 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
25270 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
25280 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
25290 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
252a0 6c 61 62 65 6c 2d 31 30 38 37 0d 0a 53 45 4c 45  label-1087..SELE
252b0 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 31 38 20  CT ALL - - ( 18 
252c0 29 20 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 63  ) + col2 DIV + c
252d0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
252e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
252f0 2d 2d 2d 0d 0a 31 38 0d 0a 31 38 0d 0a 31 38 0d  ---..18..18..18.
25300 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
25310 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
25320 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25330 74 20 6c 61 62 65 6c 2d 31 30 38 37 0d 0a 53 45  t label-1087..SE
25340 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 28 20 31  LECT ALL - - ( 1
25350 38 20 29 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63  8 ) + col2 / + c
25360 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
25370 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
25380 2d 2d 2d 0d 0a 31 38 0d 0a 31 38 0d 0a 31 38 0d  ---..18..18..18.
25390 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
253a0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
253b0 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  or0.col0 * cor0.
253c0 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 30 20 41 53  col0 - + col0 AS
253d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
253e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36  cor0..----..-126
253f0 30 0d 0a 2d 36 30 30 0d 0a 2d 38 30 31 30 0d 0a  0..-600..-8010..
25400 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
25410 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
25420 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
25430 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
25440 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61  SS JOIN tab0, ta
25450 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31  b2 AS cor1, tab1
25460 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
25470 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69  972 values hashi
25480 6e 67 20 74 6f 20 37 35 61 38 31 33 65 62 64 35  ng to 75a813ebd5
25490 65 63 35 65 63 32 65 36 37 61 36 36 64 30 35 39  ec5ec2e67a66d059
254a0 33 66 66 37 36 33 0d 0a 0d 0a 71 75 65 72 79 20  3ff763....query 
254b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
254c0 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  T + + col2 * + c
254d0 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 * col2 FROM 
254e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
254f0 2d 2d 0d 0a 31 35 37 34 36 34 0d 0a 31 38 35 31  --..157464..1851
25500 39 33 0d 0a 38 38 34 37 33 36 0d 0a 0d 0a 71 75  93..884736....qu
25510 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25520 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63  ELECT + + cor0.c
25530 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
25540 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
25550 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
25560 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
25570 35 62 39 36 63 61 31 64 62 65 32 65 33 39 61 30  5b96ca1dbe2e39a0
25580 66 61 37 38 66 35 30 64 33 37 34 66 35 31 61 0d  fa78f50d374f51a.
25590 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
255a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
255b0 4e 43 54 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c  NCT - col2 - col
255c0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
255d0 2d 0d 0a 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35  -..-171..-36..-5
255e0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
255f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
25600 6f 6c 32 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30  ol2 + + ( + col0
25610 20 29 20 2b 20 32 35 20 2a 20 2d 20 36 38 20 46   ) + 25 * - 68 F
25620 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
25630 2d 31 35 38 33 0d 0a 2d 31 35 39 36 0d 0a 2d 31  -1583..-1596..-1
25640 36 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  666....query I r
25650 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
25660 49 53 54 49 4e 43 54 20 2d 20 74 61 62 32 2e 63  ISTINCT - tab2.c
25670 6f 6c 32 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c  ol2 + - tab2.col
25680 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
25690 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a  ab2..----..-52..
256a0 2d 35 34 0d 0a 2d 37 36 0d 0a 0d 0a 6f 6e 6c 79  -54..-76....only
256b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
256c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
256d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
256e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
256f0 74 20 6c 61 62 65 6c 2d 31 30 39 35 0d 0a 53 45  t label-1095..SE
25700 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 28 20  LECT + col0 + ( 
25710 2d 20 63 6f 6c 31 20 29 20 44 49 56 20 2b 20 39  - col1 ) DIV + 9
25720 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  3 AS col1 FROM t
25730 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34  ab1..----..3..64
25740 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..80....skipif m
25750 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
25760 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
25770 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39  owsort label-109
25780 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  5..SELECT + col0
25790 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 2f 20   + ( - col1 ) / 
257a0 2b 20 39 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 93 AS col1 FRO
257b0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  M tab1..----..3.
257c0 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .64..80....query
257d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
257e0 43 54 20 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  CT 0 * cor0.col0
257f0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
25800 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25810 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
25820 20 74 6f 20 38 62 37 35 31 33 36 62 32 62 35 31   to 8b75136b2b51
25830 63 37 37 33 34 35 63 30 33 38 30 34 65 63 31 63  c77345c03804ec1c
25840 64 61 35 63 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  da5c....onlyif m
25850 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
25860 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
25870 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
25880 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25890 62 65 6c 2d 31 30 39 37 0d 0a 53 45 4c 45 43 54  bel-1097..SELECT
258a0 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2b 20   ALL + col1 + + 
258b0 31 35 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 44  15 * cor0.col1 D
258c0 49 56 20 2d 20 33 35 20 46 52 4f 4d 20 74 61 62  IV - 35 FROM tab
258d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
258e0 0a 35 30 0d 0a 35 32 0d 0a 35 36 0d 0a 0d 0a 73  .50..52..56....s
258f0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
25900 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
25910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25920 62 65 6c 2d 31 30 39 37 0d 0a 53 45 4c 45 43 54  bel-1097..SELECT
25930 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 2b 20   ALL + col1 + + 
25940 31 35 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2f  15 * cor0.col1 /
25950 20 2d 20 33 35 20 46 52 4f 4d 20 74 61 62 30 20   - 35 FROM tab0 
25960 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
25970 30 0d 0a 35 32 0d 0a 35 36 0d 0a 0d 0a 73 6b 69  0..52..56....ski
25980 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
25990 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
259a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
259b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
259c0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
259d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
259e0 4c 20 33 31 20 2b 20 2b 20 63 6f 6c 30 20 63 6f  L 31 + + col0 co
259f0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
25a00 2d 2d 0d 0a 31 30 39 0d 0a 31 31 30 0d 0a 33 38  --..109..110..38
25a10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
25a20 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
25a30 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
25a40 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
25a50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25a60 31 30 39 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1099..SELECT - c
25a70 6f 6c 30 20 44 49 56 20 2d 20 34 32 20 41 53 20  ol0 DIV - 42 AS 
25a80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
25a90 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 0d 0a 0d  ----..0..1..1...
25aa0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
25ab0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
25ac0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
25ad0 6c 61 62 65 6c 2d 31 30 39 39 0d 0a 53 45 4c 45  label-1099..SELE
25ae0 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2d 20 34 32  CT - col0 / - 42
25af0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
25b00 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  b2..----..0..1..
25b10 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
25b20 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
25b30 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
25b40 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
25b50 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
25b60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
25b70 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  00..SELECT ALL +
25b80 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53   CAST( + col2 AS
25b90 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f   SIGNED ) + - co
25ba0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
25bb0 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a  --..-34..-7..9..
25bc0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
25bd0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
25be0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25bf0 20 6c 61 62 65 6c 2d 31 31 30 30 0d 0a 53 45 4c   label-1100..SEL
25c00 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
25c10 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   + col2 AS INTEG
25c20 45 52 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52  ER ) + - col0 FR
25c30 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
25c40 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75 65  34..-7..9....que
25c50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
25c60 4c 45 43 54 20 41 4c 4c 20 2d 20 33 34 20 2a 20  LECT ALL - 34 * 
25c70 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
25c80 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
25c90 32 39 32 0d 0a 2d 38 38 34 0d 0a 2d 39 31 38 0d  292..-884..-918.
25ca0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25cb0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
25cc0 4e 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  NCT col1 + + col
25cd0 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * + cor0.col0 
25ce0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  - col0 * + col1 
25cf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
25d00 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  0..----..10..13.
25d10 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .26....onlyif my
25d20 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
25d30 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
25d40 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
25d50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25d60 65 6c 2d 31 31 30 33 0d 0a 53 45 4c 45 43 54 20  el-1103..SELECT 
25d70 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b  ALL + - col2 * +
25d80 20 37 39 20 2b 20 2d 20 36 33 20 44 49 56 20 63   79 + - 63 DIV c
25d90 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
25da0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
25db0 2d 2d 2d 0d 0a 2d 31 34 32 0d 0a 2d 32 36 30 38  ---..-142..-2608
25dc0 0d 0a 2d 36 34 37 38 0d 0a 0d 0a 73 6b 69 70 69  ..-6478....skipi
25dd0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25de0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25df0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25e00 31 31 30 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1103..SELECT ALL
25e10 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 37 39   + - col2 * + 79
25e20 20 2b 20 2d 20 36 33 20 2f 20 63 6f 6c 32 20 41   + - 63 / col2 A
25e30 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
25e40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25e50 2d 31 34 32 0d 0a 2d 32 36 30 38 0d 0a 2d 36 34  -142..-2608..-64
25e60 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
25e70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
25e80 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  L + col2 * col2 
25e90 2b 20 38 34 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 84 AS col0 FRO
25ea0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
25eb0 2d 2d 2d 2d 0d 0a 31 35 32 38 0d 0a 37 36 30 0d  ----..1528..760.
25ec0 0a 38 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .813....query I 
25ed0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25ee0 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ALL - col0 * col
25ef0 32 20 2b 20 36 30 20 41 53 20 63 6f 6c 32 20 46  2 + 60 AS col2 F
25f00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
25f10 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 0d 0a 2d 31  ..----..-129..-1
25f20 39 36 38 0d 0a 2d 32 39 34 32 0d 0a 0d 0a 6f 6e  968..-2942....on
25f30 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
25f40 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
25f50 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
25f60 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
25f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25f80 20 6c 61 62 65 6c 2d 31 31 30 36 0d 0a 53 45 4c   label-1106..SEL
25f90 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2d  ECT ALL col0 + -
25fa0 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53   CAST( + col2 AS
25fb0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
25fc0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
25fd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33  or0..----..-9..3
25fe0 34 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  4..7....skipif m
25ff0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
26000 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
26010 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30  owsort label-110
26020 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  6..SELECT ALL co
26030 6c 30 20 2b 20 2d 20 43 41 53 54 20 28 20 2b 20  l0 + - CAST ( + 
26040 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
26050 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
26060 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26070 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a  -..-9..34..7....
26080 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26090 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 30 20  .SELECT ALL + 0 
260a0 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
260b0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
260c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
260d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
260e0 20 34 38 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20   48 * tab0.col0 
260f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
26100 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a  0..----..-1152..
26110 2d 31 36 38 30 0d 0a 2d 34 32 37 32 0d 0a 0d 0a  -1680..-4272....
26120 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
26130 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
26140 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
26150 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
26160 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
26170 72 74 20 6c 61 62 65 6c 2d 31 31 30 39 0d 0a 53  rt label-1109..S
26180 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  ELECT CAST( NULL
26190 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b   AS SIGNED ) * +
261a0 20 38 39 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   89 FROM tab1, t
261b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
261c0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
261d0 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65  ing to cd7a7901e
261e0 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64  47c15155404aff0d
261f0 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69  216fe0b....skipi
26200 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
26210 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
26220 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
26230 31 31 30 39 0d 0a 53 45 4c 45 43 54 20 43 41 53  1109..SELECT CAS
26240 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
26250 47 45 52 20 29 20 2a 20 2b 20 38 39 20 46 52 4f  GER ) * + 89 FRO
26260 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
26270 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
26280 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
26290 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
262a0 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
262b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
262c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
262d0 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r1.col2 AS col0 
262e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
262f0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
26300 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  1, tab1 AS cor1.
26310 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
26320 20 68 61 73 68 69 6e 67 20 74 6f 20 34 34 66 64   hashing to 44fd
26330 63 64 37 63 64 36 30 33 33 35 32 64 34 64 31 32  cd7cd603352d4d12
26340 37 38 31 31 64 31 36 34 63 63 31 65 0d 0a 0d 0a  7811d164cc1e....
26350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26360 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
26370 20 2a 20 35 30 20 41 53 20 63 6f 6c 31 20 46 52   * 50 AS col1 FR
26380 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
26390 2d 2d 0d 0a 33 35 30 0d 0a 33 39 30 30 0d 0a 33  --..350..3900..3
263a0 39 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  950....query I r
263b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
263c0 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30  ISTINCT + + col0
263d0 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 35 37   + - col1 * - 57
263e0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
263f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
26400 0d 0a 31 30 34 38 0d 0a 31 37 37 34 0d 0a 33 34  ..1048..1774..34
26410 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  41....query I ro
26420 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
26430 63 6f 6c 30 20 2a 20 2d 20 39 32 20 46 52 4f 4d  col0 * - 92 FROM
26440 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
26450 2d 2d 2d 0d 0a 32 37 36 0d 0a 35 38 38 38 0d 0a  ---..276..5888..
26460 37 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7360....query I 
26470 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26480 41 4c 4c 20 63 6f 6c 32 20 2a 20 33 31 20 2b 20  ALL col2 * 31 + 
26490 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col1 * - col2 FR
264a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
264b0 0a 2d 2d 2d 2d 0d 0a 31 31 39 37 0d 0a 31 37 32  .----..1197..172
264c0 38 0d 0a 32 37 30 0d 0a 0d 0a 71 75 65 72 79 20  8..270....query 
264d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
264e0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
264f0 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 + - cor0.col1 
26500 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
26510 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
26520 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .0....skipif pos
26530 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
26540 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
26550 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
26560 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
26570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26580 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20  SELECT - - col1 
26590 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 37 35 20  + + col2 * + 75 
265a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
265b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 30 39 0d  or0..----..2009.
265c0 0a 32 30 35 36 0d 0a 32 38 36 37 0d 0a 0d 0a 73  .2056..2867....s
265d0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
265e0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
265f0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
26600 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
26610 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
26620 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26630 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  - col2 * + col0 
26640 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
26650 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
26660 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
26670 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26680 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
26690 63 6f 6c 32 20 2a 20 2d 20 28 20 2d 20 63 6f 6c  col2 * - ( - col
266a0 31 20 2a 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  1 * col1 ) FROM 
266b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
266c0 2d 2d 0d 0a 32 34 34 30 36 38 0d 0a 36 37 39 30  --..244068..6790
266d0 34 32 0d 0a 39 34 30 39 0d 0a 0d 0a 6f 6e 6c 79  42..9409....only
266e0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
266f0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
26700 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
26710 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
26720 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26730 61 62 65 6c 2d 31 31 31 39 0d 0a 53 45 4c 45 43  abel-1119..SELEC
26740 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20 2a  T ALL + + col2 *
26750 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
26760 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
26770 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
26780 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
26790 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
267a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
267b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
267c0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31 39 0d 0a  ort label-1119..
267d0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
267e0 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 4e 55 4c  ol2 * CAST ( NUL
267f0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
26800 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26810 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
26820 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
26830 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26840 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d  ECT - - col1 * -
26850 20 33 36 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   36 FROM tab1 co
26860 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 30 0d 0a  r0..----..-360..
26870 2d 34 36 38 0d 0a 2d 39 33 36 0d 0a 0d 0a 71 75  -468..-936....qu
26880 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26890 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
268a0 20 2b 20 2b 20 37 39 20 41 53 20 63 6f 6c 31 20   + + 79 AS col1 
268b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
268c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a 31 35  0..----..157..15
268d0 38 0d 0a 38 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..86....onlyif 
268e0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
268f0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
26900 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
26910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
26920 61 62 65 6c 2d 31 31 32 32 0d 0a 53 45 4c 45 43  abel-1122..SELEC
26930 54 20 63 6f 6c 30 20 44 49 56 20 74 61 62 32 2e  T col0 DIV tab2.
26940 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
26950 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab2..----..1.
26960 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
26970 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26980 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26990 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
269a0 32 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  22..SELECT col0 
269b0 2f 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63  / tab2.col0 AS c
269c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
269d0 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
269e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
269f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 31 20 2a  .SELECT ALL 41 *
26a00 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
26a10 0a 2d 2d 2d 2d 0d 0a 32 32 31 34 0d 0a 32 33 33  .----..2214..233
26a20 37 0d 0a 33 39 33 36 0d 0a 0d 0a 71 75 65 72 79  7..3936....query
26a30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26a40 43 54 20 41 4c 4c 20 39 38 20 41 53 20 63 6f 6c  CT ALL 98 AS col
26a50 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
26a60 2d 0d 0a 39 38 0d 0a 39 38 0d 0a 39 38 0d 0a 0d  -..98..98..98...
26a70 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
26a80 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
26a90 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
26aa0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
26ab0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
26ac0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26ad0 54 20 2d 20 34 38 20 63 6f 6c 32 20 46 52 4f 4d  T - 48 col2 FROM
26ae0 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
26af0 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
26b00 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
26b10 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 35  es hashing to 25
26b20 35 38 37 33 35 65 61 61 32 35 38 61 30 38 35 39  58735eaa258a0859
26b30 32 61 65 66 39 64 33 33 30 32 30 63 31 38 0d 0a  2aef9d33020c18..
26b40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26b50 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
26b60 34 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  42 FROM tab1, ta
26b70 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
26b80 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
26b90 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 32 35  s hashing to 325
26ba0 61 61 64 61 32 32 33 39 62 36 66 65 31 66 65 32  aada2239b6fe1fe2
26bb0 64 38 34 33 35 31 35 61 65 38 63 35 65 0d 0a 0d  d843515ae8c5e...
26bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26bd0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26be0 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T - col2 * + col
26bf0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
26c00 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  ab0..----..-1..-
26c10 31 30 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 6f  1089..-6724....o
26c20 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
26c30 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
26c40 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
26c50 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
26c60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26c70 74 20 6c 61 62 65 6c 2d 31 31 32 38 0d 0a 53 45  t label-1128..SE
26c80 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20  LECT CAST( NULL 
26c90 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
26ca0 32 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  20 FROM tab2, ta
26cb0 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b1 AS cor0, tab0
26cc0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
26cd0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
26ce0 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65  g to 16be8868a1e
26cf0 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37  6f4e8850509f9327
26d00 61 66 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  afe90....skipif 
26d10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26d20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26d30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
26d40 32 38 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  28..SELECT CAST 
26d50 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
26d60 52 20 29 20 2a 20 2d 20 32 30 20 46 52 4f 4d 20  R ) * - 20 FROM 
26d70 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
26d80 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
26d90 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
26da0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 36 62  s hashing to 16b
26db0 65 38 38 36 38 61 31 65 36 66 34 65 38 38 35 30  e8868a1e6f4e8850
26dc0 35 30 39 66 39 33 32 37 61 66 65 39 30 0d 0a 0d  509f9327afe90...
26dd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26de0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 31 2e  ..SELECT + cor1.
26df0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
26e00 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
26e10 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f  cor0, tab0 AS co
26e20 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
26e30 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32  ues hashing to 2
26e40 64 36 64 33 30 33 31 64 66 65 39 30 65 30 63 30  d6d3031dfe90e0c0
26e50 32 64 62 31 33 61 61 36 33 39 39 33 62 66 64 0d  2db13aa63993bfd.
26e60 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
26e70 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
26e80 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
26e90 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
26ea0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
26eb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26ec0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32  ECT DISTINCT + 2
26ed0 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  6 col2 FROM tab0
26ee0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
26ef0 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61  tab2 AS cor1, ta
26f00 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b2 AS cor2..----
26f10 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..26....skipif p
26f20 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
26f30 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
26f40 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
26f50 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
26f60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26f70 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 37 34 20  ..SELECT + + 74 
26f80 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  + col1 col0 FROM
26f90 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
26fa0 2d 2d 2d 0d 0a 31 30 30 0d 0a 38 34 0d 0a 38 37  ---..100..84..87
26fb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26fc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
26fd0 6c 32 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 - col1 AS col
26fe0 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
26ff0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d  ..----..-33..-4.
27000 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .21....query I r
27010 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
27020 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
27030 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72   cor0.col1 + cor
27040 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
27050 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27060 31 31 32 30 0d 0a 37 30 34 0d 0a 38 31 0d 0a 0d  1120..704..81...
27070 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
27080 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
27090 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
270a0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
270b0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
270c0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 34 0d 0a  ort label-1134..
270d0 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20  SELECT + + col0 
270e0 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  / CAST( NULL AS 
270f0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
27100 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b2 cor0..----..N
27110 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
27120 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
27130 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
27140 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27150 74 20 6c 61 62 65 6c 2d 31 31 33 34 0d 0a 53 45  t label-1134..SE
27160 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f 20  LECT + + col0 / 
27170 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
27180 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
27190 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b2 cor0..----..N
271a0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
271b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
271c0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
271d0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
271e0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
271f0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
27200 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 35  wsort label-1135
27210 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
27220 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  + - CAST( NULL A
27230 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 72  S SIGNED ) * cor
27240 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
27250 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
27260 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
27270 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
27280 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
27290 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
272a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
272b0 33 35 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  35..SELECT - col
272c0 31 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  1 + - CAST ( NUL
272d0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  L AS INTEGER ) *
272e0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
272f0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l0 FROM tab2 cor
27300 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
27310 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
27320 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27330 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  LECT + col2 + - 
27340 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
27350 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
27360 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27370 0a 2d 32 30 33 31 0d 0a 2d 33 33 39 34 0d 0a 2d  .-2031..-3394..-
27380 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8017....query I 
27390 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
273a0 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  - - cor0.col2 * 
273b0 2b 20 39 34 20 2b 20 34 33 20 46 52 4f 4d 20 74  + 94 + 43 FROM t
273c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
273d0 2d 0d 0a 32 34 38 37 0d 0a 32 35 38 31 0d 0a 33  -..2487..2581..3
273e0 36 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  615....query I r
273f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
27400 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b   col2 * - col2 +
27410 20 2d 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63   - ( col1 ) AS c
27420 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
27430 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 36   cor0..----..-96
27440 0d 0a 31 30 30 33 0d 0a 36 36 33 33 0d 0a 0d 0a  ..1003..6633....
27450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27460 0a 53 45 4c 45 43 54 20 31 37 20 2a 20 63 6f 6c  .SELECT 17 * col
27470 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
27480 2d 0d 0a 31 30 30 33 0d 0a 32 38 39 0d 0a 35 32  -..1003..289..52
27490 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
274a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
274b0 6f 6c 31 20 2a 20 33 20 2b 20 31 36 20 2d 20 2b  ol1 * 3 + 16 - +
274c0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
274d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
274e0 2d 2d 0d 0a 2d 31 31 0d 0a 2d 34 31 0d 0a 34 30  --..-11..-41..40
274f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27500 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
27510 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2b  INCT tab0.col0 +
27520 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32   - col2 + - col2
27530 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
27540 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 34 37 0d 0a  0..----..-2847..
27550 2d 36 33 0d 0a 2d 37 34 35 35 0d 0a 0d 0a 71 75  -63..-7455....qu
27560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27570 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b  ELECT + + col0 +
27580 20 2d 20 63 6f 6c 30 20 2a 20 37 37 20 2d 20 63   - col0 * 77 - c
27590 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
275a0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
275b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
275c0 2d 0d 0a 2d 31 33 32 36 0d 0a 2d 33 31 35 0d 0a  -..-1326..-315..
275d0 2d 34 36 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -4661....onlyif 
275e0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
275f0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
27600 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
27610 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
27620 61 62 65 6c 2d 31 31 34 33 0d 0a 53 45 4c 45 43  abel-1143..SELEC
27630 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 44 49 56  T ALL + col2 DIV
27640 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62 31   - col2 + - tab1
27650 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d  .col0 FROM tab1.
27660 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 36 35 0d 0a  .----..-4..-65..
27670 2d 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -81....skipif my
27680 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
27690 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
276a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 33  wsort label-1143
276b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
276c0 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 2d  ol2 / - col2 + -
276d0 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
276e0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a  tab1..----..-4..
276f0 2d 36 35 0d 0a 2d 38 31 0d 0a 0d 0a 71 75 65 72  -65..-81....quer
27700 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27710 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
27720 20 36 36 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b   66 * + col1 + +
27730 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
27740 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
27750 37 36 32 0d 0a 36 30 39 37 0d 0a 36 34 39 39 0d  762..6097..6499.
27760 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27770 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
27780 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f   ( col2 ) * + co
27790 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l2 + col0 * - co
277a0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
277b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37  cor0..----..-137
277c0 35 0d 0a 2d 33 33 39 34 0d 0a 2d 39 37 35 0d 0a  5..-3394..-975..
277d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
277e0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
277f0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
27800 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
27810 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
27820 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 36 0d  sort label-1146.
27830 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 35 20 2b  .SELECT ALL 65 +
27840 20 34 39 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 43   49 * + col1 * C
27850 41 53 54 28 20 2b 20 63 6f 6c 30 20 41 53 20 53  AST( + col0 AS S
27860 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
27870 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
27880 0a 33 31 34 32 35 0d 0a 33 38 38 37 0d 0a 35 31  .31425..3887..51
27890 30 32 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  025....skipif my
278a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
278b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
278c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 36  wsort label-1146
278d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 35 20  ..SELECT ALL 65 
278e0 2b 20 34 39 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  + 49 * + col1 * 
278f0 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53  CAST ( + col0 AS
27900 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
27910 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
27920 2d 2d 0d 0a 33 31 34 32 35 0d 0a 33 38 38 37 0d  --..31425..3887.
27930 0a 35 31 30 32 35 0d 0a 0d 0a 71 75 65 72 79 20  .51025....query 
27940 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27950 54 20 32 38 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  T 28 * - col0 + 
27960 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
27970 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
27980 2d 0d 0a 2d 32 34 30 33 0d 0a 2d 36 34 38 0d 0a  -..-2403..-648..
27990 2d 39 34 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -945....onlyif m
279a0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
279b0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
279c0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
279d0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
279e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
279f0 2d 31 31 34 38 0d 0a 53 45 4c 45 43 54 20 44 49  -1148..SELECT DI
27a00 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 4e  STINCT - CAST( N
27a10 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
27a20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  + + col1 * + col
27a30 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
27a40 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
27a50 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
27a60 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
27a70 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
27a80 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
27a90 31 31 34 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  1148..SELECT DIS
27aa0 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e  TINCT - CAST ( N
27ab0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
27ac0 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
27ad0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
27ae0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
27af0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
27b00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27b10 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f  ECT ALL + ( - co
27b20 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c  r0.col0 ) AS col
27b30 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
27b40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d  or0..----..-3..-
27b50 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69  64..-80....skipi
27b60 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
27b70 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
27b80 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
27b90 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
27ba0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
27bb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
27bc0 2d 20 2b 20 38 34 20 63 6f 6c 32 20 46 52 4f 4d  - + 84 col2 FROM
27bd0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
27be0 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 38 34 0d 0a 2d  ---..-84..-84..-
27bf0 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  84....onlyif mys
27c00 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
27c10 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
27c20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
27c30 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
27c40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
27c50 31 35 31 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  151..SELECT CAST
27c60 28 20 38 39 20 41 53 20 53 49 47 4e 45 44 20 29  ( 89 AS SIGNED )
27c70 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   + col1 col1 FRO
27c80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27c90 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 31 35 0d 0a  ----..102..115..
27ca0 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  99....skipif pos
27cb0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
27cc0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
27cd0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
27ce0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
27cf0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
27d00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
27d10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27d20 62 65 6c 2d 31 31 35 31 0d 0a 53 45 4c 45 43 54  bel-1151..SELECT
27d30 20 43 41 53 54 20 28 20 38 39 20 41 53 20 49 4e   CAST ( 89 AS IN
27d40 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31 20 63  TEGER ) + col1 c
27d50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
27d60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32   cor0..----..102
27d70 0d 0a 31 31 35 0d 0a 39 39 0d 0a 0d 0a 71 75 65  ..115..99....que
27d80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27d90 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
27da0 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  0 + - col2 * - c
27db0 6f 6c 32 20 2a 20 2d 20 33 30 20 41 53 20 63 6f  ol2 * - 30 AS co
27dc0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
27dd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 32  cor0..----..-202
27de0 30 32 0d 0a 2d 32 31 38 36 33 0d 0a 2d 34 33 32  02..-21863..-432
27df0 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  41....query I ro
27e00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
27e10 53 54 49 4e 43 54 20 28 20 63 6f 6c 31 20 29 20  STINCT ( col1 ) 
27e20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  + col2 * + col2 
27e30 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
27e40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 36  0..----..1175..6
27e50 38 31 35 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79 69  815..98....onlyi
27e60 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
27e70 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
27e80 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
27e90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27ea0 20 6c 61 62 65 6c 2d 31 31 35 34 0d 0a 53 45 4c   label-1154..SEL
27eb0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
27ec0 30 20 44 49 56 20 2b 20 33 33 20 63 6f 6c 31 20  0 DIV + 33 col1 
27ed0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
27ee0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 32  0..----..0..1..2
27ef0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
27f00 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
27f10 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
27f20 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
27f30 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
27f40 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
27f50 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
27f60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
27f70 6c 2d 31 31 35 34 0d 0a 53 45 4c 45 43 54 20 44  l-1154..SELECT D
27f80 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20 2b  ISTINCT col0 / +
27f90 20 33 33 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   33 col1 FROM ta
27fa0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
27fb0 0d 0a 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65  ..0..1..2....que
27fc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27fd0 4c 45 43 54 20 41 4c 4c 20 2b 20 37 31 20 2b 20  LECT ALL + 71 + 
27fe0 2d 20 37 36 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 76 AS col1 FRO
27ff0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
28000 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35 0d 0a 2d 35  ----..-5..-5..-5
28010 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 31  ort..SELECT + 41
28030 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
28040 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
28050 0d 0a 34 31 0d 0a 34 31 0d 0a 34 31 0d 0a 0d 0a  ..41..41..41....
28060 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
28070 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
28080 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
28090 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
280a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 37  wsort label-1157
280b0 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
280c0 6f 72 30 2e 63 6f 6c 32 20 29 20 44 49 56 20 2b  or0.col2 ) DIV +
280d0 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
280e0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
280f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
28100 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
28110 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
28120 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
28130 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 37  wsort label-1157
28140 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 63  ..SELECT + ( + c
28150 6f 72 30 2e 63 6f 6c 32 20 29 20 2f 20 2b 20 63  or0.col2 ) / + c
28160 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
28170 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
28180 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
28190 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
281a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 32 20  sort..SELECT 12 
281b0 2a 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 74 61  * tab0.col0 * ta
281c0 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  b0.col2 AS col2 
281d0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
281e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
281f0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
28200 74 6f 20 63 36 64 64 61 31 35 61 62 65 34 33 63  to c6dda15abe43c
28210 31 36 37 65 39 35 33 39 65 64 37 61 63 62 38 66  167e9539ed7acb8f
28220 63 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  c28....query I r
28230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
28240 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63  ISTINCT + cor0.c
28250 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
28260 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
28270 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
28280 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
28290 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  1..----..10..13.
282a0 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .26....query I r
282b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
282c0 49 53 54 49 4e 43 54 20 2b 20 36 32 20 2b 20 63  ISTINCT + 62 + c
282d0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol0 * + col1 AS 
282e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
282f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
28300 30 35 0d 0a 32 37 39 0d 0a 34 36 36 34 0d 0a 0d  05..279..4664...
28310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28320 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
28330 54 20 2d 20 36 35 20 2b 20 2b 20 63 6f 6c 30 20  T - 65 + + col0 
28340 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
28350 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28360 31 39 39 39 0d 0a 33 33 33 30 0d 0a 38 30 33 34  1999..3330..8034
28370 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28380 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
28390 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
283a0 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 31 31  l0 - col1 * + 11
283b0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
283c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
283d0 0d 0a 2d 31 31 30 32 0d 0a 2d 31 37 33 38 0d 0a  ..-1102..-1738..
283e0 2d 38 32 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -8299....onlyif 
283f0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
28400 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
28410 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
28420 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
28430 61 62 65 6c 2d 31 31 36 33 0d 0a 53 45 4c 45 43  abel-1163..SELEC
28440 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
28450 30 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d  0 + - col2 DIV -
28460 20 37 34 20 2b 20 36 36 20 41 53 20 63 6f 6c 31   74 + 66 AS col1
28470 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
28480 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 34 37 0d  .----..130..147.
28490 0a 36 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .69....skipif my
284a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
284b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
284c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 33  wsort label-1163
284d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
284e0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  or0.col0 + - col
284f0 32 20 2f 20 2d 20 37 34 20 2b 20 36 36 20 41 53  2 / - 74 + 66 AS
28500 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
28510 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d  cor0..----..130.
28520 0a 31 34 37 0d 0a 36 39 0d 0a 0d 0a 73 6b 69 70  .147..69....skip
28530 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
28540 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
28550 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
28560 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
28570 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
28580 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28590 54 49 4e 43 54 20 2b 20 32 35 20 63 6f 6c 30 20  TINCT + 25 col0 
285a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
285b0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 0d 0a 71  0..----..25....q
285c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
285d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
285e0 39 34 20 2a 20 2d 20 35 39 20 41 53 20 63 6f 6c  94 * - 59 AS col
285f0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
28600 2d 0d 0a 2d 35 35 34 36 0d 0a 0d 0a 71 75 65 72  -..-5546....quer
28610 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
28620 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
28630 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63  ol2 * - col2 + c
28640 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
28650 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
28660 2d 2d 2d 0d 0a 2d 31 34 30 36 0d 0a 2d 36 35 30  ---..-1406..-650
28670 0d 0a 2d 37 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-702....onlyif
28680 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
28690 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
286a0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
286b0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
286c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
286d0 65 6c 2d 31 31 36 37 0d 0a 53 45 4c 45 43 54 20  el-1167..SELECT 
286e0 41 4c 4c 20 2b 20 43 41 53 54 28 20 63 6f 6c 32  ALL + CAST( col2
286f0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63   AS SIGNED ) * c
28700 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
28710 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   tab0..----..1..
28720 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 73 6b  1089..6724....sk
28730 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
28740 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
28750 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28760 65 6c 2d 31 31 36 37 0d 0a 53 45 4c 45 43 54 20  el-1167..SELECT 
28770 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 63 6f 6c  ALL + CAST ( col
28780 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a  2 AS INTEGER ) *
28790 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
287a0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
287b0 0d 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a  ..1089..6724....
287c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
287d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
287e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
287f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
28800 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 38  wsort label-1168
28810 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63 6f  ..SELECT tab1.co
28820 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  l0 * - col1 + co
28830 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52  l1 DIV - col1 FR
28840 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
28850 31 30 34 31 0d 0a 2d 36 34 31 0d 0a 2d 37 39 0d  1041..-641..-79.
28860 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
28870 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
28880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28890 74 20 6c 61 62 65 6c 2d 31 31 36 38 0d 0a 53 45  t label-1168..SE
288a0 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 2a  LECT tab1.col0 *
288b0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f   - col1 + col1 /
288c0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
288d0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 31 0d 0a  1..----..-1041..
288e0 2d 36 34 31 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65  -641..-79....que
288f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28900 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LECT + col0 * + 
28910 28 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20  ( + tab0.col2 + 
28920 74 61 62 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d  tab0.col1 ) FROM
28930 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   tab0..----..153
28940 39 37 0d 0a 32 38 35 36 0d 0a 33 34 33 30 0d 0a  97..2856..3430..
28950 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
28960 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
28970 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
28980 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
28990 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
289a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 30 0d  sort label-1170.
289b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54  .SELECT ALL CAST
289c0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
289d0 20 29 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   ) * col1 + col0
289e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
289f0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
28a00 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
28a10 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
28a20 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
28a30 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
28a40 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
28a50 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
28a60 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
28a70 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
28a80 72 74 20 6c 61 62 65 6c 2d 31 31 37 30 0d 0a 53  rt label-1170..S
28a90 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
28aa0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
28ab0 20 29 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   ) * col1 + col0
28ac0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
28ad0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
28ae0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
28af0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28b00 43 54 20 33 37 20 2a 20 35 37 20 46 52 4f 4d 20  CT 37 * 57 FROM 
28b10 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
28b20 2d 2d 0d 0a 32 31 30 39 0d 0a 32 31 30 39 0d 0a  --..2109..2109..
28b30 32 31 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2109....query I 
28b40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28b50 2d 20 28 20 2b 20 34 30 20 29 20 46 52 4f 4d 20  - ( + 40 ) FROM 
28b60 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
28b70 2d 2d 0d 0a 2d 34 30 0d 0a 2d 34 30 0d 0a 2d 34  --..-40..-40..-4
28b80 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28b90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28ba0 54 49 4e 43 54 20 2d 20 36 20 41 53 20 63 6f 6c  TINCT - 6 AS col
28bb0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
28bc0 2d 0d 0a 2d 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -..-6....onlyif 
28bd0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
28be0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
28bf0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
28c00 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
28c10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28c20 6c 2d 31 31 37 34 0d 0a 53 45 4c 45 43 54 20 41  l-1174..SELECT A
28c30 4c 4c 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  LL - CAST( NULL 
28c40 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 28 20  AS SIGNED ) + ( 
28c50 2b 20 74 61 62 32 2e 63 6f 6c 30 20 29 20 41 53  + tab2.col0 ) AS
28c60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
28c70 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
28c80 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
28c90 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
28ca0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
28cb0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
28cc0 31 31 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1174..SELECT ALL
28cd0 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
28ce0 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 28 20  S INTEGER ) + ( 
28cf0 2b 20 74 61 62 32 2e 63 6f 6c 30 20 29 20 41 53  + tab2.col0 ) AS
28d00 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
28d10 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
28d20 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
28d30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
28d40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
28d50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
28d60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28d70 20 6c 61 62 65 6c 2d 31 31 37 35 0d 0a 53 45 4c   label-1175..SEL
28d80 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  ECT + - col2 * c
28d90 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41 53 20  ol1 DIV col1 AS 
28da0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
28db0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
28dc0 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b  ..-33..-82....sk
28dd0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
28de0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
28df0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28e00 65 6c 2d 31 31 37 35 0d 0a 53 45 4c 45 43 54 20  el-1175..SELECT 
28e10 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  + - col2 * col1 
28e20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  / col1 AS col0 F
28e30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
28e40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d  ..----..-1..-33.
28e50 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
28e60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28e70 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ALL - + cor0.col
28e80 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
28e90 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
28ea0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
28eb0 67 20 74 6f 20 33 30 30 30 33 33 37 64 64 33 66  g to 3000337dd3f
28ec0 31 31 65 39 63 66 64 35 61 33 31 32 62 30 31 65  11e9cfd5a312b01e
28ed0 66 33 66 38 62 0d 0a 0d 0a 71 75 65 72 79 20 49  f3f8b....query I
28ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28ef0 20 2d 20 37 38 20 2b 20 63 6f 6c 30 20 41 53 20   - 78 + col0 AS 
28f00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
28f10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
28f20 34 0d 0a 2d 37 35 0d 0a 32 0d 0a 0d 0a 71 75 65  4..-75..2....que
28f30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28f40 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
28f50 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  * col0 + - col2 
28f60 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
28f70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
28f80 0a 31 36 32 0d 0a 32 30 30 32 0d 0a 32 39 36 34  .162..2002..2964
28f90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28fa0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
28fb0 49 4e 43 54 20 2b 20 2b 20 39 20 2d 20 63 6f 6c  INCT + + 9 - col
28fc0 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  1 * + col1 FROM 
28fd0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
28fe0 0a 2d 32 38 30 0d 0a 2d 33 34 37 32 0d 0a 2d 39  .-280..-3472..-9
28ff0 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  52....query I ro
29000 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
29010 4c 20 2b 20 28 20 2d 20 28 20 2d 20 63 6f 6c 31  L + ( - ( - col1
29020 20 29 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41   ) ) FROM tab0 A
29030 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36  S cor0..----..86
29040 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70  ..91..97....skip
29050 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
29060 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
29070 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29080 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20 34 35  CT + - CAST ( 45
29090 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2b 20 63   AS REAL ) * + c
290a0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 2b  ol2 * + col0 - +
290b0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
290c0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
290d0 2d 2d 0d 0a 2d 31 36 34 31 37 30 0d 0a 2d 33 34  --..-164170..-34
290e0 35 36 31 33 0d 0a 2d 37 33 31 36 0d 0a 0d 0a 6f  5613..-7316....o
290f0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
29100 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
29110 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
29120 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
29130 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 32 0d  sort label-1182.
29140 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56  .SELECT col2 DIV
29150 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   - col0 + - col0
29160 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
29170 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d  r0..----..-25..-
29180 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69 70 69  35..-89....skipi
29190 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
291a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
291b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
291c0 31 31 38 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1182..SELECT col
291d0 32 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  2 / - col0 + - c
291e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
291f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
29200 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75  ..-35..-89....qu
29210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29220 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28 20  ELECT ALL + - ( 
29230 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d  cor0.col2 ) FROM
29240 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29250 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d  ---..-54..-57..-
29260 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
29270 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
29280 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20  STINCT - col0 + 
29290 31 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  16 AS col2 FROM 
292a0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
292b0 0a 2d 34 38 0d 0a 2d 36 34 0d 0a 31 33 0d 0a 0d  .-48..-64..13...
292c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
292d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
292e0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   cor0.col0 + + c
292f0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
29300 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29310 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32  ---..-54..-67..2
29320 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
29330 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
29340 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
29350 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
29360 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
29370 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
29380 38 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43  86..SELECT ALL C
29390 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
293a0 4e 45 44 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c  NED ) + cor0.col
293b0 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  1 * col0 AS col0
293c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
293d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
293e0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
293f0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
29400 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
29410 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29420 65 6c 2d 31 31 38 36 0d 0a 53 45 4c 45 43 54 20  el-1186..SELECT 
29430 41 4c 4c 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  ALL CAST ( NULL 
29440 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
29450 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  or0.col1 * col0 
29460 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
29470 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
29480 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
29490 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
294a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
294b0 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20 46   col2 ) + col0 F
294c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
294d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a  ..----..-9..34..
294e0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
294f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
29500 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 31 33 20   cor0.col2 + 13 
29510 2a 20 2b 20 63 6f 6c 30 20 2a 20 33 35 20 2b 20  * + col0 * 35 + 
29520 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
29530 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29540 2d 2d 2d 0d 0a 31 33 36 35 0d 0a 32 39 31 32 30  ---..1365..29120
29550 0d 0a 33 36 34 30 30 0d 0a 0d 0a 73 6b 69 70 69  ..36400....skipi
29560 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
29570 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
29580 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
29590 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
295a0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
295b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
295c0 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   + - col2 + col2
295d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
295e0 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30  .----..3..64..80
295f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
29600 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
29610 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
29620 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
29630 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29640 31 31 39 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1190..SELECT ALL
29650 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30   col2 DIV - col0
29660 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 46   + - tab0.col1 F
29670 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
29680 2d 38 37 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d  -87..-91..-97...
29690 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
296a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
296b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
296c0 6c 61 62 65 6c 2d 31 31 39 30 0d 0a 53 45 4c 45  label-1190..SELE
296d0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20 2d 20  CT ALL col2 / - 
296e0 63 6f 6c 30 20 2b 20 2d 20 74 61 62 30 2e 63 6f  col0 + - tab0.co
296f0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
29700 2d 2d 0d 0a 2d 38 37 0d 0a 2d 39 31 0d 0a 2d 39  --..-87..-91..-9
29710 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
29720 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
29730 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
29740 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
29750 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
29760 2d 31 31 39 31 0d 0a 53 45 4c 45 43 54 20 63 6f  -1191..SELECT co
29770 6c 31 20 44 49 56 20 43 41 53 54 28 20 2b 20 38  l1 DIV CAST( + 8
29780 33 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 53 49  3 + + col1 AS SI
29790 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31  GNED ) FROM tab1
297a0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
297b0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
297c0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
297d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
297e0 74 20 6c 61 62 65 6c 2d 31 31 39 31 0d 0a 53 45  t label-1191..SE
297f0 4c 45 43 54 20 63 6f 6c 31 20 2f 20 43 41 53 54  LECT col1 / CAST
29800 20 28 20 2b 20 38 33 20 2b 20 2b 20 63 6f 6c 31   ( + 83 + + col1
29810 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
29820 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
29830 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
29840 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
29850 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
29860 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
29870 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
29880 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
29890 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
298a0 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20  2 + - tab1.col2 
298b0 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d  + col2 col0 FROM
298c0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d   tab1..----..54.
298d0 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .57..96....query
298e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
298f0 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  CT - col2 * col2
29900 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + + col0 FROM t
29910 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 35  ab0..----..-1065
29920 0d 0a 2d 36 36 33 35 0d 0a 33 34 0d 0a 0d 0a 71  ..-6635..34....q
29930 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29940 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e  SELECT ALL tab1.
29950 63 6f 6c 30 20 2d 20 2d 20 37 31 20 2a 20 38 32  col0 - - 71 * 82
29960 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
29970 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 38 32 35 0d 0a  b1..----..5825..
29980 35 38 38 36 0d 0a 35 39 30 32 0d 0a 0d 0a 71 75  5886..5902....qu
29990 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
299a0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
299b0 20 2b 20 32 37 20 2b 20 63 6f 6c 30 20 41 53 20   + 27 + col0 AS 
299c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
299d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33  S cor0..----..33
299e0 34 0d 0a 34 33 31 0d 0a 37 30 35 0d 0a 0d 0a 6f  4..431..705....o
299f0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
29a00 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
29a10 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
29a20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
29a30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29a40 74 20 6c 61 62 65 6c 2d 31 31 39 36 0d 0a 53 45  t label-1196..SE
29a50 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
29a60 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
29a70 45 44 20 29 20 2d 20 63 6f 6c 30 20 41 53 20 63  ED ) - col0 AS c
29a80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
29a90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
29aa0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
29ab0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29ac0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29ad0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 36 0d 0a  ort label-1196..
29ae0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29af0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
29b00 4e 54 45 47 45 52 20 29 20 2d 20 63 6f 6c 30 20  NTEGER ) - col0 
29b10 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
29b20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29b30 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
29b40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29b50 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20   DISTINCT - + ( 
29b60 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20  + col2 ) * col0 
29b70 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
29b80 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29b90 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37  .-162..-3648..-7
29ba0 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
29bb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
29bc0 4c 4c 20 2d 20 28 20 2d 20 36 39 20 29 20 2b 20  LL - ( - 69 ) + 
29bd0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
29be0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
29bf0 31 32 38 0d 0a 38 36 0d 0a 0d 0a 6f 6e 6c 79 69  128..86....onlyi
29c00 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
29c10 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
29c20 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
29c30 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
29c40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
29c50 62 65 6c 2d 31 31 39 39 0d 0a 53 45 4c 45 43 54  bel-1199..SELECT
29c60 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
29c70 20 53 49 47 4e 45 44 20 29 20 2a 20 33 31 20 46   SIGNED ) * 31 F
29c80 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
29c90 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
29ca0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
29cb0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
29cc0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
29cd0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
29ce0 2d 31 31 39 39 0d 0a 53 45 4c 45 43 54 20 2d 20  -1199..SELECT - 
29cf0 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
29d00 4e 54 45 47 45 52 20 29 20 2a 20 33 31 20 46 52  NTEGER ) * 31 FR
29d10 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
29d20 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
29d30 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
29d40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29d50 43 54 20 41 4c 4c 20 2b 20 37 31 20 2d 20 2b 20  CT ALL + 71 - + 
29d60 28 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  ( + col2 * col2 
29d70 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  + col0 ) FROM ta
29d80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
29d90 0d 0a 2d 31 30 34 32 0d 0a 2d 36 37 34 32 0d 0a  ..-1042..-6742..
29da0 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
29db0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
29dc0 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20  STINCT - + col2 
29dd0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  * cor0.col0 * - 
29de0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
29df0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
29e00 33 34 37 32 0d 0a 34 38 36 0d 0a 36 31 34 34 30  3472..486..61440
29e10 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
29e20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
29e30 20 32 34 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   24 + col1 FROM 
29e40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
29e50 2d 2d 0d 0a 34 31 0d 0a 35 35 0d 0a 38 33 0d 0a  --..41..55..83..
29e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29e70 74 0d 0a 53 45 4c 45 43 54 20 32 30 20 46 52 4f  t..SELECT 20 FRO
29e80 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
29e90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
29ea0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
29eb0 32 66 64 64 39 34 32 66 65 30 33 30 37 61 36 66  2fdd942fe0307a6f
29ec0 66 36 36 62 36 33 30 30 34 65 66 31 30 32 63 34  f66b63004ef102c4
29ed0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29ee0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
29ef0 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  INCT col0 + col0
29f00 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
29f10 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
29f20 34 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 71  4..156..158....q
29f30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29f40 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20  SELECT - + col1 
29f50 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53 20  * + ( col1 ) AS 
29f60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
29f70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
29f80 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a  00..-169..-676..
29f90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
29fa0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
29fb0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
29fc0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
29fd0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
29fe0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 36 0d  sort label-1206.
29ff0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
2a000 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49  ST( + col2 AS SI
2a010 47 4e 45 44 20 29 20 2d 20 2d 20 63 6f 6c 32 20  GNED ) - - col2 
2a020 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a030 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2a040 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a050 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a060 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a070 72 74 20 6c 61 62 65 6c 2d 31 32 30 36 0d 0a 53  rt label-1206..S
2a080 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
2a090 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54   ( + col2 AS INT
2a0a0 45 47 45 52 20 29 20 2d 20 2d 20 63 6f 6c 32 20  EGER ) - - col2 
2a0b0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a0c0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
2a0d0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2a0e0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2a0f0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2a100 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2a110 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2a120 31 32 30 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1207..SELECT - c
2a130 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20 63  or0.col2 DIV - c
2a140 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 + - col1 FRO
2a150 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2a160 2d 0d 0a 2d 31 32 0d 0a 2d 32 35 0d 0a 2d 39 0d  -..-12..-25..-9.
2a170 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2a180 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2a190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a1a0 74 20 6c 61 62 65 6c 2d 31 32 30 37 0d 0a 53 45  t label-1207..SE
2a1b0 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  LECT - cor0.col2
2a1c0 20 2f 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   / - col2 + - co
2a1d0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
2a1e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 32  0..----..-12..-2
2a1f0 35 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5..-9....query I
2a200 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a210 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31   - col0 + - tab1
2a220 2e 63 6f 6c 30 20 2a 20 33 20 2a 20 63 6f 6c 30  .col0 * 3 * col0
2a230 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2a240 0d 0a 2d 31 32 33 35 32 0d 0a 2d 31 39 32 38 30  ..-12352..-19280
2a250 0d 0a 2d 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-30....query I
2a260 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a270 20 2d 20 35 36 20 41 53 20 63 6f 6c 32 20 46 52   - 56 AS col2 FR
2a280 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
2a290 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
2a2a0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
2a2b0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2a2c0 74 6f 20 33 64 33 64 61 62 34 30 30 65 65 66 39  to 3d3dab400eef9
2a2d0 33 63 30 39 38 61 63 62 62 62 61 33 66 63 39 62  3c098acbbba3fc9b
2a2e0 64 63 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  dc6....onlyif my
2a2f0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2a300 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2a310 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2a320 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2a330 65 6c 2d 31 32 31 30 0d 0a 53 45 4c 45 43 54 20  el-1210..SELECT 
2a340 2b 20 35 39 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  + 59 + cor0.col2
2a350 20 44 49 56 20 2b 20 63 6f 6c 32 20 63 6f 6c 30   DIV + col2 col0
2a360 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2a370 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30  r0..----..60..60
2a380 0d 0a 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..60....skipif p
2a390 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2a3a0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2a3b0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2a3c0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2a3d0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2a3e0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2a3f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2a400 6c 61 62 65 6c 2d 31 32 31 30 0d 0a 53 45 4c 45  label-1210..SELE
2a410 43 54 20 2b 20 35 39 20 2b 20 63 6f 72 30 2e 63  CT + 59 + cor0.c
2a420 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol2 / + col2 col
2a430 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2a440 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36  or0..----..60..6
2a450 30 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  0..60....query I
2a460 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a470 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
2a480 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2d  .col2 * - col1 -
2a490 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
2a4a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2a4b0 32 33 35 0d 0a 31 33 37 38 0d 0a 35 36 30 0d 0a  235..1378..560..
2a4c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2a4d0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2a4e0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2a4f0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2a500 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2a510 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31 32 0d  sort label-1212.
2a520 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d  .SELECT + col1 -
2a530 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
2a540 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20   DECIMAL ) FROM 
2a550 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2a560 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2a570 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2a580 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2a590 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2a5a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 31  owsort label-121
2a5b0 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  2..SELECT + col1
2a5c0 20 2d 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   - + CAST ( NULL
2a5d0 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20   AS REAL ) FROM 
2a5e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2a5f0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2a600 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
2a610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a620 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20  DISTINCT - col0 
2a630 2d 20 39 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  - 90 * - col2 * 
2a640 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
2a650 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a660 0d 0a 2d 2d 2d 2d 0d 0a 33 31 31 35 0d 0a 36 35  ..----..3115..65
2a670 36 37 33 31 0d 0a 37 31 32 35 36 0d 0a 0d 0a 71  6731..71256....q
2a680 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a690 53 45 4c 45 43 54 20 2d 20 31 33 20 41 53 20 63  SELECT - 13 AS c
2a6a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
2a6b0 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
2a6c0 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
2a6d0 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
2a6e0 6e 67 20 74 6f 20 31 63 36 61 61 61 30 37 62 61  ng to 1c6aaa07ba
2a6f0 38 64 33 64 63 30 31 65 65 36 31 36 65 31 36 62  8d3dc01ee616e16b
2a700 65 66 36 30 66 32 0d 0a 0d 0a 71 75 65 72 79 20  ef60f2....query 
2a710 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a720 54 20 41 4c 4c 20 31 38 20 41 53 20 63 6f 6c 31  T ALL 18 AS col1
2a730 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
2a740 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
2a750 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
2a760 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2a770 74 6f 20 39 30 33 61 63 32 32 37 39 33 35 63 31  to 903ac227935c1
2a780 35 33 32 33 30 30 64 62 34 35 61 38 35 33 37 63  532300db45a8537c
2a790 35 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  595....query I r
2a7a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2a7b0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a   col2 * - col1 *
2a7c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2a7d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36  AS cor0..----..6
2a7e0 31 31 38 38 34 0d 0a 39 33 36 35 34 0d 0a 39 37  11884..93654..97
2a7f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2a800 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2a810 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 33 31  INCT + col1 * 31
2a820 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2a830 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 36 36 0d 0a  r0..----..2666..
2a840 32 38 32 31 0d 0a 33 30 30 37 0d 0a 0d 0a 71 75  2821..3007....qu
2a850 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a860 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
2a870 6c 31 20 2b 20 2b 20 31 38 20 2a 20 34 32 20 41  l1 + + 18 * 42 A
2a880 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2a890 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a8a0 38 34 32 0d 0a 38 34 37 0d 0a 38 35 33 0d 0a 0d  842..847..853...
2a8b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a8c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2a8d0 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  2 * + col2 * + c
2a8e0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 + - col1 FRO
2a8f0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2a900 2d 2d 2d 2d 0d 0a 31 35 37 34 33 38 0d 0a 31 38  ----..157438..18
2a910 35 31 38 33 0d 0a 38 38 34 37 32 33 0d 0a 0d 0a  5183..884723....
2a920 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a930 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a940 20 63 6f 6c 31 20 2b 20 2b 20 28 20 2b 20 63 6f   col1 + + ( + co
2a950 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63  l2 ) FROM tab2 c
2a960 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35  or0..----..55..5
2a970 38 0d 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..85....onlyif 
2a980 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2a990 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2a9a0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2a9b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a9c0 61 62 65 6c 2d 31 32 32 31 0d 0a 53 45 4c 45 43  abel-1221..SELEC
2a9d0 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 44  T ALL - - col1 D
2a9e0 49 56 20 63 6f 6c 32 20 2b 20 36 30 20 46 52 4f  IV col2 + 60 FRO
2a9f0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2aa00 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30 0d 0a 36 30  ----..60..60..60
2aa10 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2aa20 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2aa30 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2aa40 72 74 20 6c 61 62 65 6c 2d 31 32 32 31 0d 0a 53  rt label-1221..S
2aa50 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
2aa60 6c 31 20 2f 20 63 6f 6c 32 20 2b 20 36 30 20 46  l1 / col2 + 60 F
2aa70 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2aa80 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30 0d 0a  ..----..60..60..
2aa90 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
2aaa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2aab0 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 32 33  STINCT col1 * 23
2aac0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
2aad0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2aae0 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 32 31 38 34  ----..2064..2184
2aaf0 0d 0a 32 33 32 38 0d 0a 0d 0a 71 75 65 72 79 20  ..2328....query 
2ab00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ab10 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
2ab20 32 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  2 + col2 * + col
2ab30 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2ab40 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2ab50 2d 0d 0a 33 34 0d 0a 37 32 31 36 0d 0a 37 35 39  -..34..7216..759
2ab60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ab70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2ab80 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  + - col1 + - col
2ab90 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2aba0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2abb0 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d  -..-110..-132..-
2abc0 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  180....query I r
2abd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2abe0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b  ISTINCT + col0 +
2abf0 20 39 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53   96 FROM tab0 AS
2ac00 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30   cor0..----..120
2ac10 0d 0a 31 33 31 0d 0a 31 38 35 0d 0a 0d 0a 6f 6e  ..131..185....on
2ac20 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2ac30 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2ac40 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2ac50 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2ac60 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 36 0d 0a  ort label-1226..
2ac70 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
2ac80 2b 20 28 20 63 6f 6c 32 20 29 20 44 49 56 20 2b  + ( col2 ) DIV +
2ac90 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2aca0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2acb0 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35 36 0d 0a 2d 39  --..-53..-56..-9
2acc0 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
2acd0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2ace0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2acf0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 36 0d 0a  ort label-1226..
2ad00 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
2ad10 2b 20 28 20 63 6f 6c 32 20 29 20 2f 20 2b 20 63  + ( col2 ) / + c
2ad20 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
2ad30 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
2ad40 0d 0a 2d 35 33 0d 0a 2d 35 36 0d 0a 2d 39 35 0d  ..-53..-56..-95.
2ad50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ad60 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
2ad70 6f 6c 32 20 2a 20 2d 20 28 20 33 20 29 20 41 53  ol2 * - ( 3 ) AS
2ad80 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2ad90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2ada0 32 34 36 0d 0a 2d 33 0d 0a 2d 39 39 0d 0a 0d 0a  246..-3..-99....
2adb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2adc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2add0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30   + col1 * + cor0
2ade0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
2adf0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2ae00 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36  .----..1534..646
2ae10 0d 0a 38 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..837....onlyif 
2ae20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2ae30 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2ae40 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2ae50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2ae60 61 62 65 6c 2d 31 32 32 39 0d 0a 53 45 4c 45 43  abel-1229..SELEC
2ae70 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
2ae80 44 49 56 20 2b 20 36 36 20 46 52 4f 4d 20 74 61  DIV + 66 FROM ta
2ae90 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2aea0 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
2aeb0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2aec0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2aed0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 39  wsort label-1229
2aee0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2aef0 54 20 63 6f 6c 31 20 2f 20 2b 20 36 36 20 46 52  T col1 / + 66 FR
2af00 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2af10 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .----..1....quer
2af20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2af30 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
2af40 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 31   cor0.col1 + - 1
2af50 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  7 FROM tab1 AS c
2af60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 31 0d  or0..----..1231.
2af70 0a 31 33 38 37 0d 0a 35 35 33 0d 0a 0d 0a 71 75  .1387..553....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 2b 20 2b 20 39 39 20 2a 20 33  ELECT + + 99 * 3
2afa0 38 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  8 - col1 FROM ta
2afb0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2afc0 0d 0a 33 36 36 35 0d 0a 33 36 37 31 0d 0a 33 36  ..3665..3671..36
2afd0 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
2afe0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2aff0 2d 20 63 6f 6c 32 20 2a 20 2b 20 38 38 20 2a 20  - col2 * + 88 * 
2b000 2d 20 63 6f 6c 32 20 2d 20 35 39 20 41 53 20 63  - col2 - 59 AS c
2b010 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
2b020 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 30 31 33  r0..----..127013
2b030 0d 0a 35 39 34 32 39 0d 0a 36 34 30 39 33 0d 0a  ..59429..64093..
2b040 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b050 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
2b060 6c 31 20 2b 20 2d 20 32 38 20 2d 20 2d 20 63 6f  l1 + - 28 - - co
2b070 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
2b080 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2b090 0a 31 34 34 0d 0a 31 35 34 0d 0a 31 36 36 0d 0a  .144..154..166..
2b0a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b0b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
2b0c0 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor1.col0 FROM t
2b0d0 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab2, tab2 AS cor
2b0e0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c  0, tab2 AS cor1,
2b0f0 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d   tab0 AS cor2..-
2b100 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
2b110 61 73 68 69 6e 67 20 74 6f 20 30 35 38 33 35 66  ashing to 05835f
2b120 32 39 64 64 39 63 64 34 66 61 31 36 38 38 39 64  29dd9cd4fa16889d
2b130 65 35 34 64 65 63 33 63 62 36 0d 0a 0d 0a 71 75  e54dec3cb6....qu
2b140 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b150 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
2b160 36 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  6 * col0 + + col
2b170 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
2b180 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 37 0d 0a 31 36  ..----..1137..16
2b190 31 31 0d 0a 34 31 37 36 0d 0a 0d 0a 71 75 65 72  11..4176....quer
2b1a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b1b0 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32  ECT ALL - + col2
2b1c0 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30   * col2 - - col0
2b1d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2b1e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 35 0d  r0..----..-1065.
2b1f0 0a 2d 36 36 33 35 0d 0a 33 34 0d 0a 0d 0a 6f 6e  .-6635..34....on
2b200 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2b210 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2b220 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2b230 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2b240 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 37 0d 0a  ort label-1237..
2b250 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
2b260 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63  ol0 + - col1 * c
2b270 6f 6c 32 20 44 49 56 20 2d 20 32 36 20 41 53 20  ol2 DIV - 26 AS 
2b280 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2b290 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2b2a0 39 0d 0a 2d 35 35 0d 0a 32 35 0d 0a 0d 0a 73 6b  9..-55..25....sk
2b2b0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2b2c0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2b2d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b2e0 65 6c 2d 31 32 33 37 0d 0a 53 45 4c 45 43 54 20  el-1237..SELECT 
2b2f0 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d  ALL + - col0 + -
2b300 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f 20 2d   col1 * col2 / -
2b310 20 32 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   26 AS col2 FROM
2b320 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2b330 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 35 35 0d 0a 32  ---..-19..-55..2
2b340 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2b350 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 20 41  sort..SELECT 4 A
2b360 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2b370 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
2b380 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 32 20 41  OIN tab1, tab2 A
2b390 53 20 63 6f 72 31 2c 20 74 61 62 30 20 63 6f 72  S cor1, tab0 cor
2b3a0 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
2b3b0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 33  es hashing to 33
2b3c0 34 37 61 33 32 33 37 62 33 37 65 64 36 33 32 30  47a3237b37ed6320
2b3d0 35 65 39 34 34 30 64 38 38 31 38 61 34 36 0d 0a  5e9440d8818a46..
2b3e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b3f0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
2b400 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30   * - col2 + cor0
2b410 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41  .col1 * - col2 A
2b420 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2b430 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b440 2d 31 33 32 0d 0a 2d 31 34 37 36 30 0d 0a 2d 33  -132..-14760..-3
2b450 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  630....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 37 20 2a 20 2b 20 63 6f  ISTINCT 7 * + co
2b480 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2b490 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d  cor0..----..119.
2b4a0 0a 32 31 37 0d 0a 34 31 33 0d 0a 0d 0a 71 75 65  .217..413....que
2b4b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b4c0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20  LECT - + col2 + 
2b4d0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
2b4e0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2b4f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
2b500 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
2b510 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2b520 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63  L - + col1 + + c
2b530 6f 6c 31 20 2a 20 2b 20 32 38 20 46 52 4f 4d 20  ol1 * + 28 FROM 
2b540 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2b550 2d 2d 0d 0a 32 37 30 0d 0a 33 35 31 0d 0a 37 30  --..270..351..70
2b560 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2b570 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2b580 54 49 4e 43 54 20 2b 20 28 20 63 6f 72 30 2e 63  TINCT + ( cor0.c
2b590 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol2 ) AS col1 FR
2b5a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b5b0 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39  .----..54..57..9
2b5c0 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
2b5d0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2b5e0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2b5f0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2b600 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2b610 2d 31 32 34 34 0d 0a 53 45 4c 45 43 54 20 2d 20  -1244..SELECT - 
2b620 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 44 49 56 20  col0 * col1 DIV 
2b630 2b 20 32 36 20 46 52 4f 4d 20 74 61 62 31 20 41  + 26 FROM tab1 A
2b640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2b650 34 0d 0a 2d 33 0d 0a 2d 34 30 0d 0a 0d 0a 73 6b  4..-3..-40....sk
2b660 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2b670 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2b680 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2b690 65 6c 2d 31 32 34 34 0d 0a 53 45 4c 45 43 54 20  el-1244..SELECT 
2b6a0 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f 20  - col0 * col1 / 
2b6b0 2b 20 32 36 20 46 52 4f 4d 20 74 61 62 31 20 41  + 26 FROM tab1 A
2b6c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2b6d0 34 0d 0a 2d 33 0d 0a 2d 34 30 0d 0a 0d 0a 71 75  4..-3..-40....qu
2b6e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b6f0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2b  ELECT - + col0 +
2b700 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
2b710 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2b720 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2b730 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
2b740 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b750 20 44 49 53 54 49 4e 43 54 20 2b 20 35 34 20 2a   DISTINCT + 54 *
2b760 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f   col1 + col2 FRO
2b770 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2b780 2d 2d 2d 2d 0d 0a 31 37 30 31 0d 0a 33 32 31 32  ----..1701..3212
2b790 0d 0a 39 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..956....query I
2b7a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b7b0 20 32 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   22 AS col0 FROM
2b7c0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2b7d0 2d 2d 2d 0d 0a 32 32 0d 0a 32 32 0d 0a 32 32 0d  ---..22..22..22.
2b7e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b7f0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
2b800 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  + col0 * + col0 
2b810 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2b820 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2b830 0a 31 33 32 32 0d 0a 36 36 32 0d 0a 38 30 31 32  .1322..662..8012
2b840 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b850 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
2b860 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 38 35  l2 + col1 * - 85
2b870 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2b880 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2b890 0d 0a 2d 37 32 37 37 0d 0a 2d 37 36 35 33 0d 0a  ..-7277..-7653..
2b8a0 2d 38 32 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -8244....query I
2b8b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b8c0 20 44 49 53 54 49 4e 43 54 20 2d 20 35 38 20 41   DISTINCT - 58 A
2b8d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2b8e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 0d 0a 0d 0a 73  ..----..-58....s
2b8f0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2b900 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2b910 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2b920 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2b930 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2b940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b950 2d 20 36 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  - 60 col0 FROM t
2b960 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 0d 0a  ab2..----..-60..
2b970 2d 36 30 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65 72  -60..-60....quer
2b980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b990 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 20 46  ECT DISTINCT 5 F
2b9a0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2b9b0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2b9c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2b9d0 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63  TINCT + col0 + c
2b9e0 6f 72 30 2e 63 6f 6c 32 20 2a 20 36 32 20 46 52  or0.col2 * 62 FR
2b9f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2ba00 0a 2d 2d 2d 2d 0d 0a 31 36 38 31 0d 0a 31 36 39  .----..1681..169
2ba10 30 0d 0a 32 34 33 35 0d 0a 0d 0a 71 75 65 72 79  0..2435....query
2ba20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ba30 43 54 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31  CT col2 / + col1
2ba40 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 74 61 62 32   + + col2 + tab2
2ba50 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20  .col1 FROM tab2 
2ba60 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e  WHERE NOT NULL N
2ba70 4f 54 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20  OT BETWEEN NULL 
2ba80 41 4e 44 20 28 20 2d 20 63 6f 6c 30 20 29 0d 0a  AND ( - col0 )..
2ba90 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
2baa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2bab0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col2 + - col1 * 
2bac0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
2bad0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2bae0 2d 31 31 35 32 0d 0a 2d 31 33 35 30 0d 0a 2d 35  -1152..-1350..-5
2baf0 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  13....query III 
2bb00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2bb10 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
2bb20 74 61 62 30 20 57 48 45 52 45 20 2b 20 63 6f 6c  tab0 WHERE + col
2bb30 32 20 49 4e 20 28 20 2b 20 63 6f 6c 32 20 29 0d  2 IN ( + col2 ).
2bb40 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
2bb50 68 61 73 68 69 6e 67 20 74 6f 20 33 38 61 31 36  hashing to 38a16
2bb60 37 33 65 32 65 30 39 64 36 39 34 63 38 63 65 63  73e2e09d694c8cec
2bb70 34 35 63 37 39 37 30 33 34 61 37 0d 0a 0d 0a 71  45c797034a7....q
2bb80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2bb90 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 34 20  SELECT ALL - 74 
2bba0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2bbb0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 0d 0a 2d 37  1..----..-74..-7
2bbc0 34 0d 0a 2d 37 34 0d 0a 0d 0a 71 75 65 72 79 20  4..-74....query 
2bbd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bbe0 54 20 41 4c 4c 20 2b 20 38 39 20 2b 20 2b 20 74  T ALL + 89 + + t
2bbf0 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab0.col1 FROM ta
2bc00 62 30 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41  b0, tab1, tab0 A
2bc10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
2bc20 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2bc30 74 6f 20 35 63 38 65 33 30 36 66 37 61 38 33 39  to 5c8e306f7a839
2bc40 65 35 30 64 61 63 62 34 65 31 64 32 30 33 31 30  e50dacb4e1d20310
2bc50 39 32 64 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  92d....query III
2bc60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bc70 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31   ALL * FROM tab1
2bc80 20 57 48 45 52 45 20 28 20 2b 20 63 6f 6c 32 20   WHERE ( + col2 
2bc90 29 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 32 20  ) NOT IN ( col2 
2bca0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....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 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41  CT col0 + col1 A
2bcd0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2bce0 20 57 48 45 52 45 20 4e 55 4c 4c 20 3c 3d 20 63   WHERE NULL <= c
2bcf0 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ol0..----....que
2bd00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2bd10 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2bd20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 57  col2 FROM tab0 W
2bd30 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f 6c 30 20  HERE NOT - col0 
2bd40 49 4e 20 28 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d  IN ( col1 )..---
2bd50 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a  -..1..33..82....
2bd60 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
2bd70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20  t..SELECT ALL * 
2bd80 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
2bd90 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 42 45 54  NOT ( NULL ) BET
2bda0 57 45 45 4e 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  WEEN + col0 + - 
2bdb0 63 6f 6c 31 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d  col1 AND NULL..-
2bdc0 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
2bdd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2bde0 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 2d   col1 * col2 * -
2bdf0 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
2be00 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2be10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 30  or0..----..-2440
2be20 34 34 0d 0a 2d 36 37 38 39 35 33 0d 0a 2d 39 33  44..-678953..-93
2be30 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
2be40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2be50 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
2be60 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63  col1 * col1 AS c
2be70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
2be80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 36 0d 0a 33  r0..----..306..3
2be90 35 34 30 0d 0a 39 39 32 0d 0a 0d 0a 71 75 65 72  540..992....quer
2bea0 79 20 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  y IIIIII rowsort
2beb0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46  ..SELECT ALL * F
2bec0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63  ROM tab1, tab1 c
2bed0 6f 72 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 3c  or0 WHERE NULL <
2bee0 3d 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d  = ( NULL )..----
2bef0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2bf00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
2bf10 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
2bf20 61 62 31 20 63 6f 72 30 20 57 48 45 52 45 20 4e  ab1 cor0 WHERE N
2bf30 4f 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 42  OT col0 * col1 B
2bf40 45 54 57 45 45 4e 20 2d 20 63 6f 6c 32 20 2a 20  ETWEEN - col2 * 
2bf50 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20  - col1 / - col2 
2bf60 41 4e 44 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  AND col0 * col2 
2bf70 2f 20 2d 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a  / - col1..----..
2bf80 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d  1248..1404..570.
2bf90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2bfa0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2bfb0 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 63   col0 * col0 * c
2bfc0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or0.col1 AS col1
2bfd0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2bfe0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 35  r0..----..118825
2bff0 0d 0a 34 39 35 33 36 0d 0a 37 32 30 38 31 31 0d  ..49536..720811.
2c000 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
2c010 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
2c020 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e  ROM tab1 WHERE N
2c030 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 42 45 54 57  OT NULL NOT BETW
2c040 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 28 20 63  EEN NULL AND ( c
2c050 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71  ol0 )..----....q
2c060 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c070 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2c080 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
2c090 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e  ROM tab0 WHERE N
2c0a0 4f 54 20 63 6f 6c 30 20 49 4e 20 28 20 2d 20 63  OT col0 IN ( - c
2c0b0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 29 0d 0a  ol0 * + col1 )..
2c0c0 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39  ----..24..35..89
2c0d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c0e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  ort..SELECT tab0
2c0f0 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20  .col1 * col2 AS 
2c100 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
2c110 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32  ----..2838..7462
2c120 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
2c130 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c140 41 4c 4c 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  ALL col1 / col1 
2c150 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2c160 32 20 57 48 45 52 45 20 4e 4f 54 20 28 20 4e 55  2 WHERE NOT ( NU
2c170 4c 4c 20 29 20 42 45 54 57 45 45 4e 20 4e 55 4c  LL ) BETWEEN NUL
2c180 4c 20 41 4e 44 20 28 20 2d 20 74 61 62 32 2e 63  L AND ( - tab2.c
2c190 6f 6c 31 20 2f 20 63 6f 6c 30 20 29 0d 0a 2d 2d  ol1 / col0 )..--
2c1a0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
2c1b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
2c1c0 62 31 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31  b1.col2 * + col1
2c1d0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2c1e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  b1..----..1248..
2c1f0 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65  1404..570....que
2c200 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c210 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  LECT col1 + + co
2c220 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l2 - + col1 FROM
2c230 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d   tab2..----..26.
2c240 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69  .27..38....skipi
2c250 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2c260 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2c270 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2c280 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2c290 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2c2a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
2c2b0 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   + + col2 + col2
2c2c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
2c2d0 0a 2d 2d 2d 2d 0d 0a 31 31 34 0d 0a 37 38 0d 0a  .----..114..78..
2c2e0 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
2c2f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2c300 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45  l1 FROM tab0 WHE
2c310 52 45 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 49  RE col2 * col2 I
2c320 4e 20 28 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c  N ( + col0 - col
2c330 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  2 )..----....que
2c340 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c350 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
2c360 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
2c370 20 57 48 45 52 45 20 63 6f 6c 30 20 2a 20 63 6f   WHERE col0 * co
2c380 6c 32 20 3d 20 2d 20 63 6f 6c 31 0d 0a 2d 2d 2d  l2 = - col1..---
2c390 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  -....query III r
2c3a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2c3b0 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57  LL * FROM tab1 W
2c3c0 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3d 20  HERE NOT NULL = 
2c3d0 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  col2..----....qu
2c3e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c3f0 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2d 20 63  ELECT col0 - - c
2c400 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63  ol2 * - col1 * c
2c410 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
2c420 2d 2d 2d 0d 0a 2d 31 31 39 35 37 34 0d 0a 2d 35  ---..-119574..-5
2c430 30 39 35 35 0d 0a 2d 35 38 35 32 0d 0a 0d 0a 71  0955..-5852....q
2c440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c450 53 45 4c 45 43 54 20 41 4c 4c 20 31 35 20 2b 20  SELECT ALL 15 + 
2c460 33 31 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32  31 * + tab2.col2
2c470 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2c480 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 33 0d 0a  b2..----..1193..
2c490 38 32 31 0d 0a 38 35 32 0d 0a 0d 0a 71 75 65 72  821..852....quer
2c4a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c4b0 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  ECT tab1.col0 + 
2c4c0 2b 20 36 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  + 6 FROM tab1..-
2c4d0 2d 2d 2d 0d 0a 37 30 0d 0a 38 36 0d 0a 39 0d 0a  ---..70..86..9..
2c4e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c4f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2c500 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor1.col2 FROM t
2c510 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
2c520 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d  0, tab2 cor1..--
2c530 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
2c540 73 68 69 6e 67 20 74 6f 20 66 39 64 34 62 62 38  shing to f9d4bb8
2c550 36 37 37 64 62 37 62 39 38 63 37 65 64 38 39 64  677db7b98c7ed89d
2c560 30 36 65 36 65 38 63 64 36 0d 0a 0d 0a 71 75 65  06e6e8cd6....que
2c570 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c580 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f 6c 32 20  LECT ALL ( col2 
2c590 29 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ) + + col0 + col
2c5a0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
2c5b0 2d 0d 0a 31 38 32 0d 0a 31 39 36 0d 0a 34 31 0d  -..182..196..41.
2c5c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c5d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 32 20  rt..SELECT + 92 
2c5e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2c5f0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
2c600 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
2c610 68 61 73 68 69 6e 67 20 74 6f 20 35 31 36 66 61  hashing to 516fa
2c620 34 35 63 38 62 30 36 66 39 66 36 37 64 36 65 35  45c8b06f9f67d6e5
2c630 30 30 62 66 64 34 33 35 63 31 61 0d 0a 0d 0a 71  00bfd435c1a....q
2c640 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c650 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
2c660 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
2c670 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b0 AS cor0, tab2
2c680 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63   cor1, tab0 AS c
2c690 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  or2..----..81 va
2c6a0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2c6b0 38 37 61 66 34 36 37 39 33 38 65 66 33 35 35 35  87af467938ef3555
2c6c0 34 30 62 38 64 65 32 34 64 62 31 62 66 33 62 38  40b8de24db1bf3b8
2c6d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c6e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
2c6f0 2e 63 6f 6c 31 20 2b 20 2d 20 35 30 20 2a 20 2b  .col1 + - 50 * +
2c700 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2c710 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2c720 34 32 31 34 0d 0a 2d 34 34 35 39 0d 0a 2d 34 37  4214..-4459..-47
2c730 35 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  53....skipif mys
2c740 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2c750 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2c760 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2c770 20 2b 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f   + + CAST ( - co
2c780 6c 30 20 41 53 20 52 45 41 4c 20 29 20 2a 20 63  l0 AS REAL ) * c
2c790 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2c7a0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
2c7b0 0d 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36  ..-49..-6084..-6
2c7c0 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  241....query I r
2c7d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2c7e0 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 35 33  LL - col1 + - 53
2c7f0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2c800 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
2c810 31 31 32 0d 0a 2d 37 30 0d 0a 2d 38 34 0d 0a 0d  112..-70..-84...
2c820 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2c830 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2c840 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2c850 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2c860 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38  owsort label-128
2c870 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
2c880 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56  CT cor0.col1 DIV
2c890 20 2b 20 36 36 20 2b 20 63 6f 6c 30 20 2a 20 2d   + 66 + col0 * -
2c8a0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
2c8b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2c8c0 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36 30 38  .----..-49..-608
2c8d0 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 73 6b 69 70  4..-6241....skip
2c8e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2c8f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2c900 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2c910 2d 31 32 38 38 0d 0a 53 45 4c 45 43 54 20 44 49  -1288..SELECT DI
2c920 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
2c930 20 2f 20 2b 20 36 36 20 2b 20 63 6f 6c 30 20 2a   / + 66 + col0 *
2c940 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
2c950 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2c960 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 36  0..----..-49..-6
2c970 30 38 34 0d 0a 2d 36 32 34 31 0d 0a 0d 0a 71 75  084..-6241....qu
2c980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c990 45 4c 45 43 54 20 2d 20 35 36 20 41 53 20 63 6f  ELECT - 56 AS co
2c9a0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2c9b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d  cor0..----..-56.
2c9c0 0a 2d 35 36 0d 0a 2d 35 36 0d 0a 0d 0a 71 75 65  .-56..-56....que
2c9d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c9e0 4c 45 43 54 20 41 4c 4c 20 2d 20 34 36 20 41 53  LECT ALL - 46 AS
2c9f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2ca00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2ca10 34 36 0d 0a 2d 34 36 0d 0a 2d 34 36 0d 0a 0d 0a  46..-46..-46....
2ca20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ca30 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 30  .SELECT - ( col0
2ca40 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ) * cor0.col2 A
2ca50 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2ca60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2ca70 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32  -35..-7298..-792
2ca80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ca90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
2caa0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   * + cor0.col2 A
2cab0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2cac0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2cad0 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a  1534..646..837..
2cae0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2caf0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2cb00 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT + cor0.col2 +
2cb10 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
2cb20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2cb30 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d  .----..119..173.
2cb40 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
2cb50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2cb60 20 2b 20 31 20 2a 20 2d 20 63 6f 6c 30 20 2a 20   + 1 * - col0 * 
2cb70 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  - col0 AS col0 F
2cb80 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2cb90 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36  ---..-1225..-576
2cba0 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7921....onlyi
2cbb0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2cbc0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2cbd0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2cbe0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cbf0 20 6c 61 62 65 6c 2d 31 32 39 35 0d 0a 53 45 4c   label-1295..SEL
2cc00 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  ECT - col0 + + c
2cc10 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d 20 28  or0.col2 DIV - (
2cc20 20 2d 20 39 35 20 29 20 63 6f 6c 32 20 46 52 4f   - 95 ) col2 FRO
2cc30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2cc40 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a  ----..-24..-35..
2cc50 2d 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -89....skipif po
2cc60 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2cc70 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2cc80 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2cc90 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2cca0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2ccb0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2ccc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2ccd0 61 62 65 6c 2d 31 32 39 35 0d 0a 53 45 4c 45 43  abel-1295..SELEC
2cce0 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72  T - col0 + + cor
2ccf0 30 2e 63 6f 6c 32 20 2f 20 2d 20 28 20 2d 20 39  0.col2 / - ( - 9
2cd00 35 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  5 ) col2 FROM ta
2cd10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2cd20 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d  ..-24..-35..-89.
2cd30 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2cd40 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2cd50 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2cd60 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2cd70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2cd80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2cd90 45 43 54 20 41 4c 4c 20 2b 20 2b 20 31 38 20 2a  ECT ALL + + 18 *
2cda0 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
2cdb0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2cdc0 2d 2d 0d 0a 31 30 36 32 0d 0a 33 30 36 0d 0a 35  --..1062..306..5
2cdd0 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
2cde0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2cdf0 2d 20 37 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63  - 7 * + col1 * c
2ce00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2ce10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
2ce20 32 33 0d 0a 2d 32 34 33 36 37 0d 0a 2d 36 37 32  23..-24367..-672
2ce30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2ce40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
2ce50 61 62 30 2e 63 6f 6c 32 20 2d 20 2d 20 34 20 41  ab0.col2 - - 4 A
2ce60 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2ce70 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 38  ..----..-29..-78
2ce80 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..3....query I r
2ce90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2cea0 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  LL - - col1 * co
2ceb0 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
2cec0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  0 cor0..----..73
2ced0 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a  96..8281..9409..
2cee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cef0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2cf00 43 54 20 2d 20 33 20 2a 20 63 6f 6c 31 20 41 53  CT - 3 * col1 AS
2cf10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2cf20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2cf30 32 35 38 0d 0a 2d 32 37 33 0d 0a 2d 32 39 31 0d  258..-273..-291.
2cf40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2cf50 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
2cf60 31 20 2b 20 2b 20 32 34 20 41 53 20 63 6f 6c 31  1 + + 24 AS col1
2cf70 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
2cf80 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 31 31 0d 0a 31  .----..-2..11..1
2cf90 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2cfa0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
2cfb0 6f 6c 30 20 2d 20 34 30 20 46 52 4f 4d 20 74 61  ol0 - 40 FROM ta
2cfc0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2cfd0 0d 0a 2d 31 32 39 0d 0a 2d 36 34 0d 0a 2d 37 35  ..-129..-64..-75
2cfe0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cff0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
2d000 20 2a 20 36 36 20 46 52 4f 4d 20 74 61 62 32 20   * 66 FROM tab2 
2d010 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2d020 37 31 36 0d 0a 31 37 38 32 0d 0a 32 35 30 38 0d  716..1782..2508.
2d030 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d040 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
2d050 30 2e 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20  0.col2 - - col0 
2d060 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2d070 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36  0..----..171..36
2d080 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..57....query I 
2d090 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d0a0 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  - + cor0.col0 + 
2d0b0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
2d0c0 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
2d0d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d0e0 2d 33 35 30 0d 0a 2d 34 37 34 36 33 30 0d 0a 2d  -350..-474630..-
2d0f0 34 39 33 31 31 38 0d 0a 0d 0a 71 75 65 72 79 20  493118....query 
2d100 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d110 54 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 32  T + ( col1 ) * 2
2d120 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  3 AS col0 FROM t
2d130 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 37 0d  ab2..----..1357.
2d140 0a 33 39 31 0d 0a 37 31 33 0d 0a 0d 0a 71 75 65  .391..713....que
2d150 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2d160 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
2d170 2d 20 63 6f 6c 32 20 2a 20 39 34 20 29 20 41 53  - col2 * 94 ) AS
2d180 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2d190 0a 2d 2d 2d 2d 0d 0a 2d 33 31 30 32 0d 0a 2d 37  .----..-3102..-7
2d1a0 37 30 38 0d 0a 2d 39 34 0d 0a 0d 0a 71 75 65 72  708..-94....quer
2d1b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d1c0 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  ECT - col0 + - c
2d1d0 6f 72 30 2e 63 6f 6c 31 20 2a 20 35 33 20 46 52  or0.col1 * 53 FR
2d1e0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2d1f0 2d 2d 0d 0a 2d 31 33 38 31 0d 0a 2d 35 39 34 0d  --..-1381..-594.
2d200 0a 2d 37 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .-769....query I
2d210 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d220 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20   ALL - + col2 + 
2d230 39 36 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  96 FROM tab1 AS 
2d240 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33  cor0..----..0..3
2d250 39 0d 0a 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9..42....query I
2d260 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d270 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
2d280 6f 6c 30 20 2a 20 28 20 2b 20 34 36 20 29 20 2a  ol0 * ( + 46 ) *
2d290 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
2d2a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 35 34  cor0..----..2254
2d2b0 0d 0a 32 37 39 38 36 34 0d 0a 32 38 37 30 38 36  ..279864..287086
2d2c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2d2d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2d2e0 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 - - col0 AS c
2d2f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
2d300 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
2d310 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2d320 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2d330 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 28 20 2b 20   + + col2 * ( + 
2d340 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20 41 53  col0 ) + col0 AS
2d350 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
2d360 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2d370 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31 0d 0a  96..2106..3081..
2d380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d390 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
2d3a0 20 35 33 20 46 52 4f 4d 20 74 61 62 32 20 41 53   53 FROM tab2 AS
2d3b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   cor0..----..112
2d3c0 0d 0a 37 30 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72  ..70..84....quer
2d3d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d3e0 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 63  ECT ALL col1 - c
2d3f0 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 * col2 AS co
2d400 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2d410 2d 2d 0d 0a 2d 31 34 32 37 0d 0a 2d 36 31 37 0d  --..-1427..-617.
2d420 0a 2d 36 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-698....query I
2d430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2d440 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   ALL - cor0.col2
2d450 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   + col1 * + col0
2d460 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2d470 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2d480 0d 0a 32 34 0d 0a 35 38 33 0d 0a 39 34 34 0d 0a  ..24..583..944..
2d490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d4a0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
2d4b0 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46  l0 * cor0.col2 F
2d4c0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
2d4d0 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38  ---..-189..-2028
2d4e0 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79  ..-3002....query
2d4f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d500 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
2d510 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41   * col2 + col1 A
2d520 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2d530 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d540 31 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d  188..3658..7693.
2d550 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2d560 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2d570 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2d580 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2d590 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2d5a0 33 31 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  318..SELECT ALL 
2d5b0 2d 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63  - - col1 DIV - c
2d5c0 6f 6c 30 20 2b 20 2b 20 36 37 20 2a 20 33 36 20  ol0 + + 67 * 36 
2d5d0 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63  + col0 * - ( + c
2d5e0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
2d5f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d600 0a 2d 2d 2d 2d 0d 0a 2d 32 31 39 30 0d 0a 31 30  .----..-2190..10
2d610 36 39 0d 0a 32 31 39 31 0d 0a 0d 0a 73 6b 69 70  69..2191....skip
2d620 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d630 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d640 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d650 2d 31 33 31 38 0d 0a 53 45 4c 45 43 54 20 41 4c  -1318..SELECT AL
2d660 4c 20 2d 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63  L - - col1 / - c
2d670 6f 6c 30 20 2b 20 2b 20 36 37 20 2a 20 33 36 20  ol0 + + 67 * 36 
2d680 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63  + col0 * - ( + c
2d690 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
2d6a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d6b0 0a 2d 2d 2d 2d 0d 0a 2d 32 31 39 30 0d 0a 31 30  .----..-2190..10
2d6c0 36 39 0d 0a 32 31 39 31 0d 0a 0d 0a 71 75 65 72  69..2191....quer
2d6d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d6e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
2d6f0 20 38 35 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f   85 + col0 AS co
2d700 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2d710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 0d  cor0..----..149.
2d720 0a 31 36 35 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72  .165..88....quer
2d730 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d740 45 43 54 20 41 4c 4c 20 39 36 20 2b 20 2b 20 63  ECT ALL 96 + + c
2d750 6f 6c 30 20 2a 20 2d 20 37 34 20 46 52 4f 4d 20  ol0 * - 74 FROM 
2d760 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2d770 2d 2d 0d 0a 2d 31 32 36 0d 0a 2d 34 36 34 30 0d  --..-126..-4640.
2d780 0a 2d 35 38 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5824....onlyif
2d790 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2d7a0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2d7b0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2d7c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2d7d0 6c 61 62 65 6c 2d 31 33 32 31 0d 0a 53 45 4c 45  label-1321..SELE
2d7e0 43 54 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20  CT + - col0 DIV 
2d7f0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
2d800 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2d810 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
2d820 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2d830 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2d840 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d850 20 6c 61 62 65 6c 2d 31 33 32 31 0d 0a 53 45 4c   label-1321..SEL
2d860 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 63  ECT + - col0 / c
2d870 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2d880 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2d890 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-1..0..0...
2d8a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2d8b0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2d8c0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2d8d0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2d8e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32  owsort label-132
2d8f0 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
2d900 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20  CT - col2 DIV - 
2d910 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2d920 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2d930 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a  ----..0..1..18..
2d940 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2d950 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2d960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d970 20 6c 61 62 65 6c 2d 31 33 32 32 0d 0a 53 45 4c   label-1322..SEL
2d980 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
2d990 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 / - col0 AS 
2d9a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2d9b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2d9c0 0a 31 0d 0a 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .1..18....onlyif
2d9d0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2d9e0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2d9f0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2da00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2da10 6c 61 62 65 6c 2d 31 33 32 33 0d 0a 53 45 4c 45  label-1323..SELE
2da20 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2da30 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l0 + + cor0.col0
2da40 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2d 20   DIV - col0 + - 
2da50 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
2da60 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2da70 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..-1....skipif 
2da80 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2da90 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2daa0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2dab0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2dac0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2dad0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2dae0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2daf0 20 6c 61 62 65 6c 2d 31 33 32 33 0d 0a 53 45 4c   label-1323..SEL
2db00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2db10 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 + + cor0.col
2db20 30 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  0 / - col0 + - c
2db30 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
2db40 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2db50 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-1....query I 
2db60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2db70 44 49 53 54 49 4e 43 54 20 2b 20 33 33 20 46 52  DISTINCT + 33 FR
2db80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2db90 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 0d 0a 71 75 65  .----..33....que
2dba0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2dbb0 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  LECT - col1 + co
2dbc0 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41  l1 * cor0.col2 A
2dbd0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2dbe0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dbf0 31 32 33 35 0d 0a 31 33 37 38 0d 0a 35 36 30 0d  1235..1378..560.
2dc00 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2dc10 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2dc20 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2dc30 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2dc40 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2dc50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dc60 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b  ECT ALL col2 * +
2dc70 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 63 6f 6c   col1 * col0 col
2dc80 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
2dc90 2d 0d 0a 33 33 39 35 0d 0a 36 36 34 31 31 38 0d  -..3395..664118.
2dca0 0a 36 38 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20  .68112....query 
2dcb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2dcc0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 39 38 20  T DISTINCT - 98 
2dcd0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2dce0 30 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53  0, tab1, tab0 AS
2dcf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 38   cor0..----..-98
2dd00 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2dd10 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2dd20 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2dd30 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2dd40 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2dd50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32  owsort label-132
2dd60 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  8..SELECT ALL - 
2dd70 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
2dd80 43 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62  CIMAL ) FROM tab
2dd90 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  1..----..NULL..N
2dda0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2ddb0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ddc0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ddd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2dde0 6c 2d 31 33 32 38 0d 0a 53 45 4c 45 43 54 20 41  l-1328..SELECT A
2ddf0 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c  LL - CAST ( NULL
2de00 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20   AS REAL ) FROM 
2de10 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
2de20 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2de30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2de40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2de50 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l1 * col0 + + co
2de60 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l0 * col1 AS col
2de70 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
2de80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 38 36 0d  or0..----..2686.
2de90 0a 34 33 34 0d 0a 39 32 30 34 0d 0a 0d 0a 71 75  .434..9204....qu
2dea0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2deb0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
2dec0 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l2 + + col1 FROM
2ded0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2dee0 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30  ---..109..67..80
2def0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2df00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2df10 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20  INCT + + col0 + 
2df20 2b 20 63 6f 6c 32 20 2d 20 2d 20 38 38 20 46 52  + col2 - - 88 FR
2df30 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2df40 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 32 30 39 0d  .----..145..209.
2df50 0a 32 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .264....query I 
2df60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2df70 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 33 37 20  DISTINCT + + 37 
2df80 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2df90 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37  0 cor0..----..37
2dfa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2dfb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2dfc0 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2d 20  INCT - col1 - - 
2dfd0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
2dfe0 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36  ----..-23..54..6
2dff0 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
2e000 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2e010 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2e020 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2e030 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2e040 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2e050 33 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  34..SELECT - col
2e060 32 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  2 * + CAST( NULL
2e070 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
2e080 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2e090 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2e0a0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
2e0b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2e0c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2e0d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 34  wsort label-1334
2e0e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
2e0f0 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * + CAST ( NULL 
2e100 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
2e110 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2e120 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
2e130 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
2e140 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2e150 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d  LL cor0.col0 + -
2e160 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2e170 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2e180 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
2e190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e1a0 74 0d 0a 53 45 4c 45 43 54 20 38 38 20 2b 20 2b  t..SELECT 88 + +
2e1b0 20 31 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   14 AS col0 FROM
2e1c0 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
2e1d0 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
2e1e0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
2e1f0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 65  es hashing to ee
2e200 39 34 61 37 30 32 39 62 31 66 32 39 35 35 66 32  94a7029b1f2955f2
2e210 36 64 38 62 31 63 64 64 31 61 34 35 38 37 0d 0a  6d8b1cdd1a4587..
2e220 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2e230 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2e240 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2e250 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2e260 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2e270 33 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  37..SELECT + col
2e280 30 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20  0 DIV col1 FROM 
2e290 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
2e2a0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
2e2b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2e2c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2e2d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33 37  wsort label-1337
2e2e0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
2e2f0 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  / col1 FROM tab0
2e300 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2e310 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2e320 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2e330 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2e340 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2e350 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2e360 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e370 45 43 54 20 35 37 20 63 6f 6c 32 20 46 52 4f 4d  ECT 57 col2 FROM
2e380 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2e390 2d 2d 2d 0d 0a 35 37 0d 0a 35 37 0d 0a 35 37 0d  ---..57..57..57.
2e3a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e3b0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
2e3c0 2a 20 2d 20 28 20 2b 20 28 20 63 6f 6c 32 20 29  * - ( + ( col2 )
2e3d0 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
2e3e0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d  --..-1..-1089..-
2e3f0 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
2e400 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e410 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  ALL + - col2 * -
2e420 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b   col1 + col0 * +
2e430 20 39 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   95 AS col2 FROM
2e440 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2e450 2d 2d 2d 0d 0a 31 36 38 39 0d 0a 36 36 35 30 0d  ---..1689..6650.
2e460 0a 38 38 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .8848....onlyif 
2e470 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2e480 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2e490 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2e4a0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2e4b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e4c0 6c 2d 31 33 34 31 0d 0a 53 45 4c 45 43 54 20 2b  l-1341..SELECT +
2e4d0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
2e4e0 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
2e4f0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2e500 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2e510 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
2e520 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2e530 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2e540 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2e550 62 65 6c 2d 31 33 34 31 0d 0a 53 45 4c 45 43 54  bel-1341..SELECT
2e560 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   + + CAST ( NULL
2e570 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
2e580 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
2e590 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
2e5a0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2e5b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e5c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2e5d0 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 35  NCT - col1 + + 5
2e5e0 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  9 FROM tab0 AS c
2e5f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a  or0..----..-27..
2e600 2d 33 32 0d 0a 2d 33 38 0d 0a 0d 0a 6f 6e 6c 79  -32..-38....only
2e610 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2e620 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2e630 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2e640 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2e650 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e660 61 62 65 6c 2d 31 33 34 33 0d 0a 53 45 4c 45 43  abel-1343..SELEC
2e670 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53  T DISTINCT + CAS
2e680 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
2e690 44 20 29 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  D ) + col1 * col
2e6a0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
2e6b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2e6c0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
2e6d0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2e6e0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2e6f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2e700 31 33 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53  1343..SELECT DIS
2e710 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 4e  TINCT + CAST ( N
2e720 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
2e730 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41   + col1 * col0 A
2e740 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2e750 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e760 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
2e770 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e780 2d 20 34 32 20 46 52 4f 4d 20 74 61 62 31 2c 20  - 42 FROM tab1, 
2e790 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2e7a0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2e7b0 68 69 6e 67 20 74 6f 20 39 38 39 34 30 39 33 66  hing to 9894093f
2e7c0 32 39 63 30 64 65 66 61 65 39 31 33 34 37 39 33  29c0defae9134793
2e7d0 34 66 30 36 30 33 32 39 0d 0a 0d 0a 71 75 65 72  4f060329....quer
2e7e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e7f0 45 43 54 20 2b 20 2b 20 37 33 20 41 53 20 63 6f  ECT + + 73 AS co
2e800 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2e810 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
2e820 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
2e830 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2e840 68 69 6e 67 20 74 6f 20 65 35 66 62 66 35 64 31  hing to e5fbf5d1
2e850 32 39 62 31 38 31 62 61 63 64 36 31 31 33 62 62  29b181bacd6113bb
2e860 63 38 37 33 32 34 39 36 0d 0a 0d 0a 71 75 65 72  c8732496....quer
2e870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e880 45 43 54 20 63 6f 6c 32 20 2b 20 33 39 20 46 52  ECT col2 + 39 FR
2e890 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
2e8a0 33 35 0d 0a 39 33 0d 0a 39 36 0d 0a 0d 0a 71 75  35..93..96....qu
2e8b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e8c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 37  ELECT DISTINCT 7
2e8d0 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  4 AS col1 FROM t
2e8e0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 37 34 0d 0a 0d  ab1..----..74...
2e8f0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2e900 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2e910 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2e920 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2e930 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2e940 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e950 54 20 28 20 32 34 20 29 20 2b 20 63 6f 6c 32 20  T ( 24 ) + col2 
2e960 2a 20 36 39 20 63 6f 6c 32 20 46 52 4f 4d 20 74  * 69 col2 FROM t
2e970 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 37 35 30 0d  ab1..----..3750.
2e980 0a 33 39 35 37 0d 0a 36 36 34 38 0d 0a 0d 0a 71  .3957..6648....q
2e990 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e9a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
2e9b0 28 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 29 20  ( - tab0.col2 ) 
2e9c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2e9d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d  0..----..-164..-
2e9e0 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79 20  2..-66....query 
2e9f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2ea00 54 20 63 6f 6c 30 20 2a 20 39 33 20 2b 20 63 6f  T col0 * 93 + co
2ea10 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l0 * + col2 AS c
2ea20 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
2ea30 2d 2d 2d 0d 0a 31 35 31 32 30 0d 0a 34 34 31 0d  ---..15120..441.
2ea40 0a 39 36 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .9600....query I
2ea50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ea60 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29   ( - cor0.col0 )
2ea70 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41   * - cor0.col0 A
2ea80 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2ea90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2eaa0 31 32 32 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d  1225..576..7921.
2eab0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2eac0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2ead0 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 34 34 20   cor0.col1 * 44 
2eae0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2eaf0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2eb00 0a 2d 31 31 34 34 0d 0a 2d 34 34 30 0d 0a 2d 35  .-1144..-440..-5
2eb10 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  72....query I ro
2eb20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2eb30 53 54 49 4e 43 54 20 2d 20 38 39 20 2a 20 2d 20  STINCT - 89 * - 
2eb40 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col2 * col0 FROM
2eb50 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2eb60 2d 2d 2d 0d 0a 31 36 38 32 31 0d 0a 31 38 30 34  ---..16821..1804
2eb70 39 32 0d 0a 32 36 37 31 37 38 0d 0a 0d 0a 71 75  92..267178....qu
2eb80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2eb90 45 4c 45 43 54 20 2d 20 36 20 2d 20 2b 20 31 33  ELECT - 6 - + 13
2eba0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
2ebb0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63   AS cor0, tab1 c
2ebc0 6f 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or1, tab0 AS cor
2ebd0 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  2..----..81 valu
2ebe0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 39  es hashing to 99
2ebf0 62 62 61 62 66 37 65 66 66 38 34 30 35 30 63 66  bbabf7eff84050cf
2ec00 36 63 36 39 37 34 61 30 31 65 62 37 31 34 0d 0a  6c6974a01eb714..
2ec10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ec20 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
2ec30 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  l0 + col1 * col1
2ec40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2ec50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2ec60 0d 0a 33 36 0d 0a 36 37 33 0d 0a 38 39 0d 0a 0d  ..36..673..89...
2ec70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ec80 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2ec90 54 20 2d 20 37 30 20 2a 20 63 6f 72 30 2e 63 6f  T - 70 * cor0.co
2eca0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2ecb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31  cor0..----..-231
2ecc0 30 0d 0a 2d 35 37 34 30 0d 0a 2d 37 30 0d 0a 0d  0..-5740..-70...
2ecd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ece0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
2ecf0 36 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  68 AS col2 FROM 
2ed00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2ed10 2d 2d 0d 0a 31 36 33 32 0d 0a 32 33 38 30 0d 0a  --..1632..2380..
2ed20 36 30 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6052....query I 
2ed30 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ed40 41 4c 4c 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b  ALL + ( col1 ) +
2ed50 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
2ed60 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2ed70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33  0..----..110..13
2ed80 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20  2..180....query 
2ed90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2eda0 54 20 31 36 20 2b 20 39 32 20 46 52 4f 4d 20 74  T 16 + 92 FROM t
2edb0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a  ab0..----..108..
2edc0 31 30 38 0d 0a 31 30 38 0d 0a 0d 0a 6f 6e 6c 79  108..108....only
2edd0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2ede0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2edf0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2ee00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ee10 74 20 6c 61 62 65 6c 2d 31 33 36 30 0d 0a 53 45  t label-1360..SE
2ee20 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LECT + cor0.col2
2ee30 20 44 49 56 20 2d 20 37 30 20 46 52 4f 4d 20 74   DIV - 70 FROM t
2ee40 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
2ee50 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
2ee60 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
2ee70 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 34  es hashing to a4
2ee80 36 66 34 34 66 33 30 62 32 31 38 33 35 30 38 66  6f44f30b2183508f
2ee90 33 32 63 31 36 61 37 39 34 37 39 63 64 39 0d 0a  32c16a79479cd9..
2eea0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2eeb0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2eec0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2eed0 20 6c 61 62 65 6c 2d 31 33 36 30 0d 0a 53 45 4c   label-1360..SEL
2eee0 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
2eef0 2f 20 2d 20 37 30 20 46 52 4f 4d 20 74 61 62 32  / - 70 FROM tab2
2ef00 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43  , tab1 AS cor0 C
2ef10 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 0d 0a  ROSS JOIN tab1..
2ef20 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2ef30 68 61 73 68 69 6e 67 20 74 6f 20 61 34 36 66 34  hashing to a46f4
2ef40 34 66 33 30 62 32 31 38 33 35 30 38 66 33 32 63  4f30b2183508f32c
2ef50 31 36 61 37 39 34 37 39 63 64 39 0d 0a 0d 0a 6f  16a79479cd9....o
2ef60 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2ef70 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2ef80 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2ef90 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2efa0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 31 0d  sort label-1361.
2efb0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44  .SELECT - col1 D
2efc0 49 56 20 2b 20 31 33 20 41 53 20 63 6f 6c 31 20  IV + 13 AS col1 
2efd0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2efe0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 37 0d  0..----..-6..-7.
2eff0 0a 2d 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .-7....skipif my
2f000 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2f010 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2f020 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36 31  wsort label-1361
2f030 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
2f040 2f 20 2b 20 31 33 20 41 53 20 63 6f 6c 31 20 46  / + 13 AS col1 F
2f050 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2f060 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 37 0d 0a  ..----..-6..-7..
2f070 2d 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  -7....query I ro
2f080 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2f090 4c 20 2d 20 33 35 20 2b 20 63 6f 6c 32 20 2a 20  L - 35 + col2 * 
2f0a0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
2f0b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f0c0 2d 31 35 36 39 0d 0a 2d 36 38 31 0d 0a 2d 38 37  -1569..-681..-87
2f0d0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
2f0e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2f0f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2f100 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2f110 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2f120 2d 31 33 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1363..SELECT DI
2f130 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f  STINCT col2 * co
2f140 6c 32 20 44 49 56 20 2b 20 31 30 20 2b 20 2d 20  l2 DIV + 10 + - 
2f150 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  ( - col1 ) FROM 
2f160 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2f170 2d 2d 0d 0a 31 39 34 0d 0a 37 36 33 0d 0a 39 37  --..194..763..97
2f180 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2f190 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2f1a0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2f1b0 72 74 20 6c 61 62 65 6c 2d 31 33 36 33 0d 0a 53  rt label-1363..S
2f1c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2f1d0 6f 6c 32 20 2a 20 63 6f 6c 32 20 2f 20 2b 20 31  ol2 * col2 / + 1
2f1e0 30 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29  0 + - ( - col1 )
2f1f0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2f200 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 37  r0..----..194..7
2f210 36 33 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  63..97....query 
2f220 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f230 54 20 34 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63  T 4 * col2 * - c
2f240 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2f250 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
2f260 36 36 34 0d 0a 2d 31 32 39 39 36 0d 0a 2d 33 36  664..-12996..-36
2f270 38 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  864....onlyif my
2f280 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2f290 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2f2a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2f2b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f2c0 65 6c 2d 31 33 36 35 0d 0a 53 45 4c 45 43 54 20  el-1365..SELECT 
2f2d0 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f  cor0.col2 DIV co
2f2e0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2f2f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2f300 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73  --..0..0..1....s
2f310 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f320 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f340 62 65 6c 2d 31 33 36 35 0d 0a 53 45 4c 45 43 54  bel-1365..SELECT
2f350 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c   cor0.col2 / col
2f360 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2f370 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2f380 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75  -..0..0..1....qu
2f390 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f3a0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
2f3b0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + + col2 * + co
2f3c0 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
2f3d0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 38 38  ab1..----..11988
2f3e0 38 0d 0a 33 32 35 35 34 0d 0a 37 35 38 31 39 0d  8..32554..75819.
2f3f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f400 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
2f410 31 20 2b 20 31 39 20 2b 20 33 39 20 2a 20 2b 20  1 + 19 + 39 * + 
2f420 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  tab1.col1 FROM t
2f430 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 37 0d  ab1..----..1007.
2f440 0a 33 39 39 0d 0a 35 31 33 0d 0a 0d 0a 71 75 65  .399..513....que
2f450 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f460 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 72  LECT ALL ( + cor
2f470 31 2e 63 6f 6c 32 20 29 20 2b 20 2d 20 28 20 39  1.col2 ) + - ( 9
2f480 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
2f490 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
2f4a0 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
2f4b0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
2f4c0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 63  es hashing to 0c
2f4d0 34 63 37 33 39 63 35 34 33 31 37 64 35 33 35 62  4c739c54317d535b
2f4e0 30 33 37 65 61 61 66 38 30 32 62 39 62 61 0d 0a  037eaaf802b9ba..
2f4f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f500 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2f510 43 54 20 28 20 32 30 20 29 20 41 53 20 63 6f 6c  CT ( 20 ) AS col
2f520 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
2f530 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f540 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .20....query I r
2f550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2f560 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c   cor0.col1 * col
2f570 30 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  0 - col1 AS col0
2f580 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2f590 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a  r0..----..1978..
2f5a0 33 32 39 38 0d 0a 38 30 30 38 0d 0a 0d 0a 71 75  3298..8008....qu
2f5b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f5c0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b  ELECT - col2 + +
2f5d0 20 33 38 20 46 52 4f 4d 20 74 61 62 32 20 41 53   38 FROM tab2 AS
2f5e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2f5f0 31 31 0d 0a 31 32 0d 0a 0d 0a 71 75 65 72 79 20  11..12....query 
2f600 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f610 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2d 20 2b  T ALL + col0 - +
2f620 20 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 29   ( col2 * col0 )
2f630 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2f640 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f650 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d 0a 2d  ..-159..-3584..-
2f660 37 36 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7600....skipif p
2f670 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2f680 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2f690 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2f6a0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2f6b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f6c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2f6d0 54 20 2d 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20  T - + col2 col1 
2f6e0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2f6f0 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a  ----..-54..-57..
2f700 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -96....onlyif my
2f710 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2f720 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2f730 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2f740 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2f750 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f760 31 33 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1374..SELECT ALL
2f770 20 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20   + col1 + CAST( 
2f780 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
2f790 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2f7a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f7b0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
2f7c0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
2f7d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2f7e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2f7f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 34 0d  sort label-1374.
2f800 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2f810 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 + CAST ( NULL
2f820 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
2f830 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
2f840 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
2f850 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2f860 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2f870 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2f880 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2f890 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2f8a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f8b0 33 37 35 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  375..SELECT cor0
2f8c0 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 2d  .col1 DIV col0 -
2f8d0 20 2b 20 31 35 20 41 53 20 63 6f 6c 31 20 46 52   + 15 AS col1 FR
2f8e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2f8f0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 31 33 0d  .----..-12..-13.
2f900 0a 2d 31 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-14....skipif m
2f910 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2f920 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2f930 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37  owsort label-137
2f940 35 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  5..SELECT cor0.c
2f950 6f 6c 31 20 2f 20 63 6f 6c 30 20 2d 20 2b 20 31  ol1 / col0 - + 1
2f960 35 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  5 AS col1 FROM t
2f970 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2f980 2d 0d 0a 2d 31 32 0d 0a 2d 31 33 0d 0a 2d 31 34  -..-12..-13..-14
2f990 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f9a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2f9b0 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20  INCT - - col1 * 
2f9c0 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( + cor0.col2 ) 
2f9d0 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  + - col1 * + col
2f9e0 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  0 * - col1 FROM 
2f9f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2fa00 2d 2d 0d 0a 31 34 37 36 38 0d 0a 33 34 33 32 0d  --..14768..3432.
2fa10 0a 36 39 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .6970....onlyif 
2fa20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2fa30 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2fa40 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2fa50 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2fa60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2fa70 6c 2d 31 33 37 37 0d 0a 53 45 4c 45 43 54 20 44  l-1377..SELECT D
2fa80 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 43  ISTINCT col1 * C
2fa90 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
2faa0 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 31  IMAL ) FROM tab1
2fab0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2fac0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2fad0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2fae0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2faf0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37  owsort label-137
2fb00 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
2fb10 43 54 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28  CT col1 * CAST (
2fb20 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20   NULL AS REAL ) 
2fb30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2fb40 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
2fb50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fb60 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
2fb70 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46   col0 + + col0 F
2fb80 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2fb90 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2fba0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2fbb0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2fbc0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2fbd0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2fbe0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2fbf0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 39  wsort label-1379
2fc00 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
2fc10 31 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  1 * col0 + + col
2fc20 30 20 2b 20 2b 20 43 41 53 54 28 20 2d 20 37 38  0 + + CAST( - 78
2fc30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
2fc40 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
2fc50 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2fc60 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2fc70 2d 2d 2d 0d 0a 2d 31 30 36 30 31 38 0d 0a 2d 31  ---..-106018..-1
2fc80 37 31 33 36 0d 0a 2d 33 36 33 34 38 30 0d 0a 0d  7136..-363480...
2fc90 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2fca0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2fcb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2fcc0 6c 61 62 65 6c 2d 31 33 37 39 0d 0a 53 45 4c 45  label-1379..SELE
2fcd0 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  CT - + col1 * co
2fce0 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  l0 + + col0 + + 
2fcf0 43 41 53 54 20 28 20 2d 20 37 38 20 41 53 20 49  CAST ( - 78 AS I
2fd00 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c  NTEGER ) * - col
2fd10 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * - cor0.col0 
2fd20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2fd30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2fd40 0a 2d 31 30 36 30 31 38 0d 0a 2d 31 37 31 33 36  .-106018..-17136
2fd50 0d 0a 2d 33 36 33 34 38 30 0d 0a 0d 0a 71 75 65  ..-363480....que
2fd60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2fd70 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72  LECT ALL - - cor
2fd80 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53  0.col0 * col1 AS
2fd90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2fda0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2fdb0 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a  040..640..78....
2fdc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fdd0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
2fde0 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 46 52  col1 ) * col2 FR
2fdf0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2fe00 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36  .----..-1534..-6
2fe10 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72  46..-837....quer
2fe20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fe30 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
2fe40 20 28 20 2b 20 32 35 20 29 20 2b 20 2d 20 63 6f   ( + 25 ) + - co
2fe50 6c 31 20 2a 20 28 20 2d 20 37 34 20 29 20 46 52  l1 * ( - 74 ) FR
2fe60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2fe70 0a 2d 2d 2d 2d 0d 0a 31 32 33 33 0d 0a 32 32 36  .----..1233..226
2fe80 39 0d 0a 34 33 34 31 0d 0a 0d 0a 71 75 65 72 79  9..4341....query
2fe90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fea0 43 54 20 2d 20 28 20 39 34 20 29 20 2b 20 63 6f  CT - ( 94 ) + co
2feb0 6c 32 20 2a 20 33 36 20 46 52 4f 4d 20 74 61 62  l2 * 36 FROM tab
2fec0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2fed0 0a 2d 35 38 0d 0a 31 30 39 34 0d 0a 32 38 35 38  .-58..1094..2858
2fee0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fef0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
2ff00 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
2ff10 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2ff20 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a  1534..646..837..
2ff30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ff40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2ff50 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30  CT col2 * - cor0
2ff60 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
2ff70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2ff80 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39  .----..-1..-1089
2ff90 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79  ..-6724....query
2ffa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ffb0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2ffc0 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 33 20 41 53  r0.col0 * + 3 AS
2ffd0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2ffe0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2fff0 30 35 0d 0a 32 36 37 0d 0a 37 32 0d 0a 0d 0a 71  05..267..72....q
30000 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30010 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 28 20 2d  SELECT + - ( ( -
30020 20 63 6f 6c 30 20 29 20 29 20 2a 20 63 6f 6c 31   col0 ) ) * col1
30030 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
30040 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
30050 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32  0..----..1360..2
30060 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 6f 6e 6c 79  48..4661....only
30070 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
30080 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
30090 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
300a0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
300b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
300c0 61 62 65 6c 2d 31 33 38 38 0d 0a 53 45 4c 45 43  abel-1388..SELEC
300d0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
300e0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
300f0 44 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  D ) + col1 AS co
30100 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
30110 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
30120 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
30130 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
30140 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
30150 72 74 20 6c 61 62 65 6c 2d 31 33 38 38 0d 0a 53  rt label-1388..S
30160 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
30170 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
30180 49 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31  INTEGER ) + col1
30190 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
301a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
301b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
301c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
301d0 54 20 2d 20 39 33 20 2a 20 2d 20 63 6f 6c 31 20  T - 93 * - col1 
301e0 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
301f0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30200 0d 0a 2d 32 36 33 39 33 34 0d 0a 2d 36 39 33 39  ..-263934..-6939
30210 36 36 0d 0a 2d 39 30 32 31 0d 0a 0d 0a 71 75 65  66..-9021....que
30220 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30230 4c 45 43 54 20 2d 20 31 35 20 2a 20 2d 20 63 6f  LECT - 15 * - co
30240 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
30250 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 30  cor0..----..1230
30260 0d 0a 31 35 0d 0a 34 39 35 0d 0a 0d 0a 71 75 65  ..15..495....que
30270 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30280 4c 45 43 54 20 2b 20 36 35 20 2a 20 2d 20 63 6f  LECT + 65 * - co
30290 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
302a0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
302b0 2d 2d 0d 0a 2d 31 31 30 35 0d 0a 2d 32 30 31 35  --..-1105..-2015
302c0 0d 0a 2d 33 38 33 35 0d 0a 0d 0a 71 75 65 72 79  ..-3835....query
302d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
302e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61  CT DISTINCT - ta
302f0 62 31 2e 63 6f 6c 31 20 2b 20 37 37 20 2b 20 28  b1.col1 + 77 + (
30300 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20   col2 ) AS col2 
30310 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
30320 0a 31 30 35 0d 0a 31 32 34 0d 0a 31 36 30 0d 0a  .105..124..160..
30330 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30340 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 32  t..SELECT - cor2
30350 2e 63 6f 6c 31 20 2b 20 63 6f 72 31 2e 63 6f 6c  .col1 + cor1.col
30360 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
30370 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab0, tab0 AS cor
30380 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 2c  0, tab0 AS cor1,
30390 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d   tab0 AS cor2..-
303a0 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
303b0 61 73 68 69 6e 67 20 74 6f 20 33 39 30 62 39 36  ashing to 390b96
303c0 34 61 31 30 62 61 37 62 33 33 64 37 33 63 62 61  4a10ba7b33d73cba
303d0 38 64 62 32 63 33 34 37 38 33 0d 0a 0d 0a 71 75  8db2c34783....qu
303e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
303f0 45 4c 45 43 54 20 28 20 2d 20 63 6f 72 30 2e 63  ELECT ( - cor0.c
30400 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
30410 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
30420 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
30430 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
30440 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
30450 63 37 38 39 30 34 36 39 65 61 62 62 32 63 36 66  c7890469eabb2c6f
30460 63 38 31 34 35 34 62 33 35 64 32 33 33 33 62 36  c81454b35d2333b6
30470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
30490 63 6f 6c 32 20 2a 20 31 32 20 2b 20 63 6f 6c 32  col2 * 12 + col2
304a0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
304b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
304c0 0d 0a 2d 32 38 36 0d 0a 2d 32 39 37 0d 0a 2d 34  ..-286..-297..-4
304d0 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  18....skipif pos
304e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
304f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
30500 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
30510 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
30520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30530 53 45 4c 45 43 54 20 36 30 20 2a 20 2d 20 63 6f  SELECT 60 * - co
30540 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
30550 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 30 0d 0a  2..----..-1020..
30560 2d 31 38 36 30 0d 0a 2d 33 35 34 30 0d 0a 0d 0a  -1860..-3540....
30570 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30580 0a 53 45 4c 45 43 54 20 2b 20 37 32 20 46 52 4f  .SELECT + 72 FRO
30590 4d 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72  M tab0, tab2 cor
305a0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
305b0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
305c0 20 68 61 73 68 69 6e 67 20 74 6f 20 39 32 63 63   hashing to 92cc
305d0 33 64 35 64 61 61 35 35 30 33 30 34 65 39 36 63  3d5daa550304e96c
305e0 31 35 34 32 37 38 37 36 39 31 63 37 0d 0a 0d 0a  1542787691c7....
305f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30600 0a 53 45 4c 45 43 54 20 2b 20 33 32 20 46 52 4f  .SELECT + 32 FRO
30610 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  M tab0, tab0 AS 
30620 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
30630 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
30640 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
30650 66 34 66 30 31 61 63 39 37 65 62 38 33 34 34 35  f4f01ac97eb83445
30660 62 31 37 32 31 66 33 61 65 32 38 39 36 31 61 0d  b1721f3ae28961a.
30670 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
30680 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
30690 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
306a0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
306b0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
306c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 39  wsort label-1399
306d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43  ..SELECT ALL - C
306e0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
306f0 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
30700 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f  OM tab0, tab2 co
30710 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
30720 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
30730 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
30740 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
30750 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30760 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30770 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30780 20 6c 61 62 65 6c 2d 31 33 39 39 0d 0a 53 45 4c   label-1399..SEL
30790 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28  ECT ALL - CAST (
307a0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
307b0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
307c0 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72 30 0d  tab0, tab2 cor0.
307d0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
307e0 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
307f0 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
30800 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 71  ff0d216fe0b....q
30810 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30820 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
30830 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  - - cor0.col1 FR
30840 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74  OM tab1, tab0, t
30850 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
30860 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..86..91..97...
30870 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30880 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 37 32 20  ..SELECT ALL 72 
30890 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
308a0 31 2c 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  1, tab2, tab0 AS
308b0 20 63 6f 72 30 2c 20 74 61 62 30 0d 0a 2d 2d 2d   cor0, tab0..---
308c0 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
308d0 68 69 6e 67 20 74 6f 20 65 31 36 31 38 61 62 66  hing to e1618abf
308e0 65 31 32 62 65 36 61 39 35 30 63 63 35 37 35 64  e12be6a950cc575d
308f0 36 39 35 36 33 39 62 37 0d 0a 0d 0a 71 75 65 72  695639b7....quer
30900 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
30910 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  ECT col2 + col2 
30920 2b 20 2d 20 63 6f 6c 32 20 2a 20 74 61 62 30 2e  + - col2 * tab0.
30930 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
30940 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
30950 30 32 33 0d 0a 2d 36 35 36 30 0d 0a 31 0d 0a 0d  023..-6560..1...
30960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30970 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38 36 20  ..SELECT - - 86 
30980 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
30990 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
309a0 0a 38 36 0d 0a 38 36 0d 0a 38 36 0d 0a 0d 0a 71  .86..86..86....q
309b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
309c0 53 45 4c 45 43 54 20 39 30 20 2b 20 63 6f 6c 31  SELECT 90 + col1
309d0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
309e0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
309f0 0d 0a 31 30 30 0d 0a 31 30 33 0d 0a 31 31 36 0d  ..100..103..116.
30a00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30a10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
30a20 4e 43 54 20 2b 20 35 36 20 41 53 20 63 6f 6c 32  NCT + 56 AS col2
30a30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
30a40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30a50 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
30a60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
30a70 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor1.col0 FROM t
30a80 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
30a90 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
30aa0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
30ab0 20 68 61 73 68 69 6e 67 20 74 6f 20 37 32 39 63   hashing to 729c
30ac0 31 65 64 64 61 39 33 33 32 33 39 38 32 39 39 66  1edda9332398299f
30ad0 33 39 63 64 31 37 34 65 64 38 34 30 0d 0a 0d 0a  39cd174ed840....
30ae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30af0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63  .SELECT col2 * c
30b00 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 * - col1 AS 
30b10 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
30b20 2d 2d 2d 2d 0d 0a 2d 36 31 31 38 38 34 0d 0a 2d  ----..-611884..-
30b30 39 33 36 35 34 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e  93654..-97....on
30b40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
30b50 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
30b60 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
30b70 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
30b80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30b90 20 6c 61 62 65 6c 2d 31 34 30 38 0d 0a 53 45 4c   label-1408..SEL
30ba0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54  ECT ALL - - CAST
30bb0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
30bc0 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   ) * col1 + - co
30bd0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
30be0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
30bf0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
30c00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
30c10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
30c20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30c30 61 62 65 6c 2d 31 34 30 38 0d 0a 53 45 4c 45 43  abel-1408..SELEC
30c40 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54 20 28  T ALL - - CAST (
30c50 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
30c60 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   ) * col1 + - co
30c70 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
30c80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
30c90 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
30ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
30cb0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 39 20 41  .SELECT ALL 59 A
30cc0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
30cd0 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab0 cor0..---
30ce0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
30cf0 69 6e 67 20 74 6f 20 61 39 62 39 39 36 36 64 37  ing to a9b9966d7
30d00 34 39 64 31 62 32 63 65 35 39 35 35 65 64 31 32  49d1b2ce5955ed12
30d10 33 39 34 66 39 62 63 0d 0a 0d 0a 71 75 65 72 79  394f9bc....query
30d20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30d30 43 54 20 38 36 20 2b 20 2d 20 63 6f 6c 32 20 2a  CT 86 + - col2 *
30d40 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   ( col1 ) AS col
30d50 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
30d60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 38  or0..----..-1448
30d70 0d 0a 2d 35 36 30 0d 0a 2d 37 35 31 0d 0a 0d 0a  ..-560..-751....
30d80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
30d90 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
30da0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
30db0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
30dc0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 31  wsort label-1411
30dd0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
30de0 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  T col1 + - col0 
30df0 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72  - - col2 * - cor
30e00 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c  0.col0 DIV + col
30e10 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
30e20 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
30e30 2d 0d 0a 2d 31 31 31 0d 0a 2d 31 36 33 0d 0a 2d  -..-111..-163..-
30e40 33 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  31....skipif mys
30e50 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
30e60 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
30e70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 31 0d  sort label-1411.
30e80 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
30e90 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2d   col1 + - col0 -
30ea0 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30   - col2 * - cor0
30eb0 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 41  .col0 / + col0 A
30ec0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
30ed0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30ee0 2d 31 31 31 0d 0a 2d 31 36 33 0d 0a 2d 33 31 0d  -111..-163..-31.
30ef0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30f00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 39  rt..SELECT - - 9
30f10 33 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  3 + + col1 AS co
30f20 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
30f30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d  cor0..----..103.
30f40 0a 31 30 36 0d 0a 31 31 39 0d 0a 0d 0a 73 6b 69  .106..119....ski
30f50 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
30f60 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
30f70 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
30f80 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
30f90 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
30fa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
30fb0 28 20 28 20 2d 20 63 6f 72 31 2e 63 6f 6c 30 20  ( ( - cor1.col0 
30fc0 29 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) ) col1 FROM ta
30fd0 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
30fe0 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f   JOIN tab0 AS co
30ff0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
31000 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 39  es hashing to 09
31010 64 38 61 39 31 32 64 65 31 62 38 61 62 37 36 32  d8a912de1b8ab762
31020 65 35 66 66 62 65 30 32 38 63 65 39 39 65 0d 0a  e5ffbe028ce99e..
31030 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31040 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
31050 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   + col0 * col0 A
31060 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
31070 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31080 31 33 32 32 0d 0a 36 36 32 0d 0a 38 30 31 32 0d  1322..662..8012.
31090 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
310a0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
310b0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  + col2 * col2 * 
310c0 33 33 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  33 FROM tab1 AS 
310d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 32  cor0..----..1072
310e0 38 31 0d 0a 33 30 34 32 30 38 0d 0a 39 36 32 33  81..304208..9623
310f0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
31100 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 20 2a  sort..SELECT 8 *
31110 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   - col1 + - col0
31120 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * + cor0.col1 F
31130 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
31140 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d  ..----..-2752..-
31150 34 31 37 31 0d 0a 2d 38 38 32 37 0d 0a 0d 0a 6f  4171..-8827....o
31160 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
31170 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
31180 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
31190 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
311a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31 37 0d  sort label-1417.
311b0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d  .SELECT col2 + -
311c0 20 63 6f 6c 30 20 44 49 56 20 32 33 20 46 52 4f   col0 DIV 23 FRO
311d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
311e0 2d 2d 2d 2d 0d 0a 30 0d 0a 33 32 0d 0a 37 39 0d  ----..0..32..79.
311f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
31200 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
31210 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31220 74 20 6c 61 62 65 6c 2d 31 34 31 37 0d 0a 53 45  t label-1417..SE
31230 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LECT col2 + - co
31240 6c 30 20 2f 20 32 33 20 46 52 4f 4d 20 74 61 62  l0 / 23 FROM tab
31250 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
31260 0a 30 0d 0a 33 32 0d 0a 37 39 0d 0a 0d 0a 71 75  .0..32..79....qu
31270 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31280 45 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 32  ELECT - ( - col2
31290 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   ) * col1 + - co
312a0 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
312b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
312c0 2d 2d 0d 0a 31 32 33 35 0d 0a 31 33 37 38 0d 0a  --..1235..1378..
312d0 35 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  560....skipif po
312e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
312f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
31300 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
31310 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
31320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31330 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31340 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2d 20 2d   col0 + col2 - -
31350 20 74 61 62 31 2e 63 6f 6c 30 20 63 6f 6c 31 20   tab1.col0 col1 
31360 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
31370 0a 31 38 35 0d 0a 32 35 36 0d 0a 36 30 0d 0a 0d  .185..256..60...
31380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31390 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
313a0 54 20 74 61 62 31 2e 63 6f 6c 32 20 2d 20 2b 20  T tab1.col2 - + 
313b0 74 61 62 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab1.col2 AS col
313c0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
313d0 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
313e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
313f0 33 32 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41  32 + tab2.col0 A
31400 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
31410 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 31 31  ..----..110..111
31420 0d 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..39....query I 
31430 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31440 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  + ( col2 ) * + c
31450 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  or0.col2 + - col
31460 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
31470 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 37 0d  or0..----..1427.
31480 0a 36 31 37 0d 0a 36 39 38 0d 0a 0d 0a 71 75 65  .617..698....que
31490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
314a0 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 74 61  LECT col1 * - ta
314b0 62 32 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b  b2.col0 * col1 +
314c0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 36   col1 * col0 * 6
314d0 37 20 2b 20 36 30 20 46 52 4f 4d 20 74 61 62 32  7 + 60 FROM tab2
314e0 0d 0a 2d 2d 2d 2d 0d 0a 33 36 38 37 36 0d 0a 36  ..----..36876..6
314f0 37 32 31 30 0d 0a 37 38 37 32 0d 0a 0d 0a 71 75  7210..7872....qu
31500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31510 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
31520 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2d 20 31 31   + col1 ) + - 11
31530 20 2b 20 39 36 20 46 52 4f 4d 20 74 61 62 32 0d   + 96 FROM tab2.
31540 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 31 36 0d  .----..102..116.
31550 0a 31 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .144....onlyif m
31560 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
31570 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
31580 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
31590 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
315a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
315b0 2d 31 34 32 35 0d 0a 53 45 4c 45 43 54 20 63 6f  -1425..SELECT co
315c0 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 2b 20 63  l1 + + CAST( + c
315d0 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
315e0 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
315f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31600 32 30 38 37 0d 0a 32 32 30 0d 0a 33 30 31 39 0d  2087..220..3019.
31610 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
31620 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
31630 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31640 74 20 6c 61 62 65 6c 2d 31 34 32 35 0d 0a 53 45  t label-1425..SE
31650 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 43 41  LECT col1 + + CA
31660 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53 20 49  ST ( + col0 AS I
31670 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32 20  NTEGER ) * col2 
31680 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31690 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 37 0d 0a 32  0..----..2087..2
316a0 32 30 0d 0a 33 30 31 39 0d 0a 0d 0a 71 75 65 72  20..3019....quer
316b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
316c0 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT - - cor0.col
316d0 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 + col2 AS col1
316e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
316f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31  r0..----..108..1
31700 31 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65 72 79  14..192....query
31710 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31720 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b  CT cor0.col0 + +
31730 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f   col0 * col1 FRO
31740 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
31750 2d 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d  ----..1422..224.
31760 0a 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .4680....query I
31770 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31780 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a   DISTINCT col1 *
31790 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b 20   + ( + col2 ) + 
317a0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52  + col2 * col0 FR
317b0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
317c0 35 36 36 0d 0a 34 32 31 38 0d 0a 38 39 32 38 0d  566..4218..8928.
317d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
317e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
317f0 30 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  0 * - tab0.col0 
31800 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
31810 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35  0..----..1225..5
31820 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72  76..7921....quer
31830 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31840 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ECT col0 + + col
31850 30 20 2a 20 34 35 20 2a 20 2d 20 63 6f 6c 31 20  0 * 45 * - col1 
31860 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31870 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 30 31 32  0..----..-207012
31880 0d 0a 2d 36 30 33 35 36 0d 0a 2d 39 37 35 38 0d  ..-60356..-9758.
31890 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
318a0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
318b0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
318c0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
318d0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
318e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 31  wsort label-1431
318f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
31900 54 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28  T col0 * + CAST(
31910 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 53 49   cor0.col2 AS SI
31920 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46  GNED ) AS col0 F
31930 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
31940 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38  ..----..35..7298
31950 0d 0a 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..792....skipif 
31960 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31970 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31980 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
31990 33 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  31..SELECT DISTI
319a0 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53  NCT col0 * + CAS
319b0 54 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  T ( cor0.col2 AS
319c0 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
319d0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
319e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a  cor0..----..35..
319f0 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65  7298..792....que
31a00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31a10 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
31a20 33 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  31 + + col2 AS c
31a30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
31a40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
31a50 32 30 0d 0a 2d 31 37 31 30 0d 0a 2d 32 38 38 30  20..-1710..-2880
31a60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31a70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
31a80 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  + + col2 + - cor
31a90 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53  0.col0 * col1 AS
31aa0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
31ab0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
31ac0 32 34 0d 0a 2d 35 38 33 0d 0a 2d 39 34 34 0d 0a  24..-583..-944..
31ad0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31ae0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
31af0 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   * - col2 + + co
31b00 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
31b10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d  cor0..----..-34.
31b20 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d 0a 0d 0a  .-7216..-759....
31b30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31b40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
31b50 63 6f 6c 30 20 2a 20 2b 20 35 36 20 41 53 20 63  col0 * + 56 AS c
31b60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
31b70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 32   cor0..----..392
31b80 0d 0a 34 33 36 38 0d 0a 34 34 32 34 0d 0a 0d 0a  ..4368..4424....
31b90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
31ba0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
31bb0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
31bc0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
31bd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 36  wsort label-1436
31be0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
31bf0 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20  col1 DIV - col1 
31c00 2b 20 2d 20 38 20 2a 20 2d 20 63 6f 6c 31 20 46  + - 8 * - col1 F
31c10 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
31c20 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 32 30 37  ..----..103..207
31c30 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..79....skipif m
31c40 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
31c50 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
31c60 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33  owsort label-143
31c70 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  6..SELECT + cor0
31c80 2e 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 2b  .col1 / - col1 +
31c90 20 2d 20 38 20 2a 20 2d 20 63 6f 6c 31 20 46 52   - 8 * - col1 FR
31ca0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31cb0 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 32 30 37 0d  .----..103..207.
31cc0 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .79....query I r
31cd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
31ce0 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 37 20  LL - - col1 * 7 
31cf0 2a 20 33 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 35 AS col1 FRO
31d00 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31d10 2d 2d 2d 2d 0d 0a 32 34 35 30 0d 0a 33 31 38 35  ----..2450..3185
31d20 0d 0a 36 33 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..6370....onlyif
31d30 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
31d40 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
31d50 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
31d60 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
31d70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31d80 65 6c 2d 31 34 33 38 0d 0a 53 45 4c 45 43 54 20  el-1438..SELECT 
31d90 2d 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e  - col1 + CAST( N
31da0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
31db0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
31dc0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
31dd0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
31de0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
31df0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
31e00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
31e10 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 38 0d 0a  ort label-1438..
31e20 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
31e30 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
31e40 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30  NTEGER ) AS col0
31e50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
31e60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
31e70 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
31e80 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
31e90 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
31ea0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
31eb0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
31ec0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
31ed0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
31ee0 20 63 6f 6c 31 20 2a 20 39 36 20 63 6f 6c 31 20   col1 * 96 col1 
31ef0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
31f00 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 32  0..----..1248..2
31f10 34 39 36 0d 0a 39 36 30 0d 0a 0d 0a 71 75 65 72  496..960....quer
31f20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31f30 45 43 54 20 2b 20 36 32 20 2a 20 63 6f 6c 30 20  ECT + 62 * col0 
31f40 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31f50 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33 34 0d 0a 34 38  0..----..434..48
31f60 33 36 0d 0a 34 38 39 38 0d 0a 0d 0a 71 75 65 72  36..4898....quer
31f70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31f80 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  ECT col0 + - col
31f90 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
31fa0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
31fb0 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
31fc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31fd0 43 54 20 2d 20 34 20 2a 20 63 6f 6c 32 20 46 52  CT - 4 * col2 FR
31fe0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31ff0 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 0d 0a 2d 32 32  .----..-216..-22
32000 38 0d 0a 2d 33 38 34 0d 0a 0d 0a 71 75 65 72 79  8..-384....query
32010 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32020 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
32030 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col2 + - cor0.co
32040 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
32050 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
32060 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32070 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a  ELECT - - col2 *
32080 20 39 34 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f   94 + col0 AS co
32090 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
320a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 37 39  cor0..----..5079
320b0 0d 0a 35 34 32 32 0d 0a 39 31 30 34 0d 0a 0d 0a  ..5422..9104....
320c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
320d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
320e0 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 2a 20  col0 - - col0 * 
320f0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
32100 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32110 2d 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d  ----..1422..224.
32120 0a 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .4680....query I
32130 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32140 20 2d 20 2d 20 31 31 20 41 53 20 63 6f 6c 31 20   - - 11 AS col1 
32150 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
32160 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 31 0d  0..----..11..11.
32170 0a 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .11....query I r
32180 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
32190 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  LL + col0 + + co
321a0 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  l0 * + col0 * + 
321b0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
321c0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
321d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 31 37  or0..----..10617
321e0 36 0d 0a 31 35 32 36 0d 0a 33 35 39 30 33 34 0d  6..1526..359034.
321f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
32200 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
32210 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
32220 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
32230 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
32240 34 34 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  448..SELECT DIST
32250 49 4e 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20  INCT - col2 DIV 
32260 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
32270 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
32280 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a  ..----..-2..-5..
32290 2d 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -7....skipif mys
322a0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
322b0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
322c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 38 0d  sort label-1448.
322d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
322e0 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31   - col2 / + col1
322f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
32300 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32310 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a  ..-2..-5..-7....
32320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32330 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33 32 20 2d  .SELECT - - 32 -
32340 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
32350 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
32360 2d 2d 0d 0a 2d 34 36 0d 0a 2d 34 37 0d 0a 32 35  --..-46..-47..25
32370 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
32380 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
32390 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  l0 * - col0 * - 
323a0 63 6f 6c 30 20 2d 20 2d 20 37 38 20 41 53 20 63  col0 - - 78 AS c
323b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
323c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
323d0 32 30 36 36 0d 0a 2d 35 31 31 39 32 32 0d 0a 35  2066..-511922..5
323e0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
323f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
32400 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63   cor0.col2 * - c
32410 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
32420 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32430 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
32440 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
32450 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72  IIIIIIIIIIIIII r
32460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32470 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
32480 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
32490 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
324a0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 2c  0, tab0 AS cor1,
324b0 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d   tab0 AS cor2..-
324c0 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73  ---..3645 values
324d0 20 68 61 73 68 69 6e 67 20 74 6f 20 65 37 65 61   hashing to e7ea
324e0 38 61 33 30 63 61 65 62 33 35 34 30 39 64 31 35  8a30caeb35409d15
324f0 64 32 63 65 30 61 62 62 64 35 61 36 0d 0a 0d 0a  d2ce0abbd5a6....
32500 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32510 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
32520 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
32530 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f  OM tab0, tab1 co
32540 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
32550 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
32560 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 66 34  s hashing to 7f4
32570 61 39 62 66 32 34 64 36 34 38 33 33 37 30 36 64  a9bf24d64833706d
32580 66 62 64 64 30 62 61 66 34 39 64 37 39 0d 0a 0d  fbdd0baf49d79...
32590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
325a0 0d 0a 53 45 4c 45 43 54 20 2b 20 32 30 20 46 52  ..SELECT + 20 FR
325b0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f  OM tab2, tab1 co
325c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
325d0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 66  es hashing to 2f
325e0 64 64 39 34 32 66 65 30 33 30 37 61 36 66 66 36  dd942fe0307a6ff6
325f0 36 62 36 33 30 30 34 65 66 31 30 32 63 34 0d 0a  6b63004ef102c4..
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 63 6f 6c 31 20 2b  t..SELECT col1 +
32620 20 2b 20 28 20 39 33 20 29 20 46 52 4f 4d 20 74   + ( 93 ) FROM t
32630 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39 0d 0a  ab0..----..179..
32640 31 38 34 0d 0a 31 39 30 0d 0a 0d 0a 71 75 65 72  184..190....quer
32650 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32660 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74  ECT DISTINCT + t
32670 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab2.col2 FROM ta
32680 62 32 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  b2, tab1 cor0..-
32690 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
326a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
326b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
326c0 4e 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20  NCT tab0.col0 * 
326d0 2b 20 33 37 20 46 52 4f 4d 20 74 61 62 30 0d 0a  + 37 FROM tab0..
326e0 2d 2d 2d 2d 0d 0a 31 32 39 35 0d 0a 33 32 39 33  ----..1295..3293
326f0 0d 0a 38 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..888....query I
32700 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32710 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 35 30   ALL col1 * - 50
32720 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
32730 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 30 0d  b1..----..-1300.
32740 0a 2d 35 30 30 0d 0a 2d 36 35 30 0d 0a 0d 0a 71  .-500..-650....q
32750 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32760 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
32770 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 * cor0.col0 
32780 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
32790 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
327a0 0a 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39 0d 0a  .4096..6400..9..
327b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
327c0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
327d0 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
327e0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
327f0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
32800 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32810 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e  rt..SELECT tab1.
32820 63 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 30 20  col1 + ( + col0 
32830 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) * col0 FROM ta
32840 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 34 31  b1..----..35..41
32850 30 36 0d 0a 36 34 31 33 0d 0a 0d 0a 73 6b 69 70  06..6413....skip
32860 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
32870 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
32880 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
32890 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
328a0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
328b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
328c0 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20 63 6f 6c  TINCT col0 - col
328d0 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  1 * cor0.col0 co
328e0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
328f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 36  cor0..----..-576
32900 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d 0a 0d 0a 6f  ..-75..-960....o
32910 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
32920 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
32930 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
32940 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
32950 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 33 0d  sort label-1463.
32960 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
32970 20 28 20 2d 20 63 6f 6c 32 20 29 20 44 49 56 20   ( - col2 ) DIV 
32980 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  - col0 FROM tab1
32990 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
329a0 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69 70  0..1..18....skip
329b0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
329c0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
329d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
329e0 2d 31 34 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  -1463..SELECT DI
329f0 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 32 20  STINCT ( - col2 
32a00 29 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ) / - col0 FROM 
32a10 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
32a20 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a  --..0..1..18....
32a30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32a40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 35  .SELECT ALL + 95
32a50 20 2b 20 2d 20 35 32 20 46 52 4f 4d 20 74 61 62   + - 52 FROM tab
32a60 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
32a70 0a 34 33 0d 0a 34 33 0d 0a 34 33 0d 0a 0d 0a 71  .43..43..43....q
32a80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32a90 53 45 4c 45 43 54 20 2d 20 2d 20 34 36 20 2a 20  SELECT - - 46 * 
32aa0 2b 20 33 38 20 46 52 4f 4d 20 74 61 62 30 20 41  + 38 FROM tab0 A
32ab0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
32ac0 34 38 0d 0a 31 37 34 38 0d 0a 31 37 34 38 0d 0a  48..1748..1748..
32ad0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32ae0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32af0 43 54 20 2b 20 39 39 20 2b 20 2d 20 63 6f 6c 31  CT + 99 + - col1
32b00 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
32b10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
32b20 0d 0a 31 33 0d 0a 32 0d 0a 38 0d 0a 0d 0a 71 75  ..13..2..8....qu
32b30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32b40 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
32b50 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63  ol0 * col2 - - c
32b60 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
32b70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35   cor0..----..165
32b80 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a  ..3712..7760....
32b90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32ba0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f  .SELECT ALL ( co
32bb0 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53  l0 ) * - col1 AS
32bc0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
32bd0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
32be0 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d  1040..-640..-78.
32bf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32c00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
32c10 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  NCT - col0 + - c
32c20 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 * + col0 AS 
32c30 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
32c40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
32c50 31 32 30 0d 0a 2d 37 30 34 0d 0a 2d 38 31 0d 0a  120..-704..-81..
32c60 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
32c70 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
32c80 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
32c90 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
32ca0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
32cb0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 30 0d  sort label-1470.
32cc0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
32cd0 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 31 20 2b 20  l2 * + ( col1 + 
32ce0 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
32cf0 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
32d00 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  0 ) FROM tab1 co
32d10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
32d20 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
32d30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
32d40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
32d50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
32d60 65 6c 2d 31 34 37 30 0d 0a 53 45 4c 45 43 54 20  el-1470..SELECT 
32d70 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 28  ALL - col2 * + (
32d80 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 20 28   col1 + + CAST (
32d90 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
32da0 20 29 20 2a 20 2d 20 63 6f 6c 30 20 29 20 46 52   ) * - col0 ) FR
32db0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
32dc0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
32dd0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
32de0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32df0 38 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  89 AS col2 FROM 
32e00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
32e10 2d 2d 0d 0a 38 39 0d 0a 38 39 0d 0a 38 39 0d 0a  --..89..89..89..
32e20 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
32e30 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
32e40 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
32e50 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
32e60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
32e70 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  72..SELECT ALL c
32e80 6f 6c 30 20 44 49 56 20 33 20 46 52 4f 4d 20 74  ol0 DIV 3 FROM t
32e90 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
32ea0 2d 0d 0a 31 31 0d 0a 32 39 0d 0a 38 0d 0a 0d 0a  -..11..29..8....
32eb0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
32ec0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
32ed0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
32ee0 61 62 65 6c 2d 31 34 37 32 0d 0a 53 45 4c 45 43  abel-1472..SELEC
32ef0 54 20 41 4c 4c 20 63 6f 6c 30 20 2f 20 33 20 46  T ALL col0 / 3 F
32f00 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
32f10 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 32 39 0d 0a  ..----..11..29..
32f20 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
32f30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
32f40 54 49 4e 43 54 20 2b 20 2b 20 36 34 20 2a 20 2b  TINCT + + 64 * +
32f50 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
32f60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
32f70 34 38 0d 0a 34 39 39 32 0d 0a 35 30 35 36 0d 0a  48..4992..5056..
32f80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32f90 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
32fa0 39 33 20 2b 20 2b 20 31 31 20 41 53 20 63 6f 6c  93 + + 11 AS col
32fb0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
32fc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a  or0..----..104..
32fd0 31 30 34 0d 0a 31 30 34 0d 0a 0d 0a 6f 6e 6c 79  104..104....only
32fe0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
32ff0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
33000 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
33010 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
33020 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33030 61 62 65 6c 2d 31 34 37 35 0d 0a 53 45 4c 45 43  abel-1475..SELEC
33040 54 20 28 20 2d 20 36 39 20 29 20 2b 20 2b 20 63  T ( - 69 ) + + c
33050 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol1 * CAST( NULL
33060 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
33070 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
33080 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
33090 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
330a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
330b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
330c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
330d0 20 6c 61 62 65 6c 2d 31 34 37 35 0d 0a 53 45 4c   label-1475..SEL
330e0 45 43 54 20 28 20 2d 20 36 39 20 29 20 2b 20 2b  ECT ( - 69 ) + +
330f0 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 4e   col1 * CAST ( N
33100 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
33110 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
33120 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
33130 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
33140 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
33150 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
33160 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63  L - - col2 * - c
33170 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
33180 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   cor0..----..-28
33190 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a  38..-7462..-97..
331a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
331b0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f  t..SELECT - ( co
331c0 6c 32 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 ) + col0 FROM
331d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
331e0 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37  ---..-16..-51..7
331f0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
33200 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
33210 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
33220 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
33230 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33240 31 34 37 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1478..SELECT ALL
33250 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 38 34   - col0 DIV + 84
33260 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
33270 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
33280 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
33290 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
332a0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
332b0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 38 0d 0a  ort label-1478..
332c0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
332d0 30 20 2f 20 2b 20 38 34 20 46 52 4f 4d 20 74 61  0 / + 84 FROM ta
332e0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
332f0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
33300 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
33310 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
33320 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
33330 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
33340 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
33350 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
33360 4c 20 2b 20 35 33 20 2a 20 63 6f 6c 30 20 63 6f  L + 53 * col0 co
33370 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
33380 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 32  cor0..----..1272
33390 0d 0a 31 38 35 35 0d 0a 34 37 31 37 0d 0a 0d 0a  ..1855..4717....
333a0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
333b0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
333c0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
333d0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
333e0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
333f0 72 74 20 6c 61 62 65 6c 2d 31 34 38 30 0d 0a 53  rt label-1480..S
33400 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  ELECT + col2 + +
33410 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 28 20   col0 + + CAST( 
33420 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col1 * - col0 AS
33430 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
33440 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
33450 2d 0d 0a 2d 32 30 30 37 0d 0a 2d 33 33 35 39 0d  -..-2007..-3359.
33460 0a 2d 37 39 32 38 0d 0a 0d 0a 73 6b 69 70 69 66  .-7928....skipif
33470 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
33480 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
33490 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
334a0 34 38 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  480..SELECT + co
334b0 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  l2 + + col0 + + 
334c0 43 41 53 54 20 28 20 63 6f 6c 31 20 2a 20 2d 20  CAST ( col1 * - 
334d0 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
334e0 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
334f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 30 37  or0..----..-2007
33500 0d 0a 2d 33 33 35 39 0d 0a 2d 37 39 32 38 0d 0a  ..-3359..-7928..
33510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33520 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 33 20 2b  t..SELECT + 43 +
33530 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
33540 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
33550 0a 2d 34 33 0d 0a 2d 34 38 0d 0a 2d 35 34 0d 0a  .-43..-48..-54..
33560 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
33570 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
33580 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
33590 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
335a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
335b0 38 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  82..SELECT DISTI
335c0 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  NCT col2 DIV - c
335d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
335e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
335f0 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69 70 69  .-5..-7....skipi
33600 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
33610 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
33620 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33630 31 34 38 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  1482..SELECT DIS
33640 54 49 4e 43 54 20 63 6f 6c 32 20 2f 20 2d 20 63  TINCT col2 / - c
33650 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
33660 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
33670 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 71 75 65 72 79  .-5..-7....query
33680 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33690 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35 38  CT DISTINCT + 58
336a0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41   + col2 * col1 A
336b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
336c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
336d0 31 35 35 0d 0a 32 38 39 36 0d 0a 37 35 32 30 0d  155..2896..7520.
336e0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
336f0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
33700 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
33710 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
33720 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..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 44 49 53 54 49 4e 43 54 20 33 39 20  ECT DISTINCT 39 
33750 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  * + col2 col2 FR
33760 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
33770 0a 2d 2d 2d 2d 0d 0a 32 31 30 36 0d 0a 32 32 32  .----..2106..222
33780 33 0d 0a 33 37 34 34 0d 0a 0d 0a 6f 6e 6c 79 69  3..3744....onlyi
33790 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
337a0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
337b0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
337c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
337d0 20 6c 61 62 65 6c 2d 31 34 38 35 0d 0a 53 45 4c   label-1485..SEL
337e0 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20 63  ECT + col2 DIV c
337f0 6f 6c 30 20 2b 20 36 37 20 46 52 4f 4d 20 74 61  ol0 + 67 FROM ta
33800 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
33810 0d 0a 36 37 0d 0a 36 37 0d 0a 36 38 0d 0a 0d 0a  ..67..67..68....
33820 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
33830 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
33840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33850 61 62 65 6c 2d 31 34 38 35 0d 0a 53 45 4c 45 43  abel-1485..SELEC
33860 54 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20  T + col2 / col0 
33870 2b 20 36 37 20 46 52 4f 4d 20 74 61 62 30 20 41  + 67 FROM tab0 A
33880 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 37  S cor0..----..67
33890 0d 0a 36 37 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72  ..67..68....quer
338a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
338b0 45 43 54 20 2d 20 31 34 20 41 53 20 63 6f 6c 31  ECT - 14 AS col1
338c0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
338d0 0d 0a 2d 31 34 0d 0a 2d 31 34 0d 0a 2d 31 34 0d  ..-14..-14..-14.
338e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
338f0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31  rt..SELECT - - 1
33900 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   + - col2 * + co
33910 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
33920 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34  cor0..----..-124
33930 37 0d 0a 2d 31 34 30 33 0d 0a 2d 35 36 39 0d 0a  7..-1403..-569..
33940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33950 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
33960 43 54 20 2b 20 2b 20 37 32 20 2a 20 2b 20 63 6f  CT + + 72 * + co
33970 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l0 + + col2 * + 
33980 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
33990 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
339a0 31 33 32 0d 0a 32 35 32 31 0d 0a 32 38 31 37 0d  132..2521..2817.
339b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
339c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 32  rt..SELECT + + 2
339d0 34 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  4 + + col1 AS co
339e0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
339f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d  cor0..----..110.
33a00 0a 31 31 35 0d 0a 31 32 31 0d 0a 0d 0a 71 75 65  .115..121....que
33a10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33a20 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
33a30 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  2 * + col0 + col
33a40 31 20 2a 20 33 31 20 2b 20 2b 20 63 6f 6c 31 20  1 * 31 + + col1 
33a50 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
33a60 2d 2d 2d 2d 0d 0a 2d 31 34 30 0d 0a 2d 32 34 35  ----..-140..-245
33a70 38 0d 0a 38 30 33 0d 0a 0d 0a 71 75 65 72 79 20  8..803....query 
33a80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33a90 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 34 20  T DISTINCT - 74 
33aa0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
33ab0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
33ac0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
33ad0 36 37 0d 0a 34 0d 0a 35 0d 0a 0d 0a 6f 6e 6c 79  67..4..5....only
33ae0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
33af0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
33b00 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
33b10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33b20 74 20 6c 61 62 65 6c 2d 31 34 39 32 0d 0a 53 45  t label-1492..SE
33b30 4c 45 43 54 20 2b 20 63 6f 6c 31 20 44 49 56 20  LECT + col1 DIV 
33b40 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
33b50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
33b60 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d  ----..1..1..1...
33b70 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
33b80 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
33b90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
33ba0 6c 61 62 65 6c 2d 31 34 39 32 0d 0a 53 45 4c 45  label-1492..SELE
33bb0 43 54 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 31  CT + col1 / col1
33bc0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
33bd0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
33be0 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65  ..1..1..1....que
33bf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33c00 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  LECT - col1 + - 
33c10 63 6f 6c 30 20 2a 20 39 31 20 46 52 4f 4d 20 74  col0 * 91 FROM t
33c20 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
33c30 2d 0d 0a 2d 36 36 38 0d 0a 2d 37 31 35 37 0d 0a  -..-668..-7157..
33c40 2d 37 32 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -7206....query I
33c50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33c60 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   ALL col2 + + co
33c70 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 37 37 20 41  r0.col1 * + 77 A
33c80 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
33c90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33ca0 36 36 35 35 0d 0a 37 30 38 39 0d 0a 37 34 37 30  6655..7089..7470
33cb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33cc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
33cd0 20 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   - + col0 AS col
33ce0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
33cf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
33d00 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
33d10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
33d20 4c 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  L + + ( + col0 )
33d30 20 2b 20 2d 20 28 20 2d 20 35 30 20 29 20 46 52   + - ( - 50 ) FR
33d40 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
33d50 2d 2d 0d 0a 31 32 38 0d 0a 31 32 39 0d 0a 35 37  --..128..129..57
33d60 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
33d70 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
33d80 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
33d90 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
33da0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33db0 31 34 39 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1497..SELECT - c
33dc0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol1 + + col2 DIV
33dd0 20 2b 20 38 39 20 46 52 4f 4d 20 74 61 62 31 20   + 89 FROM tab1 
33de0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
33df0 31 30 0d 0a 2d 31 32 0d 0a 2d 32 36 0d 0a 0d 0a  10..-12..-26....
33e00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
33e10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
33e20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33e30 61 62 65 6c 2d 31 34 39 37 0d 0a 53 45 4c 45 43  abel-1497..SELEC
33e40 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  T - col1 + + col
33e50 32 20 2f 20 2b 20 38 39 20 46 52 4f 4d 20 74 61  2 / + 89 FROM ta
33e60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
33e70 0d 0a 2d 31 30 0d 0a 2d 31 32 0d 0a 2d 32 36 0d  ..-10..-12..-26.
33e80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33e90 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
33ea0 31 20 2a 20 28 20 37 39 20 29 20 2b 20 2d 20 63  1 * ( 79 ) + - c
33eb0 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 + col0 FROM 
33ec0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
33ed0 2d 2d 0d 0a 2d 36 37 39 34 0d 0a 2d 37 31 38 39  --..-6794..-7189
33ee0 0d 0a 2d 37 36 36 33 0d 0a 0d 0a 71 75 65 72 79  ..-7663....query
33ef0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33f00 43 54 20 41 4c 4c 20 2d 20 37 37 20 46 52 4f 4d  CT ALL - 77 FROM
33f10 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
33f20 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
33f30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
33f40 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
33f50 20 33 61 32 34 31 35 35 63 62 39 31 63 65 66 66   3a24155cb91ceff
33f60 31 65 36 37 62 62 35 31 63 30 37 62 37 32 31 30  1e67bb51c07b7210
33f70 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
33f80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
33f90 20 2b 20 63 6f 6c 30 20 2a 20 32 33 20 46 52 4f   + col0 * 23 FRO
33fa0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
33fb0 2d 2d 2d 2d 0d 0a 32 30 34 37 0d 0a 35 35 32 0d  ----..2047..552.
33fc0 0a 38 30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .805....query I 
33fd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33fe0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 33  ALL + col0 + + 3
33ff0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
34000 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a  or0..----..112..
34010 33 35 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  35..96....query 
34020 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34030 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
34040 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
34050 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53  ab0 AS cor0 CROS
34060 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
34070 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
34080 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
34090 39 64 38 61 39 31 32 64 65 31 62 38 61 62 37 36  9d8a912de1b8ab76
340a0 32 65 35 66 66 62 65 30 32 38 63 65 39 39 65 0d  2e5ffbe028ce99e.
340b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
340c0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 31 20  rt..SELECT - 41 
340d0 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
340e0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 0d 0a 33  b2..----..287..3
340f0 31 39 38 0d 0a 33 32 33 39 0d 0a 0d 0a 6f 6e 6c  198..3239....onl
34100 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
34110 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
34120 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
34130 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
34140 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34150 6c 61 62 65 6c 2d 31 35 30 34 0d 0a 53 45 4c 45  label-1504..SELE
34160 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
34170 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 43   + tab1.col1 + C
34180 41 53 54 28 20 2d 20 39 32 20 41 53 20 53 49 47  AST( - 92 AS SIG
34190 4e 45 44 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20  NED ) col0 FROM 
341a0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d  tab1..----..-18.
341b0 0a 2d 36 33 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  .-63..1....skipi
341c0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
341d0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
341e0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
341f0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
34200 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
34210 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
34220 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
34230 72 74 20 6c 61 62 65 6c 2d 31 35 30 34 0d 0a 53  rt label-1504..S
34240 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
34250 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20  ol0 + tab1.col1 
34260 2b 20 43 41 53 54 20 28 20 2d 20 39 32 20 41 53  + CAST ( - 92 AS
34270 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 30 20   INTEGER ) col0 
34280 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
34290 0a 2d 31 38 0d 0a 2d 36 33 0d 0a 31 0d 0a 0d 0a  .-18..-63..1....
342a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
342b0 0a 53 45 4c 45 43 54 20 2b 20 32 39 20 46 52 4f  .SELECT + 29 FRO
342c0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43  M tab1 AS cor0 C
342d0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41  ROSS JOIN tab1 A
342e0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
342f0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
34300 6f 20 31 65 37 31 32 30 62 61 38 65 39 31 39 31  o 1e7120ba8e9191
34310 30 38 34 31 37 32 64 64 63 65 64 31 37 65 35 65  084172ddced17e5e
34320 62 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  b2....query I ro
34330 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 32  wsort..SELECT 92
34340 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
34350 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
34360 2d 0d 0a 2d 37 39 31 32 0d 0a 2d 38 33 37 32 0d  -..-7912..-8372.
34370 0a 2d 38 39 32 34 0d 0a 0d 0a 71 75 65 72 79 20  .-8924....query 
34380 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34390 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2d 20 63  T ALL col2 * - c
343a0 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 32 33 20  ol2 + col2 * 23 
343b0 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
343c0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 38 0d  b1..----..-1648.
343d0 0a 2d 31 39 32 38 0d 0a 2d 36 39 39 35 0d 0a 0d  .-1928..-6995...
343e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
343f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
34400 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
34410 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
34420 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
34430 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34440 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 32 36 20  T + col1 + + 26 
34450 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
34460 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33  S cor0..----..43
34470 0d 0a 35 37 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72  ..57..85....quer
34480 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34490 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 38  ECT - col1 + + 8
344a0 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
344b0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  0 cor0..----..10
344c0 36 0d 0a 31 38 33 0d 0a 36 32 31 0d 0a 0d 0a 71  6..183..621....q
344d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
344e0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 32 31  SELECT col2 + 21
344f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
34500 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34510 0d 0a 31 31 37 0d 0a 37 35 0d 0a 37 38 0d 0a 0d  ..117..75..78...
34520 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34530 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
34540 2d 20 39 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 90 AS col2 FRO
34550 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34560 2d 2d 2d 2d 0d 0a 2d 34 38 36 30 0d 0a 2d 35 31  ----..-4860..-51
34570 33 30 0d 0a 2d 38 36 34 30 0d 0a 0d 0a 71 75 65  30..-8640....que
34580 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34590 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  LECT cor0.col0 *
345a0 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 63 6f   + col0 + + ( co
345b0 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 29 20 2b 20  l0 * - col2 ) + 
345c0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  - col0 FROM tab2
345d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
345e0 2d 31 34 37 0d 0a 33 31 36 30 0d 0a 33 39 37 38  -147..3160..3978
345f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34600 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
34610 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l1 * - col0 AS c
34620 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
34630 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
34640 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
34650 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34660 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34  ECT DISTINCT + 4
34670 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 + col0 FROM ta
34680 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31  b1..----..104..1
34690 32 30 0d 0a 34 33 0d 0a 0d 0a 71 75 65 72 79 20  20..43....query 
346a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
346b0 54 20 33 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  T 32 * col0 * - 
346c0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
346d0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
346e0 34 37 32 36 34 0d 0a 2d 34 32 39 37 36 0d 0a 2d  47264..-42976..-
346f0 36 39 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6944....query I 
34700 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34710 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20  ALL tab2.col1 * 
34720 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 63 6f  - tab2.col0 + co
34730 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
34740 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  tab2..----..-132
34750 36 0d 0a 2d 31 38 36 0d 0a 2d 34 35 34 33 0d 0a  6..-186..-4543..
34760 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34770 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
34780 20 63 6f 6c 31 20 2b 20 2d 20 33 36 20 2a 20 2d   col1 + - 36 * -
34790 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab0.col0 FROM 
347a0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 36  tab0..----..1066
347b0 36 0d 0a 31 33 35 37 0d 0a 33 37 30 32 0d 0a 0d  6..1357..3702...
347c0 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
347d0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
347e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
347f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34800 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
34810 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 2c 20  , tab0 AS cor1, 
34820 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab2 AS cor2..--
34830 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68  --..972 values h
34840 61 73 68 69 6e 67 20 74 6f 20 35 39 31 61 39 61  ashing to 591a9a
34850 39 33 35 36 30 38 33 39 32 33 31 63 30 33 38 61  93560839231c038a
34860 31 65 31 30 62 64 32 34 30 61 0d 0a 0d 0a 71 75  1e10bd240a....qu
34870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34880 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 34  ELECT col1 * + 4
34890 38 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  8 + col0 AS col0
348a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
348b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 39 35 0d 0a  r0..----..1495..
348c0 32 39 31 30 0d 0a 38 39 35 0d 0a 0d 0a 71 75 65  2910..895....que
348d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
348e0 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
348f0 32 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  2 * col1 + - col
34900 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
34910 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
34920 2d 0d 0a 2d 31 39 34 0d 0a 2d 32 39 32 34 0d 0a  -..-194..-2924..
34930 2d 37 35 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49  -7553....query I
34940 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34950 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
34960 2e 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 30  .col0 * - ( col0
34970 20 29 20 2b 20 2d 20 63 6f 6c 32 20 2d 20 37 20   ) + - col2 - 7 
34980 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
34990 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 32 0d 0a 34 30  0..----..-52..40
349a0 33 32 0d 0a 36 32 39 37 0d 0a 0d 0a 71 75 65 72  32..6297....quer
349b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
349c0 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2d 20 63  ECT - + col1 - c
349d0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
349e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
349f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d  r0..----..-55..-
34a00 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71 75 65 72 79  58..-85....query
34a10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34a20 43 54 20 32 37 20 41 53 20 63 6f 6c 31 20 46 52  CT 27 AS col1 FR
34a30 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f  OM tab0, tab2 co
34a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
34a50 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 30  es hashing to 70
34a60 31 62 66 31 32 64 38 36 33 39 32 63 62 31 35 38  1bf12d86392cb158
34a70 35 64 39 65 34 66 33 63 37 32 65 39 61 38 0d 0a  5d9e4f3c72e9a8..
34a80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34a90 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 20 41 53  t..SELECT - 2 AS
34aa0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
34ab0 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
34ac0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
34ad0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
34ae0 32 30 63 39 32 31 33 33 31 36 35 32 37 64 35 30  20c9213316527d50
34af0 37 65 32 36 34 32 35 30 34 31 65 30 38 33 38 37  7e26425041e08387
34b00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34b10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
34b20 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  INCT - cor0.col0
34b30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
34b40 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
34b50 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d  ----..-3..-64..-
34b60 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
34b70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
34b80 4c 20 36 37 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  L 67 * col0 + co
34b90 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
34ba0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 0d  tab1..----..204.
34bb0 0a 34 33 35 32 0d 0a 35 34 34 30 0d 0a 0d 0a 71  .4352..5440....q
34bc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34bd0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
34be0 30 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 46 52  0 + tab2.col1 FR
34bf0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
34c00 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 6f 6e  37..38..96....on
34c10 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
34c20 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
34c30 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
34c40 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
34c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34c60 20 6c 61 62 65 6c 2d 31 35 32 38 0d 0a 53 45 4c   label-1528..SEL
34c70 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
34c80 32 20 2a 20 43 41 53 54 28 20 33 32 20 41 53 20  2 * CAST( 32 AS 
34c90 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
34ca0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 39 36  b1..----..-10396
34cb0 38 0d 0a 2d 32 39 34 39 31 32 0d 0a 2d 39 33 33  8..-294912..-933
34cc0 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  12....skipif mys
34cd0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
34ce0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
34cf0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32 38 0d  sort label-1528.
34d00 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
34d10 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 33   col2 * CAST ( 3
34d20 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  2 AS INTEGER ) F
34d30 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
34d40 2d 31 30 33 39 36 38 0d 0a 2d 32 39 34 39 31 32  -103968..-294912
34d50 0d 0a 2d 39 33 33 31 32 0d 0a 0d 0a 71 75 65 72  ..-93312....quer
34d60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34d70 45 43 54 20 41 4c 4c 20 2d 20 34 32 20 2b 20 63  ECT ALL - 42 + c
34d80 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
34d90 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
34da0 31 35 0d 0a 2d 31 36 0d 0a 2d 34 0d 0a 0d 0a 71  15..-16..-4....q
34db0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34dc0 53 45 4c 45 43 54 20 2d 20 2b 20 39 36 20 2d 20  SELECT - + 96 - 
34dd0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
34de0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
34df0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 0d 0a 2d 31  ..----..-129..-1
34e00 37 38 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  78..-97....query
34e10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34e20 43 54 20 39 39 20 2a 20 63 6f 72 30 2e 63 6f 6c  CT 99 * cor0.col
34e30 30 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  0 - - cor0.col1 
34e40 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
34e50 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 33 0d 0a 36 33  0..----..323..63
34e60 34 36 0d 0a 37 39 33 33 0d 0a 0d 0a 71 75 65 72  46..7933....quer
34e70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34e80 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
34e90 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
34ea0 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
34eb0 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
34ec0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
34ed0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 65  es hashing to 6e
34ee0 30 62 37 64 35 38 33 62 63 32 63 35 33 38 34 32  0b7d583bc2c53842
34ef0 31 36 36 64 33 65 36 62 61 32 64 36 64 32 0d 0a  166d3e6ba2d6d2..
34f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34f10 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34f20 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  CT + col2 + col1
34f30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
34f40 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
34f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 33 31  or0..----..-2031
34f60 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 31 37 0d 0a  ..-3394..-8017..
34f70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34f80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
34f90 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 46 52  - col0 - col2 FR
34fa0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
34fb0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d  .----..-16..-51.
34fc0 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .7....query I ro
34fd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
34fe0 2b 20 31 32 20 2b 20 2d 20 28 20 2b 20 63 6f 72  + 12 + - ( + cor
34ff0 30 2e 63 6f 6c 32 20 29 20 2a 20 2d 20 33 31 20  0.col2 ) * - 31 
35000 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
35010 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 36 0d 0a 37  0..----..1166..7
35020 39 34 0d 0a 38 32 35 0d 0a 0d 0a 71 75 65 72 79  94..825....query
35030 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35040 43 54 20 2d 20 28 20 2d 20 39 39 20 2b 20 63 6f  CT - ( - 99 + co
35050 6c 31 20 29 20 2a 20 2b 20 37 36 20 46 52 4f 4d  l1 ) * + 76 FROM
35060 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32   tab0..----..152
35070 0d 0a 36 30 38 0d 0a 39 38 38 0d 0a 0d 0a 71 75  ..608..988....qu
35080 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35090 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63  ELECT - col1 * c
350a0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ol1 + + col0 * c
350b0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
350c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
350d0 2d 2d 2d 0d 0a 2d 35 31 34 0d 0a 33 35 34 38 0d  ---..-514..3548.
350e0 0a 37 35 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .7511....query I
350f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35100 20 2b 20 37 35 20 2a 20 63 6f 6c 30 20 2b 20 63   + 75 * col0 + c
35110 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
35120 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33   cor0..----..183
35130 33 0d 0a 32 36 32 36 0d 0a 36 37 35 37 0d 0a 0d  3..2626..6757...
35140 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
35150 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
35160 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
35170 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
35180 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
35190 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 39 0d 0a  ort label-1539..
351a0 53 45 4c 45 43 54 20 2b 20 33 36 20 2a 20 2d 20  SELECT + 36 * - 
351b0 28 20 63 6f 6c 30 20 29 20 2b 20 2b 20 43 41 53  ( col0 ) + + CAS
351c0 54 28 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41  T( col0 + col2 A
351d0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63  S SIGNED ) * + c
351e0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
351f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
35200 2d 2d 2d 0d 0a 30 0d 0a 31 32 30 31 35 0d 0a 35  ---..0..12015..5
35210 30 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  04....skipif mys
35220 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
35230 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
35240 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 39 0d  sort label-1539.
35250 0a 53 45 4c 45 43 54 20 2b 20 33 36 20 2a 20 2d  .SELECT + 36 * -
35260 20 28 20 63 6f 6c 30 20 29 20 2b 20 2b 20 43 41   ( col0 ) + + CA
35270 53 54 20 28 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  ST ( col0 + col2
35280 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
35290 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
352a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
352b0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 32 30 31 35  ..----..0..12015
352c0 0d 0a 35 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..504....query I
352d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
352e0 20 2b 20 2d 20 34 33 20 2b 20 2d 20 63 6f 6c 32   + - 43 + - col2
352f0 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
35300 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
35310 2d 0d 0a 2d 32 39 35 39 0d 0a 2d 33 32 39 32 0d  -..-2959..-3292.
35320 0a 2d 39 32 35 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-9259....onlyif
35330 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
35340 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
35350 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
35360 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35370 6c 61 62 65 6c 2d 31 35 34 31 0d 0a 53 45 4c 45  label-1541..SELE
35380 43 54 20 2d 20 37 36 20 44 49 56 20 34 20 46 52  CT - 76 DIV 4 FR
35390 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
353a0 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 31 39 0d  .----..-19..-19.
353b0 0a 2d 31 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-19....skipif m
353c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
353d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
353e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34  owsort label-154
353f0 31 0d 0a 53 45 4c 45 43 54 20 2d 20 37 36 20 2f  1..SELECT - 76 /
35400 20 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   4 FROM tab2 AS 
35410 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d  cor0..----..-19.
35420 0a 2d 31 39 0d 0a 2d 31 39 0d 0a 0d 0a 6f 6e 6c  .-19..-19....onl
35430 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
35440 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
35450 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
35460 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
35470 72 74 20 6c 61 62 65 6c 2d 31 35 34 32 0d 0a 53  rt label-1542..S
35480 45 4c 45 43 54 20 2b 20 39 39 20 44 49 56 20 2d  ELECT + 99 DIV -
35490 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   cor0.col0 + col
354a0 31 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  1 * col1 * + col
354b0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
354c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 32 33  or0..----..16223
354d0 0d 0a 33 36 34 37 31 0d 0a 35 36 39 39 0d 0a 0d  ..36471..5699...
354e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
354f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
35500 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35510 6c 61 62 65 6c 2d 31 35 34 32 0d 0a 53 45 4c 45  label-1542..SELE
35520 43 54 20 2b 20 39 39 20 2f 20 2d 20 63 6f 72 30  CT + 99 / - cor0
35530 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63  .col0 + col1 * c
35540 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol1 * + col2 FRO
35550 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
35560 2d 2d 2d 2d 0d 0a 31 36 32 32 33 0d 0a 33 36 34  ----..16223..364
35570 37 31 0d 0a 35 36 39 39 0d 0a 0d 0a 71 75 65 72  71..5699....quer
35580 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35590 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 72  ECT - col1 * cor
355a0 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  0.col1 * - col1 
355b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
355c0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 33 37 39 0d  0..----..205379.
355d0 0a 32 39 37 39 31 0d 0a 34 39 31 33 0d 0a 0d 0a  .29791..4913....
355e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
355f0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f  .SELECT + + ( co
35600 6c 32 20 29 20 2d 20 2d 20 63 6f 6c 31 20 46 52  l2 ) - - col1 FR
35610 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
35620 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d  .----..119..173.
35630 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
35640 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
35650 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ol0 + + col0 * c
35660 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
35670 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35680 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d 0a  ---..1120..704..
35690 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  81....skipif pos
356a0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
356b0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
356c0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
356d0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
356e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
356f0 53 45 4c 45 43 54 20 35 33 20 2a 20 63 6f 6c 31  SELECT 53 * col1
35700 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
35710 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
35720 35 35 38 0d 0a 34 38 32 33 0d 0a 35 31 34 31 0d  558..4823..5141.
35730 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35740 72 74 0d 0a 53 45 4c 45 43 54 20 35 36 20 2a 20  rt..SELECT 56 * 
35750 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
35760 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
35770 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 32 0d 0a  or0..----..392..
35780 34 33 36 38 0d 0a 34 34 32 34 0d 0a 0d 0a 71 75  4368..4424....qu
35790 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
357a0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a  ELECT ALL col1 *
357b0 20 2d 20 39 38 20 41 53 20 63 6f 6c 30 20 46 52   - 98 AS col0 FR
357c0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
357d0 38 34 32 38 0d 0a 2d 38 39 31 38 0d 0a 2d 39 35  8428..-8918..-95
357e0 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  06....query I ro
357f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
35800 53 54 49 4e 43 54 20 2b 20 2d 20 28 20 2d 20 63  STINCT + - ( - c
35810 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 2d 20 63  or0.col0 ) * - c
35820 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
35830 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
35840 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30  ---..-1040..-640
35850 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-78....query I
35860 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35870 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   + - col1 + col1
35880 20 2a 20 2b 20 39 37 20 46 52 4f 4d 20 74 61 62   * + 97 FROM tab
35890 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
358a0 0a 38 32 35 36 0d 0a 38 37 33 36 0d 0a 39 33 31  .8256..8736..931
358b0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
358c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
358d0 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
358e0 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 * + col0 AS co
358f0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
35900 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30  cor0..----..1060
35910 39 37 0d 0a 31 35 31 39 0d 0a 33 35 38 39 35 36  97..1519..358956
35920 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
35930 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
35940 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
35950 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
35960 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
35970 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35  owsort label-155
35980 32 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  2..SELECT cor0.c
35990 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e 55  ol0 * + CAST( NU
359a0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46  LL AS SIGNED ) F
359b0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
359c0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
359d0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
359e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
359f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
35a00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35a10 2d 31 35 35 32 0d 0a 53 45 4c 45 43 54 20 63 6f  -1552..SELECT co
35a20 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54  r0.col0 * + CAST
35a30 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
35a40 45 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  ER ) FROM tab2 A
35a50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
35a60 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
35a70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35a80 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
35a90 20 2a 20 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a   * 1 FROM tab0..
35aa0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d  ----..-1..-33..-
35ab0 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
35ac0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
35ad0 6c 31 20 2b 20 38 20 41 53 20 63 6f 6c 31 20 46  l1 + 8 AS col1 F
35ae0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
35af0 31 38 0d 0a 32 31 0d 0a 33 34 0d 0a 0d 0a 6f 6e  18..21..34....on
35b00 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
35b10 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
35b20 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
35b30 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
35b40 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 35 0d 0a  ort label-1555..
35b50 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
35b60 2a 20 28 20 28 20 2d 20 63 6f 6c 31 20 29 20 29  * ( ( - col1 ) )
35b70 20 44 49 56 20 28 20 2b 20 36 35 20 29 20 41 53   DIV ( + 65 ) AS
35b80 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
35b90 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 0d 0a 2d 33 31  .----..-124..-31
35ba0 0d 0a 2d 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-52....skipif 
35bb0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
35bc0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
35bd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
35be0 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  55..SELECT ALL c
35bf0 6f 6c 30 20 2a 20 28 20 28 20 2d 20 63 6f 6c 31  ol0 * ( ( - col1
35c00 20 29 20 29 20 2f 20 28 20 2b 20 36 35 20 29 20   ) ) / ( + 65 ) 
35c10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
35c20 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 0d 0a 2d  0..----..-124..-
35c30 33 31 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79  31..-52....query
35c40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35c50 43 54 20 63 6f 6c 32 20 2b 20 2d 20 28 20 74 61  CT col2 + - ( ta
35c60 62 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74  b0.col1 ) FROM t
35c70 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a  ab0..----..-53..
35c80 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  -9..-96....onlyi
35c90 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
35ca0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
35cb0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
35cc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35cd0 20 6c 61 62 65 6c 2d 31 35 35 37 0d 0a 53 45 4c   label-1557..SEL
35ce0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
35cf0 20 63 6f 6c 31 20 2b 20 2d 20 34 38 20 44 49 56   col1 + - 48 DIV
35d00 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f   - tab2.col1 FRO
35d10 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab2..----..15
35d20 33 34 0d 0a 36 34 38 0d 0a 38 33 38 0d 0a 0d 0a  34..648..838....
35d30 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35d40 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35d50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35d60 61 62 65 6c 2d 31 35 35 37 0d 0a 53 45 4c 45 43  abel-1557..SELEC
35d70 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63  T ALL + col2 * c
35d80 6f 6c 31 20 2b 20 2d 20 34 38 20 2f 20 2d 20 74  ol1 + - 48 / - t
35d90 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ab2.col1 FROM ta
35da0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  b2..----..1534..
35db0 36 34 38 0d 0a 38 33 38 0d 0a 0d 0a 71 75 65 72  648..838....quer
35dc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35dd0 45 43 54 20 28 20 2b 20 31 34 20 29 20 46 52 4f  ECT ( + 14 ) FRO
35de0 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
35df0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
35e00 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
35e10 38 33 65 35 37 37 39 64 32 34 38 37 64 31 32 34  83e5779d2487d124
35e20 39 35 65 37 64 38 31 36 63 37 39 37 32 36 34 66  95e7d816c797264f
35e30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35e40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
35e50 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20  r0.col0 AS col0 
35e60 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
35e70 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
35e80 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
35e90 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
35ea0 6f 20 31 65 31 66 31 30 39 35 33 65 62 38 65 66  o 1e1f10953eb8ef
35eb0 66 65 39 62 32 30 65 37 34 36 66 38 61 37 66 64  fe9b20e746f8a7fd
35ec0 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
35ed0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
35ee0 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20  L + tab1.col0 * 
35ef0 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63  - tab1.col0 AS c
35f00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
35f10 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30  ---..-4096..-640
35f20 30 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49  0..-9....query I
35f30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35f40 20 31 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   14 AS col2 FROM
35f50 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
35f60 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
35f70 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
35f80 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30  es hashing to 40
35f90 39 63 31 37 39 30 62 37 30 32 35 34 30 64 64 39  9c1790b702540dd9
35fa0 64 63 30 36 37 63 31 39 36 35 62 37 63 30 0d 0a  dc067c1965b7c0..
35fb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35fc0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 30 20 2d 20  t..SELECT + 0 - 
35fd0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col0 * + col0 FR
35fe0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
35ff0 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36 34 30 30  --..-4096..-6400
36000 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-9....query I 
36010 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36020 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 34 34 20  ALL col0 * - 44 
36030 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
36040 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 38 0d 0a 2d  0..----..-308..-
36050 33 34 33 32 0d 0a 2d 33 34 37 36 0d 0a 0d 0a 6f  3432..-3476....o
36060 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
36070 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
36080 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
36090 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
360a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36 34 0d  sort label-1564.
360b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41  .SELECT ALL + CA
360c0 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49  ST( + col2 AS SI
360d0 47 4e 45 44 20 29 20 2d 20 2b 20 63 6f 6c 31 20  GNED ) - + col1 
360e0 2a 20 31 35 20 44 49 56 20 63 6f 6c 32 20 46 52  * 15 DIV col2 FR
360f0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
36100 2d 2d 0d 0a 34 37 0d 0a 35 35 0d 0a 39 34 0d 0a  --..47..55..94..
36110 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
36120 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
36130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36140 20 6c 61 62 65 6c 2d 31 35 36 34 0d 0a 53 45 4c   label-1564..SEL
36150 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
36160 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   + col2 AS INTEG
36170 45 52 20 29 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  ER ) - + col1 * 
36180 31 35 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20 74  15 / col2 FROM t
36190 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
361a0 34 37 0d 0a 35 35 0d 0a 39 34 0d 0a 0d 0a 71 75  47..55..94....qu
361b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
361c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
361d0 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f   ( + col2 ) * co
361e0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
361f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36200 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d  --..-1..-1089..-
36210 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
36220 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36230 63 6f 6c 32 20 2d 20 35 34 20 46 52 4f 4d 20 74  col2 - 54 FROM t
36240 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
36250 2d 0d 0a 2d 31 36 0d 0a 2d 32 37 0d 0a 2d 32 38  -..-16..-27..-28
36260 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36270 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
36280 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30  cor0.col0 * cor0
36290 2e 63 6f 6c 30 20 2b 20 39 20 41 53 20 63 6f 6c  .col0 + 9 AS col
362a0 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
362b0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
362c0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
362d0 67 20 74 6f 20 35 31 32 63 61 39 61 33 39 64 63  g to 512ca9a39dc
362e0 63 66 35 31 39 35 30 36 31 66 36 38 36 35 33 36  cf5195061f686536
362f0 61 34 39 37 66 0d 0a 0d 0a 71 75 65 72 79 20 49  a497f....query I
36300 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36310 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
36320 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32  r0.col0 + + col2
36330 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
36340 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  2 cor0..----..16
36350 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d 0a  12..725..844....
36360 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36370 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36380 20 2d 20 31 31 20 2a 20 2d 20 63 6f 6c 32 20 2a   - 11 * - col2 *
36390 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   tab0.col0 + col
363a0 30 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 - - col0 AS co
363b0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
363c0 2d 2d 0d 0a 34 35 35 0d 0a 38 30 34 35 36 0d 0a  --..455..80456..
363d0 38 37 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8760....onlyif m
363e0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
363f0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
36400 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
36410 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
36420 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36430 2d 31 35 37 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1570..SELECT AL
36440 4c 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  L CAST( NULL AS 
36450 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
36460 62 30 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41  b0, tab2, tab1 A
36470 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
36480 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
36490 74 6f 20 31 36 62 65 38 38 36 38 61 31 65 36 66  to 16be8868a1e6f
364a0 34 65 38 38 35 30 35 30 39 66 39 33 32 37 61 66  4e8850509f9327af
364b0 65 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  e90....skipif my
364c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
364d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
364e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 30  wsort label-1570
364f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
36500 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
36510 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 2c  GER ) FROM tab0,
36520 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
36530 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
36540 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
36550 31 36 62 65 38 38 36 38 61 31 65 36 66 34 65 38  16be8868a1e6f4e8
36560 38 35 30 35 30 39 66 39 33 32 37 61 66 65 39 30  850509f9327afe90
36570 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36580 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
36590 49 4e 43 54 20 63 6f 6c 32 20 2a 20 74 61 62 31  INCT col2 * tab1
365a0 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 46  .col0 - - col2 F
365b0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
365c0 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37 37 36 0d  216..3705..7776.
365d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
365e0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
365f0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
36600 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
36610 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
36620 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 32  wsort label-1572
36630 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
36640 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T + CAST( NULL A
36650 53 20 53 49 47 4e 45 44 20 29 20 2b 20 31 39 20  S SIGNED ) + 19 
36660 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36670 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
36680 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
36690 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
366a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
366b0 6c 61 62 65 6c 2d 31 35 37 32 0d 0a 53 45 4c 45  label-1572..SELE
366c0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
366d0 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
366e0 45 47 45 52 20 29 20 2b 20 31 39 20 41 53 20 63  EGER ) + 19 AS c
366f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
36700 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
36710 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36720 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
36730 6c 30 20 2b 20 2b 20 36 33 20 41 53 20 63 6f 6c  l0 + + 63 AS col
36740 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
36750 2d 0d 0a 31 32 37 0d 0a 31 34 33 0d 0a 36 36 0d  -..127..143..66.
36760 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
36770 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
36780 32 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  2 + tab2.col2 * 
36790 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
367a0 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 32 30 30 32 0d  ----..162..2002.
367b0 0a 32 39 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .2964....query I
367c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
367d0 20 2b 20 31 32 20 2b 20 63 6f 6c 31 20 2d 20 2b   + 12 + col1 - +
367e0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20   col2 * col0 AS 
367f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
36800 2d 2d 2d 2d 0d 0a 2d 31 34 36 0d 0a 2d 31 39 35  ----..-146..-195
36810 37 0d 0a 2d 32 39 37 33 0d 0a 0d 0a 71 75 65 72  7..-2973....quer
36820 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36830 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
36840 6f 6c 30 20 2d 20 2d 20 28 20 2d 20 63 6f 6c 31  ol0 - - ( - col1
36850 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
36860 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d  tab1..----..-23.
36870 0a 35 34 0d 0a 36 37 0d 0a 0d 0a 73 6b 69 70 69  .54..67....skipi
36880 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
36890 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
368a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
368b0 54 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20  T CAST ( - col2 
368c0 41 53 20 52 45 41 4c 20 29 20 2b 20 63 6f 6c 32  AS REAL ) + col2
368d0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
368e0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  ..0..0..0....onl
368f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
36900 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
36910 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
36920 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
36930 72 74 20 6c 61 62 65 6c 2d 31 35 37 38 0d 0a 53  rt label-1578..S
36940 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 63 6f  ELECT - CAST( co
36950 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l1 AS SIGNED ) *
36960 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 33 20   col1 * + ( + 3 
36970 29 20 2d 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d  ) - - col0 DIV -
36980 20 34 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53   47 FROM tab0 AS
36990 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   cor0..----..-22
369a0 31 38 38 0d 0a 2d 32 34 38 34 34 0d 0a 2d 32 38  188..-24844..-28
369b0 32 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  227....skipif my
369c0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
369d0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
369e0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 38  wsort label-1578
369f0 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
36a00 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  ( col1 AS INTEGE
36a10 52 20 29 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 28  R ) * col1 * + (
36a20 20 2b 20 33 20 29 20 2d 20 2d 20 63 6f 6c 30 20   + 3 ) - - col0 
36a30 2f 20 2d 20 34 37 20 46 52 4f 4d 20 74 61 62 30  / - 47 FROM tab0
36a40 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36a50 2d 32 32 31 38 38 0d 0a 2d 32 34 38 34 34 0d 0a  -22188..-24844..
36a60 2d 32 38 32 32 37 0d 0a 0d 0a 71 75 65 72 79 20  -28227....query 
36a70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36a80 54 20 28 20 37 39 20 29 20 2b 20 2b 20 63 6f 6c  T ( 79 ) + + col
36a90 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
36aa0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a  or0..----..133..
36ab0 31 33 36 0d 0a 31 37 35 0d 0a 0d 0a 6f 6e 6c 79  136..175....only
36ac0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
36ad0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
36ae0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
36af0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36b00 74 20 6c 61 62 65 6c 2d 31 35 38 30 0d 0a 53 45  t label-1580..SE
36b10 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20  LECT - col2 + - 
36b20 33 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52  31 DIV + col0 FR
36b30 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
36b40 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 33 31 0d  .----..-26..-31.
36b50 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-38....skipif m
36b60 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36b70 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36b80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38  owsort label-158
36b90 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  0..SELECT - col2
36ba0 20 2b 20 2d 20 33 31 20 2f 20 2b 20 63 6f 6c 30   + - 31 / + col0
36bb0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
36bc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d  r0..----..-26..-
36bd0 33 31 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79  31..-38....query
36be0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36bf0 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2d 20  CT + ( col2 ) - 
36c00 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
36c10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36c20 2d 33 34 0d 0a 2d 37 0d 0a 39 0d 0a 0d 0a 71 75  -34..-7..9....qu
36c30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36c40 45 4c 45 43 54 20 28 20 74 61 62 32 2e 63 6f 6c  ELECT ( tab2.col
36c50 32 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  2 + col2 ) AS co
36c60 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
36c70 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36 0d 0a  --..52..54..76..
36c80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36c90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
36ca0 43 54 20 2b 20 28 20 2d 20 63 6f 6c 32 20 2a 20  CT + ( - col2 * 
36cb0 63 6f 6c 30 20 29 20 2b 20 2d 20 28 20 74 61 62  col0 ) + - ( tab
36cc0 31 2e 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20  1.col1 ) * col2 
36cd0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36ce0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 36 0d 0a  1..----..-1566..
36cf0 2d 34 32 31 38 0d 0a 2d 38 39 32 38 0d 0a 0d 0a  -4218..-8928....
36d00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36d10 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 37 31  .SELECT - ( + 71
36d20 20 29 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   ) * col2 + col0
36d30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
36d40 0d 0a 2d 31 37 36 38 0d 0a 2d 31 39 31 30 0d 0a  ..-1768..-1910..
36d50 2d 32 36 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -2619....onlyif 
36d60 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
36d70 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
36d80 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
36d90 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
36da0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36db0 6c 2d 31 35 38 35 0d 0a 53 45 4c 45 43 54 20 28  l-1585..SELECT (
36dc0 20 63 6f 6c 30 20 29 20 2a 20 2b 20 43 41 53 54   col0 ) * + CAST
36dd0 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
36de0 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
36df0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
36e00 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
36e10 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36e20 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36e30 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38  owsort label-158
36e40 35 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 30  5..SELECT ( col0
36e50 20 29 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55   ) * + CAST ( NU
36e60 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
36e70 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
36e80 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
36e90 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
36ea0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36eb0 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   tab0.col2 * + c
36ec0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
36ed0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   tab0..----..283
36ee0 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71  8..7462..97....q
36ef0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36f00 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
36f10 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 * cor0.col1 
36f20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36f30 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
36f40 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a  00..-169..-676..
36f50 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
36f60 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
36f70 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
36f80 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
36f90 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
36fa0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38 38 0d  sort label-1588.
36fb0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
36fc0 20 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53   CAST( - col1 AS
36fd0 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
36fe0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
36ff0 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a  1534..646..837..
37000 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
37010 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
37020 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37030 20 6c 61 62 65 6c 2d 31 35 38 38 0d 0a 53 45 4c   label-1588..SEL
37040 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53  ECT - col2 * CAS
37050 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20 49 4e  T ( - col1 AS IN
37060 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
37070 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  2 cor0..----..15
37080 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a  34..646..837....
37090 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
370a0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
370b0 20 2b 20 31 20 2a 20 63 6f 6c 30 20 41 53 20 63   + 1 * col0 AS c
370c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
370d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
370e0 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
370f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37100 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
37110 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  1 + + col0 * cor
37120 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
37130 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
37140 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 36 30 32 35  ..----..18..6025
37150 0d 0a 36 32 32 34 0d 0a 0d 0a 71 75 65 72 79 20  ..6224....query 
37160 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37170 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
37180 30 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  0 * col0 * - col
37190 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
371a0 0d 0a 2d 2d 2d 2d 0d 0a 32 36 32 31 34 34 0d 0a  ..----..262144..
371b0 32 37 0d 0a 35 31 32 30 30 30 0d 0a 0d 0a 71 75  27..512000....qu
371c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
371d0 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b  ELECT - col1 * +
371e0 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29   ( + cor0.col2 )
371f0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   * cor0.col2 FRO
37200 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37210 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d 0a 2d 32  ----..-22599..-2
37220 34 35 34 38 0d 0a 2d 33 39 38 38 34 0d 0a 0d 0a  4548..-39884....
37230 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37240 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
37250 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 33 20   - - col1 * - 3 
37260 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37270 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 0d 0a 2d  0..----..-177..-
37280 35 31 0d 0a 2d 39 33 0d 0a 0d 0a 71 75 65 72 79  51..-93....query
37290 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
372a0 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
372b0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  + col2 * col1 AS
372c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
372d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
372e0 34 35 36 0d 0a 35 36 37 0d 0a 38 33 30 0d 0a 0d  456..567..830...
372f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37300 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
37310 2a 20 2b 20 31 34 20 46 52 4f 4d 20 74 61 62 31  * + 14 FROM tab1
37320 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37330 31 33 34 34 0d 0a 37 35 36 0d 0a 37 39 38 0d 0a  1344..756..798..
37340 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37350 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
37360 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 72 30  l0 * col2 + cor0
37370 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20  .col2 FROM tab2 
37380 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
37390 30 35 34 0d 0a 32 31 36 0d 0a 33 30 34 30 0d 0a  054..216..3040..
373a0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
373b0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
373c0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
373d0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
373e0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
373f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37400 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
37410 6c 31 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 30 20  l1 * + ( + col0 
37420 29 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ) - + cor0.col0 
37430 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
37440 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 32  or0..----..-1422
37450 0d 0a 2d 32 32 34 0d 0a 2d 34 36 38 30 0d 0a 0d  ..-224..-4680...
37460 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37470 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
37480 54 20 63 6f 6c 30 20 2b 20 2b 20 31 37 20 46 52  T col0 + + 17 FR
37490 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
374a0 30 36 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75  06..41..52....qu
374b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
374c0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f  ELECT ALL - ( co
374d0 6c 31 20 29 20 2a 20 63 6f 6c 31 20 2a 20 63 6f  l1 ) * col1 * co
374e0 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  l0 + col2 * col1
374f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
37500 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 37 32  b1..----..-12272
37510 0d 0a 2d 35 38 33 30 0d 0a 2d 36 32 34 0d 0a 0d  ..-5830..-624...
37520 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37530 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
37540 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  2 * col1 * col0 
37550 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
37560 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37570 0a 2d 33 33 39 35 0d 0a 2d 36 36 34 31 31 38 0d  .-3395..-664118.
37580 0a 2d 36 38 31 31 32 0d 0a 0d 0a 71 75 65 72 79  .-68112....query
37590 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
375a0 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  CT - col2 + col2
375b0 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
375c0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d 0a 31  1..----..1152..1
375d0 33 35 30 0d 0a 35 31 33 0d 0a 0d 0a 71 75 65 72  350..513....quer
375e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
375f0 45 43 54 20 35 34 20 2d 20 63 6f 6c 32 20 46 52  ECT 54 - col2 FR
37600 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
37610 36 0d 0a 32 37 0d 0a 32 38 0d 0a 0d 0a 71 75 65  6..27..28....que
37620 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37630 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
37640 34 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  4 FROM tab1..---
37650 2d 0d 0a 2d 31 32 0d 0a 2d 32 35 36 0d 0a 2d 33  -..-12..-256..-3
37660 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
37670 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
37680 4c 20 2d 20 37 33 20 41 53 20 63 6f 6c 32 20 46  L - 73 AS col2 F
37690 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
376a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 0d 0a 2d 37 33  ..----..-73..-73
376b0 0d 0a 2d 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-73....query I
376c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
376d0 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2b 20 28 20   ALL col1 + + ( 
376e0 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 31 20  col2 ) * + col1 
376f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
37700 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 33 0d 0a 36  2..----..1593..6
37710 36 33 0d 0a 38 36 38 0d 0a 0d 0a 71 75 65 72 79  63..868....query
37720 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37730 43 54 20 41 4c 4c 20 2d 20 32 39 20 2a 20 2d 20  CT ALL - 29 * - 
37740 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63  ( + col1 ) * + c
37750 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol0 + - col0 AS 
37760 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
37770 2d 2d 2d 2d 0d 0a 32 33 34 37 38 32 0d 0a 35 39  ----..234782..59
37780 38 33 32 0d 0a 39 38 34 32 30 0d 0a 0d 0a 71 75  832..98420....qu
37790 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
377a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
377b0 20 36 38 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63   68 * - col1 + c
377c0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d  ol0 + + col1 * -
377d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
377e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
377f0 30 39 35 0d 0a 36 34 34 0d 0a 37 39 35 0d 0a 0d  095..644..795...
37800 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
37810 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
37820 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
37830 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
37840 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
37850 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37860 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63  T ALL - col2 + c
37870 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
37880 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
37890 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d  ..-28..-47..-83.
378a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
378b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
378c0 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  NCT + cor0.col2 
378d0 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  * - cor0.col1 * 
378e0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
378f0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
37900 2d 31 30 39 38 32 0d 0a 2d 32 35 39 34 37 0d 0a  -10982..-25947..
37910 2d 39 30 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20  -90506....query 
37920 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37930 54 20 41 4c 4c 20 33 34 20 2b 20 2d 20 63 6f 6c  T ALL 34 + - col
37940 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
37950 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
37960 2d 0d 0a 2d 34 34 0d 0a 2d 34 35 0d 0a 32 37 0d  -..-44..-45..27.
37970 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
37980 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d  rt..SELECT + ( -
37990 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
379a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
379b0 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
379c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
379d0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
379e0 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32  r0.col0 + - col2
379f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
37a00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34  r0..----..-20..4
37a10 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..52....query I
37a20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37a30 20 44 49 53 54 49 4e 43 54 20 37 36 20 2a 20 63   DISTINCT 76 * c
37a40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
37a50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37   cor0..----..197
37a60 36 0d 0a 37 36 30 0d 0a 39 38 38 0d 0a 0d 0a 71  6..760..988....q
37a70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37a80 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
37a90 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col1 * + col1 AS
37aa0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
37ab0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
37ac0 30 30 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a  00..169..676....
37ad0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
37ae0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
37af0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
37b00 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
37b10 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
37b20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37b30 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 63 6f   ALL - col1 + co
37b40 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
37b50 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
37b60 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d  .-53..-9..-96...
37b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37b80 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72  ..SELECT + + cor
37b90 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53  0.col0 * col2 AS
37ba0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
37bb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d  cor0..----..162.
37bc0 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71  .3648..7680....q
37bd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37be0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
37bf0 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  * - col1 + col2 
37c00 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  * + col2 * col0 
37c10 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  + + col1 * col2 
37c20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
37c30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
37c40 0a 31 31 34 30 37 36 0d 0a 35 31 30 33 0d 0a 35  .114076..5103..5
37c50 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2728....query I 
37c60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37c70 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
37c80 32 20 2a 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c  2 * col1 - - col
37c90 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
37ca0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
37cb0 2d 0d 0a 2d 32 38 30 35 0d 0a 2d 37 33 38 30 0d  -..-2805..-7380.
37cc0 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-96....query I 
37cd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37ce0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20 2b  DISTINCT - + ( +
37cf0 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
37d00 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37d10 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
37d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37d30 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
37d40 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col2 * - cor0.co
37d50 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
37d60 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37d70 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d  --..-162..-3648.
37d80 0a 2d 37 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-7680....onlyif
37d90 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
37da0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
37db0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
37dc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
37dd0 6c 61 62 65 6c 2d 31 36 32 31 0d 0a 53 45 4c 45  label-1621..SELE
37de0 43 54 20 2b 20 38 30 20 2b 20 2b 20 63 6f 72 30  CT + 80 + + cor0
37df0 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31  .col1 DIV + col1
37e00 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
37e10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 31 0d 0a 38 31  r0..----..81..81
37e20 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..81....skipif m
37e30 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
37e40 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
37e50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 32  owsort label-162
37e60 31 0d 0a 53 45 4c 45 43 54 20 2b 20 38 30 20 2b  1..SELECT + 80 +
37e70 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 2b   + cor0.col1 / +
37e80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
37e90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
37ea0 31 0d 0a 38 31 0d 0a 38 31 0d 0a 0d 0a 71 75 65  1..81..81....que
37eb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37ec0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 31 2e  LECT ALL + cor1.
37ed0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
37ee0 4d 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f 53  M tab2 cor0 CROS
37ef0 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62  S JOIN tab2, tab
37f00 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
37f10 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
37f20 6e 67 20 74 6f 20 37 37 38 36 37 31 38 62 64 38  ng to 7786718bd8
37f30 30 34 32 30 32 32 35 33 37 33 37 38 64 34 30 65  042022537378d40e
37f40 63 38 37 34 37 35 0d 0a 0d 0a 71 75 65 72 79 20  c87475....query 
37f50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37f60 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 2d 20 63  T ALL col2 - - c
37f70 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
37f80 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d   tab2..----..52.
37f90 0a 35 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79  .54..76....query
37fa0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37fb0 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 34 37  CT + col2 * + 47
37fc0 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   * - col1 + - co
37fd0 6c 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l1 - cor0.col1 A
37fe0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
37ff0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
38000 2d 31 33 33 35 35 38 0d 0a 2d 33 35 30 38 39 36  -133558..-350896
38010 0d 0a 2d 34 37 35 33 0d 0a 0d 0a 6f 6e 6c 79 69  ..-4753....onlyi
38020 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
38030 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
38040 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
38050 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38060 20 6c 61 62 65 6c 2d 31 36 32 35 0d 0a 53 45 4c   label-1625..SEL
38070 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
38080 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  * + col1 + col0 
38090 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  DIV col2 FROM ta
380a0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
380b0 32 30 36 34 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30  2064..-3360..-80
380c0 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  98....skipif mys
380d0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
380e0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
380f0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 32 35 0d  sort label-1625.
38100 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
38110 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol0 * + col1 + c
38120 6f 6c 30 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 / col2 FROM 
38130 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
38140 0a 2d 32 30 36 34 0d 0a 2d 33 33 36 30 0d 0a 2d  .-2064..-3360..-
38150 38 30 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  8098....onlyif m
38160 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
38170 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
38180 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
38190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
381a0 62 65 6c 2d 31 36 32 36 0d 0a 53 45 4c 45 43 54  bel-1626..SELECT
381b0 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 44 49   ALL + - col1 DI
381c0 56 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63  V ( col0 ) + - c
381d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
381e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
381f0 0a 2d 33 36 0d 0a 2d 38 33 0d 0a 0d 0a 73 6b 69  .-36..-83....ski
38200 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
38210 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
38220 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
38230 6c 2d 31 36 32 36 0d 0a 53 45 4c 45 43 54 20 41  l-1626..SELECT A
38240 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 28 20  LL + - col1 / ( 
38250 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 32 20  col0 ) + - col2 
38260 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
38270 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33 36  0..----..-3..-36
38280 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-83....query I
38290 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
382a0 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 28 20   ALL + col2 * ( 
382b0 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  + col0 ) FROM ta
382c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
382d0 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30  ..189..2028..300
382e0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
382f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
38300 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29   col0 * ( col1 )
38310 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
38320 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
38330 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d  or0..----..1381.
38340 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75  .244..4628....qu
38350 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38360 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 33 35 20  ELECT col0 + 35 
38370 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
38380 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
38390 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 33 35 0d 0a  ..----..35..35..
383a0 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
383b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
383c0 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32  STINCT cor0.col2
383d0 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * + col2 FROM t
383e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
383f0 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a 36 37 32 34  -..1..1089..6724
38400 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38410 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
38420 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20  - col0 * col2 + 
38430 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
38440 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
38450 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37 35 39 0d 0a  4..-7216..-759..
38460 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38470 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
38480 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a  CT - cor0.col2 *
38490 20 31 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53   17 FROM tab1 AS
384a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
384b0 33 32 0d 0a 2d 39 31 38 0d 0a 2d 39 36 39 0d 0a  32..-918..-969..
384c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
384d0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
384e0 20 34 36 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   46 + col1 FROM 
384f0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
38500 2d 2d 0d 0a 31 30 31 0d 0a 31 30 34 0d 0a 31 33  --..101..104..13
38510 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
38520 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
38530 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
38540 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
38550 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38560 2d 31 36 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1634..SELECT AL
38570 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  L - cor0.col2 DI
38580 56 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  V + ( - cor0.col
38590 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  1 ) FROM tab1 AS
385a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   cor0..----..2..
385b0 35 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5..7....skipif m
385c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
385d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
385e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33  owsort label-163
385f0 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  4..SELECT ALL - 
38600 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b 20 28 20  cor0.col2 / + ( 
38610 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52  - cor0.col1 ) FR
38620 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
38630 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a  .----..2..5..7..
38640 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38650 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
38660 20 2d 20 38 36 20 2a 20 63 6f 6c 30 20 41 53 20   - 86 * col0 AS 
38670 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
38680 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
38690 35 32 32 35 36 0d 0a 2d 35 35 30 34 30 30 0d 0a  52256..-550400..
386a0 2d 37 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -774....query I 
386b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
386c0 2b 20 2d 20 37 32 20 2b 20 2d 20 63 6f 6c 31 20  + - 72 + - col1 
386d0 2a 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  * + col2 * + cor
386e0 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
386f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
38700 2d 33 34 36 37 0d 0a 2d 36 36 34 31 39 30 0d 0a  -3467..-664190..
38710 2d 36 38 31 38 34 0d 0a 0d 0a 71 75 65 72 79 20  -68184....query 
38720 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38730 54 20 2d 20 63 6f 6c 31 20 2b 20 32 37 20 2a 20  T - col1 + 27 * 
38740 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
38750 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33  S cor0..----..23
38760 31 32 0d 0a 35 36 32 0d 0a 38 34 38 0d 0a 0d 0a  12..562..848....
38770 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
38780 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
38790 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 2d 20  l2 * - col1 - - 
387a0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
387b0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
387c0 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32 0d  ----..132..2862.
387d0 0a 37 35 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .7551....query I
387e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
387f0 20 44 49 53 54 49 4e 43 54 20 35 39 20 41 53 20   DISTINCT 59 AS 
38800 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
38810 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39  S cor0..----..59
38820 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
38830 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
38840 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
38850 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
38860 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
38870 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 34  owsort label-164
38880 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
38890 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT - CAST( NULL 
388a0 41 53 20 53 49 47 4e 45 44 20 29 20 2f 20 2b 20  AS SIGNED ) / + 
388b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
388c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
388d0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
388e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
388f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
38900 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 34 30 0d  sort label-1640.
38910 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
38920 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
38930 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2b 20  S INTEGER ) / + 
38940 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
38950 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
38960 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
38970 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
38980 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
38990 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
389a0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
389b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
389c0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
389d0 31 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20  1 + - col0 col2 
389e0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
389f0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a 2d  0..----..-137..-
38a00 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79  38..-96....query
38a10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38a20 43 54 20 2b 20 28 20 35 34 20 29 20 2b 20 63 6f  CT + ( 54 ) + co
38a30 6c 32 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 - col0 AS col
38a40 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
38a50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a  or0..----..105..
38a60 34 37 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79 20  47..70....query 
38a70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38a80 54 20 41 4c 4c 20 2d 20 28 20 2b 20 37 31 20 29  T ALL - ( + 71 )
38a90 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
38aa0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 0d 0a 2d  r0..----..-71..-
38ab0 37 31 0d 0a 2d 37 31 0d 0a 0d 0a 71 75 65 72 79  71..-71....query
38ac0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38ad0 43 54 20 2b 20 2b 20 28 20 63 6f 6c 31 20 29 20  CT + + ( col1 ) 
38ae0 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f  + col2 * cor0.co
38af0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
38b00 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
38b10 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37  --..194..2924..7
38b20 35 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  553....query I r
38b30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
38b40 4c 4c 20 2d 20 37 36 20 41 53 20 63 6f 6c 31 20  LL - 76 AS col1 
38b50 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38b60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 36 0d 0a 2d 37  0..----..-76..-7
38b70 36 0d 0a 2d 37 36 0d 0a 0d 0a 71 75 65 72 79 20  6..-76....query 
38b80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38b90 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T - col0 * + col
38ba0 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 + - cor0.col1 
38bb0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38bc0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 37 0d 0a  0..----..-2087..
38bd0 2d 32 32 30 0d 0a 2d 33 30 31 39 0d 0a 0d 0a 71  -220..-3019....q
38be0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38bf0 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e  SELECT - - cor0.
38c00 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b 20  col0 * col2 + + 
38c10 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
38c20 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
38c30 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35  -..36..7380..825
38c40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38c50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
38c60 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  - + col0 * + col
38c70 31 20 46 52 4f 4d 20 74 61 62 32 20 41