sqllogictest
Hex Artifact Content
Not logged in

Artifact 3bccb5e90b6e1068ed149ecec26508c83716ad33:


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 2b 20 35 38 20  rt..SELECT + 58 
02e0: 2d 20 2b 20 31 30 20 41 53 20 63 6f 6c 31 20 46  - + 10 AS col1 F
02f0: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63  ROM tab1, tab1 c
0300: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
0310: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
0320: 62 30 39 63 63 32 63 39 39 63 32 31 30 32 30 33  b09cc2c99c210203
0330: 36 31 36 32 64 30 36 33 65 30 65 35 61 34 62 0d  6162d063e0e5a4b.
0340: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0350: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
0360: 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
0370: 62 32 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41  b2, tab0, tab1 A
0380: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
0390: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
03a0: 74 6f 20 37 66 34 61 39 62 66 32 34 64 36 34 38  to 7f4a9bf24d648
03b0: 33 33 37 30 36 64 66 62 64 64 30 62 61 66 34 39  33706dfbdd0baf49
03c0: 64 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  d79....query I r
03d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
03e0: 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 37 30 20   tab0.col2 + 70 
03f0: 2a 20 39 37 20 46 52 4f 4d 20 74 61 62 30 0d 0a  * 97 FROM tab0..
0400: 2d 2d 2d 2d 0d 0a 36 37 39 31 0d 0a 36 38 32 33  ----..6791..6823
0410: 0d 0a 36 38 37 32 0d 0a 0d 0a 71 75 65 72 79 20  ..6872....query 
0420: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0430: 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20  T col0 * col1 * 
0440: 2b 20 33 36 20 2d 20 74 61 62 32 2e 63 6f 6c 32  + 36 - tab2.col2
0450: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
0460: 0d 0a 31 36 35 36 34 36 0d 0a 34 38 33 31 30 0d  ..165646..48310.
0470: 0a 37 37 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .7785....query I
0480: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0490: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   - col0 * - col2
04a0: 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 46   + - tab0.col0 F
04b0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
04c0: 30 0d 0a 37 32 30 39 0d 0a 37 36 38 0d 0a 0d 0a  0..7209..768....
04d0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
04e0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
04f0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
0500: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
0510: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
0520: 72 74 20 6c 61 62 65 6c 2d 35 0d 0a 53 45 4c 45  rt label-5..SELE
0530: 43 54 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c  CT - CAST( + col
0540: 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  1 AS SIGNED ) * 
0550: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
0560: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
0570: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31  ..----..-100..-1
0580: 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 73 6b 69 70  69..-676....skip
0590: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
05a0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
05b0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
05c0: 2d 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  -5..SELECT - CAS
05d0: 54 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e  T ( + col1 AS IN
05e0: 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 31  TEGER ) * + col1
05f0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0600: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
0610: 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36  ..-100..-169..-6
0620: 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  76....onlyif mys
0630: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
0640: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
0650: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
0660: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
0670: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
0680: 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 2b  ..SELECT CAST( +
0690: 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
06a0: 29 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ) - - col2 AS co
06b0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
06c0: 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d  --..171..36..57.
06d0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
06e0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
06f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0700: 74 20 6c 61 62 65 6c 2d 36 0d 0a 53 45 4c 45 43  t label-6..SELEC
0710: 54 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20  T CAST ( + col0 
0720: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2d  AS INTEGER ) - -
0730: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
0740: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
0750: 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71 75  71..36..57....qu
0760: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0770: 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31 20  ELECT tab1.col1 
0780: 2a 20 63 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f  * col1 + tab1.co
0790: 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 2b  l2 * tab1.col1 +
07a0: 20 2b 20 31 36 20 46 52 4f 4d 20 74 61 62 31 0d   + 16 FROM tab1.
07b0: 0a 2d 2d 2d 2d 0d 0a 31 34 33 33 0d 0a 32 30 39  .----..1433..209
07c0: 36 0d 0a 36 38 36 0d 0a 0d 0a 71 75 65 72 79 20  6..686....query 
07d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
07e0: 54 20 44 49 53 54 49 4e 43 54 20 28 20 34 37 20  T DISTINCT ( 47 
07f0: 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  ) + col1 AS col2
0800: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0810: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 31  r0..----..133..1
0820: 33 38 0d 0a 31 34 34 0d 0a 0d 0a 71 75 65 72 79  38..144....query
0830: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0840: 43 54 20 2b 20 31 35 20 2a 20 31 35 20 46 52 4f  CT + 15 * 15 FRO
0850: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
0860: 2d 2d 2d 2d 0d 0a 32 32 35 0d 0a 32 32 35 0d 0a  ----..225..225..
0870: 32 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  225....query I r
0880: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
0890: 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   + col1 * - col2
08a0: 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
08b0: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
08c0: 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 38 38 34 0d 0a  ..----..611884..
08d0: 39 33 36 35 34 0d 0a 39 37 0d 0a 0d 0a 71 75 65  93654..97....que
08e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
08f0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
0900: 63 6f 6c 30 20 2b 20 2b 20 35 32 20 46 52 4f 4d  col0 + + 52 FROM
0910: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
0920: 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 32 38 0d 0a 34  ---..-12..-28..4
0930: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
0940: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
0950: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a   + col2 * col1 *
0960: 20 2b 20 63 6f 6c 31 20 2b 20 33 35 20 2a 20 2d   + col1 + 35 * -
0970: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
0980: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
0990: 0a 2d 2d 2d 2d 0d 0a 32 34 32 39 31 33 0d 0a 36  .----..242913..6
09a0: 37 36 31 37 32 0d 0a 39 33 37 34 0d 0a 0d 0a 71  76172..9374....q
09b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
09c0: 53 45 4c 45 43 54 20 2d 20 2d 20 31 34 20 2a 20  SELECT - - 14 * 
09d0: 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
09e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
09f0: 31 32 30 34 0d 0a 31 32 37 34 0d 0a 31 33 35 38  1204..1274..1358
0a00: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
0a10: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
0a20: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
0a30: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
0a40: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
0a50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 0d  owsort label-14.
0a60: 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20  .SELECT - CAST( 
0a70: 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
0a80: 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ) + + col1 * col
0a90: 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 * col0 FROM ta
0aa0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
0ab0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
0ac0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
0ad0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
0ae0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
0af0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 0d 0a 53  sort label-14..S
0b00: 45 4c 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e  ELECT - CAST ( N
0b10: 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20  ULL AS REAL ) + 
0b20: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20  + col1 * col2 * 
0b30: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
0b40: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
0b50: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
0b60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0b70: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
0b80: 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 35 38  CT + col0 + - 58
0b90: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
0ba0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d  r0..----..-23..-
0bb0: 33 34 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79 20  34..31....query 
0bc0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0bd0: 54 20 41 4c 4c 20 2b 20 2d 20 28 20 2b 20 34 31  T ALL + - ( + 41
0be0: 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
0bf0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d  cor0..----..-41.
0c00: 0a 2d 34 31 0d 0a 2d 34 31 0d 0a 0d 0a 6f 6e 6c  .-41..-41....onl
0c10: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
0c20: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
0c30: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
0c40: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
0c50: 72 74 20 6c 61 62 65 6c 2d 31 37 0d 0a 53 45 4c  rt label-17..SEL
0c60: 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20  ECT - tab1.col2 
0c70: 44 49 56 20 2d 20 39 39 20 46 52 4f 4d 20 74 61  DIV - 99 FROM ta
0c80: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b1..----..0..0..
0c90: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
0ca0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
0cb0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
0cc0: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 0d 0a 53 45  ort label-17..SE
0cd0: 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 32  LECT - tab1.col2
0ce0: 20 2f 20 2d 20 39 39 20 46 52 4f 4d 20 74 61 62   / - 99 FROM tab
0cf0: 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  1..----..0..0..0
0d00: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0d10: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
0d20: 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 36 36 20 2d  r0.col1 * + 66 -
0d30: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
0d40: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
0d50: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 35 0d 0a  0..----..-1105..
0d60: 2d 32 30 31 35 0d 0a 2d 33 38 33 35 0d 0a 0d 0a  -2015..-3835....
0d70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0d80: 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30  .SELECT - + col0
0d90: 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d   + ( col1 ) FROM
0da0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
0db0: 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32  ---..-19..-62..2
0dc0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
0dd0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
0de0: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 36 36 20  ol1 * col1 * 66 
0df0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
0e00: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 39 30 37 34 0d 0a  2..----..19074..
0e10: 32 32 39 37 34 36 0d 0a 36 33 34 32 36 0d 0a 0d  229746..63426...
0e20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0e30: 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
0e40: 6c 32 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 - col1 FROM t
0e50: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
0e60: 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71  -33..-4..21....q
0e70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0e80: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
0e90: 33 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  30 * col2 AS col
0ea0: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
0eb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 36  or0..----..-1646
0ec0: 0d 0a 2d 31 37 32 30 0d 0a 2d 32 38 39 33 0d 0a  ..-1720..-2893..
0ed0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
0ee0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
0ef0: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
0f00: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
0f10: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
0f20: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 0d 0a 53  sort label-23..S
0f30: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
0f40: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 28  ol0 * - col1 + (
0f50: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54   + col2 * + CAST
0f60: 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41  ( NULL AS DECIMA
0f70: 4c 20 29 20 29 20 2b 20 2b 20 63 6f 6c 30 20 41  L ) ) + + col0 A
0f80: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
0f90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0fa0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
0fb0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
0fc0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
0fd0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 0d  owsort label-23.
0fe0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
0ff0: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 2b   col0 * - col1 +
1000: 20 28 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41   ( + col2 * + CA
1010: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
1020: 4c 20 29 20 29 20 2b 20 2b 20 63 6f 6c 30 20 41  L ) ) + + col0 A
1030: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1040: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1050: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
1060: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1070: 36 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  62 FROM tab1, ta
1080: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1090: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
10a0: 6e 67 20 74 6f 20 35 31 64 64 32 37 37 31 64 35  ng to 51dd2771d5
10b0: 31 36 63 65 62 39 33 35 34 38 33 65 64 65 64 37  16ceb935483eded7
10c0: 38 61 35 66 61 30 0d 0a 0d 0a 71 75 65 72 79 20  8a5fa0....query 
10d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10e0: 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 39 31 20  T - col1 + + 91 
10f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1100: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 36 30 0d  0..----..32..60.
1110: 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .74....query I r
1120: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1130: 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 37 38 20 2b  LL - col2 * 78 +
1140: 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63   + ( col1 ) AS c
1150: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1160: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31   cor0..----..-41
1170: 38 36 0d 0a 2d 34 34 33 36 0d 0a 2d 37 34 37 35  86..-4436..-7475
1180: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1190: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
11a0: 2d 20 63 6f 6c 32 20 2b 20 33 30 20 41 53 20 63  - col2 + 30 AS c
11b0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
11c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d   cor0..----..-8.
11d0: 0a 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .3..4....query I
11e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11f0: 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   + col2 * - col2
1200: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
1210: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1220: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 33 0d 0a  0..----..-1003..
1230: 2d 36 36 33 33 0d 0a 39 36 0d 0a 0d 0a 71 75 65  -6633..96....que
1240: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1250: 4c 45 43 54 20 2d 20 2d 20 28 20 63 6f 6c 32 20  LECT - - ( col2 
1260: 29 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20 63  ) + col1 + - ( c
1270: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 29 20 46  ol1 * - col1 ) F
1280: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1290: 2d 2d 2d 0d 0a 37 35 31 35 0d 0a 38 34 35 34 0d  ---..7515..8454.
12a0: 0a 39 35 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .9507....query I
12b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12c0: 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30   + col0 - - col0
12d0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
12e0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12f0: 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d  ..178..48..70...
1300: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1310: 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 72 30 2e  ..SELECT ( cor0.
1320: 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2b 20  col0 ) * col1 + 
1330: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
1340: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1350: 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38 0d  ----..1360..248.
1360: 0a 34 36 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .4661....onlyif 
1370: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1380: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1390: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
13a0: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
13b0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13c0: 6c 2d 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-32..SELECT ALL
13d0: 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
13e0: 20 53 49 47 4e 45 44 20 29 20 63 6f 6c 31 20 46   SIGNED ) col1 F
13f0: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1400: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
1410: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1420: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1430: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1440: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1450: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1460: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1470: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1480: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1490: 20 6c 61 62 65 6c 2d 33 32 0d 0a 53 45 4c 45 43   label-32..SELEC
14a0: 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 4e  T ALL + CAST ( N
14b0: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
14c0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
14d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
14e0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
14f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1500: 0a 53 45 4c 45 43 54 20 35 20 2a 20 63 6f 6c 31  .SELECT 5 * col1
1510: 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
1520: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
1530: 31 32 34 0d 0a 32 33 36 0d 0a 36 38 0d 0a 0d 0a  124..236..68....
1540: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1550: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1560: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1570: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1580: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1590: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15a0: 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
15b0: 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 + cor0.col2 
15c0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
15d0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
15e0: 38 0d 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 6f  8..114..192....o
15f0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1600: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1610: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1620: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1630: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 0d 0a 53  sort label-35..S
1640: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56  ELECT - col2 DIV
1650: 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f   col0 + col2 FRO
1660: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1670: 2d 2d 2d 2d 0d 0a 31 0d 0a 33 32 0d 0a 38 32 0d  ----..1..32..82.
1680: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1690: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
16a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16b0: 74 20 6c 61 62 65 6c 2d 33 35 0d 0a 53 45 4c 45  t label-35..SELE
16c0: 43 54 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 30  CT - col2 / col0
16d0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
16e0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16f0: 0a 31 0d 0a 33 32 0d 0a 38 32 0d 0a 0d 0a 6f 6e  .1..32..82....on
1700: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1710: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1720: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1730: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1740: 6f 72 74 20 6c 61 62 65 6c 2d 33 36 0d 0a 53 45  ort label-36..SE
1750: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1760: 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 63 6f 6c  l1 + + CAST( col
1770: 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49  1 AS SIGNED ) DI
1780: 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  V - col0 AS col0
1790: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
17a0: 0d 0a 38 33 0d 0a 39 30 0d 0a 39 35 0d 0a 0d 0a  ..83..90..95....
17b0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17c0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17e0: 61 62 65 6c 2d 33 36 0d 0a 53 45 4c 45 43 54 20  abel-36..SELECT 
17f0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20  DISTINCT col1 + 
1800: 2b 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53  + CAST ( col1 AS
1810: 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2d 20 63   INTEGER ) / - c
1820: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
1830: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d   tab0..----..83.
1840: 0a 39 30 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79  .90..95....query
1850: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1860: 43 54 20 2d 20 31 30 20 2d 20 74 61 62 32 2e 63  CT - 10 - tab2.c
1870: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol1 FROM tab2, t
1880: 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
1890: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
18a0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
18b0: 6e 67 20 74 6f 20 39 61 62 35 65 36 63 63 62 64  ng to 9ab5e6ccbd
18c0: 63 31 61 31 37 62 33 33 35 39 38 33 65 30 36 63  c1a17b335983e06c
18d0: 66 33 61 36 61 62 0d 0a 0d 0a 71 75 65 72 79 20  f3a6ab....query 
18e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18f0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d  T ALL + col0 + -
1900: 20 28 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 74   ( tab2.col2 * t
1910: 61 62 32 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f  ab2.col2 ) AS co
1920: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
1930: 2d 2d 0d 0a 2d 31 33 36 35 0d 0a 2d 35 39 38 0d  --..-1365..-598.
1940: 0a 2d 37 32 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-722....skipif 
1950: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1960: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1970: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1980: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1990: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19a0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
19b0: 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  CT - col2 + col2
19c0: 20 2a 20 2d 20 31 30 20 63 6f 6c 31 20 46 52 4f   * - 10 col1 FRO
19d0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
19e0: 2d 2d 2d 2d 0d 0a 2d 31 30 35 36 0d 0a 2d 35 39  ----..-1056..-59
19f0: 34 0d 0a 2d 36 32 37 0d 0a 0d 0a 71 75 65 72 79  4..-627....query
1a00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a10: 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c  CT ALL - ( - col
1a20: 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
1a30: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1a40: 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71  ..3..64..80....q
1a50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a60: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1a70: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20  - cor0.col2 - - 
1a80: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 32 38  cor0.col0 * + 28
1a90: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
1aa0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1ab0: 0a 35 32 36 35 0d 0a 35 36 37 35 38 0d 0a 38 34  .5265..56758..84
1ac0: 30 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  018....skipif po
1ad0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1ae0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1af0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1b00: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1b10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b20: 0a 53 45 4c 45 43 54 20 33 30 20 63 6f 6c 30 20  .SELECT 30 col0 
1b30: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1b40: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 33 30 0d  0..----..30..30.
1b50: 0a 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .30....query I r
1b60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1b70: 4c 4c 20 2b 20 31 34 20 2a 20 2b 20 63 6f 6c 30  LL + 14 * + col0
1b80: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
1b90: 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 34 32 0d  .----..1120..42.
1ba0: 0a 38 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .896....query I 
1bb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1bc0: 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72  ALL col0 * + cor
1bd0: 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  0.col0 + + col2 
1be0: 2a 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  * ( col2 ) AS co
1bf0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1c00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 36  cor0..----..1226
1c10: 0d 0a 31 34 36 34 35 0d 0a 31 36 36 35 0d 0a 0d  ..14645..1665...
1c20: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1c30: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1c40: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1c50: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1c60: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1c70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c80: 54 20 41 4c 4c 20 2d 20 36 37 20 2a 20 2b 20 63  T ALL - 67 * + c
1c90: 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
1ca0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 34 32 0d  b1..----..-1742.
1cb0: 0a 2d 36 37 30 0d 0a 2d 38 37 31 0d 0a 0d 0a 71  .-670..-871....q
1cc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1cd0: 53 45 4c 45 43 54 20 2b 20 35 31 20 41 53 20 63  SELECT + 51 AS c
1ce0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
1cf0: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1d00: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1d10: 20 74 6f 20 64 38 62 66 30 61 30 35 63 39 63 34   to d8bf0a05c9c4
1d20: 64 32 61 39 33 38 31 32 64 31 30 36 62 61 61 65  d2a93812d106baae
1d30: 34 37 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  4752....skipif p
1d40: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1d50: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1d60: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1d70: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1d80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d90: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
1da0: 28 20 63 6f 6c 31 20 29 20 2a 20 28 20 2b 20 63  ( col1 ) * ( + c
1db0: 6f 6c 30 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 ) col2 FROM 
1dc0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36  tab1..----..1136
1dd0: 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a 71 75  ..132..697....qu
1de0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1df0: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b  ELECT - col1 + +
1e00: 20 35 39 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   59 FROM tab0..-
1e10: 2d 2d 2d 0d 0a 2d 32 37 0d 0a 2d 33 32 0d 0a 2d  ---..-27..-32..-
1e20: 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  38....skipif pos
1e30: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1e40: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1e50: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1e60: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1e70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e80: 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 72  SELECT - ( + cor
1e90: 30 2e 63 6f 6c 30 20 29 20 2a 20 63 6f 72 30 2e  0.col0 ) * cor0.
1ea0: 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
1eb0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ec0: 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a  -..-189..-2028..
1ed0: 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -3002....query I
1ee0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ef0: 20 44 49 53 54 49 4e 43 54 20 2b 20 39 20 2b 20   DISTINCT + 9 + 
1f00: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
1f10: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1f20: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 36 33 0d  ..----..105..63.
1f30: 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .66....query I r
1f40: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1f50: 6f 6c 30 20 2b 20 28 20 32 39 20 29 20 41 53 20  ol0 + ( 29 ) AS 
1f60: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1f70: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
1f80: 38 0d 0a 35 33 0d 0a 36 34 0d 0a 0d 0a 71 75 65  8..53..64....que
1f90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1fa0: 4c 45 43 54 20 41 4c 4c 20 2d 20 34 33 20 2a 20  LECT ALL - 43 * 
1fb0: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
1fc0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 0d 0a 2d 32  ..----..-129..-2
1fd0: 37 35 32 0d 0a 2d 33 34 34 30 0d 0a 0d 0a 6f 6e  752..-3440....on
1fe0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1ff0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2000: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2010: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2020: 6f 72 74 20 6c 61 62 65 6c 2d 35 33 0d 0a 53 45  ort label-53..SE
2030: 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f  LECT ALL tab2.co
2040: 6c 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53  l2 DIV + col1 AS
2050: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
2060: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a  .----..0..0..2..
2070: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2080: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2090: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20a0: 20 6c 61 62 65 6c 2d 35 33 0d 0a 53 45 4c 45 43   label-53..SELEC
20b0: 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 32 20  T ALL tab2.col2 
20c0: 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  / + col1 AS col0
20d0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
20e0: 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71 75 65  ..0..0..2....que
20f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2100: 4c 45 43 54 20 2d 20 31 37 20 41 53 20 63 6f 6c  LECT - 17 AS col
2110: 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
2120: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2130: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2140: 67 20 74 6f 20 34 39 30 64 30 30 38 66 33 66 62  g to 490d008f3fb
2150: 35 62 37 30 64 33 39 37 31 63 66 63 36 64 38 34  5b70d3971cfc6d84
2160: 35 30 33 66 34 0d 0a 0d 0a 71 75 65 72 79 20 49  503f4....query I
2170: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2180: 20 44 49 53 54 49 4e 43 54 20 2d 20 35 35 20 46   DISTINCT - 55 F
2190: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
21a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
21b0: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
21c0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
21d0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
21e0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
21f0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2200: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2210: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 28  ELECT col1 * + (
2220: 20 28 20 2b 20 63 6f 6c 31 20 29 20 29 20 63 6f   ( + col1 ) ) co
2230: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2240: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36  cor0..----..7396
2250: 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a  ..8281..9409....
2260: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2270: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2280: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   - cor0.col1 AS 
2290: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
22a0: 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
22b0: 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
22c0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  cor1..----..-17.
22d0: 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75 65  .-31..-59....que
22e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22f0: 4c 45 43 54 20 35 36 20 46 52 4f 4d 20 74 61 62  LECT 56 FROM tab
2300: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  2, tab1 AS cor0 
2310: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c  CROSS JOIN tab1,
2320: 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
2330: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76  or1..----..243 v
2340: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2350: 20 66 37 38 61 62 37 66 34 61 62 37 37 36 31 66   f78ab7f4ab7761f
2360: 39 30 64 34 30 62 65 37 30 35 30 38 30 38 61 65  90d40be7050808ae
2370: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
2380: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2390: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
23a0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
23b0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
23c0: 2d 35 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -59..SELECT DIST
23d0: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  INCT - col2 + + 
23e0: 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 41 53  col1 DIV col2 AS
23f0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2400: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2410: 33 31 0d 0a 2d 38 31 0d 0a 39 36 0d 0a 0d 0a 73  31..-81..96....s
2420: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2430: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2440: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2450: 62 65 6c 2d 35 39 0d 0a 53 45 4c 45 43 54 20 44  bel-59..SELECT D
2460: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
2470: 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41   + col1 / col2 A
2480: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2490: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24a0: 2d 33 31 0d 0a 2d 38 31 0d 0a 39 36 0d 0a 0d 0a  -31..-81..96....
24b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24c0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
24d0: 63 6f 6c 32 20 2a 20 33 30 20 2b 20 63 6f 6c 30  col2 * 30 + col0
24e0: 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
24f0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2500: 2d 0d 0a 2d 31 36 32 39 0d 0a 2d 35 38 30 36 0d  -..-1629..-5806.
2510: 0a 2d 39 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20  .-9280....query 
2520: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2530: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39 32 20  T DISTINCT + 92 
2540: 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  * - col2 + col1 
2550: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2560: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 34 32 0d 0a  0..----..-4942..
2570: 2d 35 32 33 34 0d 0a 2d 38 38 31 39 0d 0a 0d 0a  -5234..-8819....
2580: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2590: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
25a0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
25b0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
25c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 32 0d 0a  wsort label-62..
25d0: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
25e0: 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 41 53  col2 DIV col0 AS
25f0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2600: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
2610: 37 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69  7..91..97....ski
2620: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2630: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2640: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2650: 6c 2d 36 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63  l-62..SELECT + c
2660: 6f 6c 31 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c  ol1 + col2 / col
2670: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2680: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2690: 2d 0d 0a 38 37 0d 0a 39 31 0d 0a 39 37 0d 0a 0d  -..87..91..97...
26a0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
26b0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
26c0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
26d0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
26e0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 0d  owsort label-63.
26f0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
2700: 20 2a 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   * col2 DIV - co
2710: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2720: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  tab2..----..-26.
2730: 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69  .-27..-38....ski
2740: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2750: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2760: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2770: 6c 2d 36 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-63..SELECT ALL
2780: 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f 20 2d   col1 * col2 / -
2790: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
27a0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
27b0: 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a  26..-27..-38....
27c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27d0: 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 29  .SELECT ( col1 )
27e0: 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   * + col2 + - co
27f0: 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46  l2 * cor0.col2 F
2800: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2810: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 38 0d 0a 31 30  ..----..-798..10
2820: 38 0d 0a 38 35 38 0d 0a 0d 0a 71 75 65 72 79 20  8..858....query 
2830: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2840: 54 20 2b 20 34 34 20 2b 20 2d 20 63 6f 6c 32 20  T + 44 + - col2 
2850: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2860: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31  0..----..-10..-1
2870: 33 0d 0a 2d 35 32 0d 0a 0d 0a 73 6b 69 70 69 66  3..-52....skipif
2880: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2890: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
28a0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
28b0: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
28c0: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
28d0: 72 74 0d 0a 53 45 4c 45 43 54 20 31 20 2a 20 63  rt..SELECT 1 * c
28e0: 6f 6c 30 20 2b 20 2d 20 33 30 20 2a 20 2d 20 37  ol0 + - 30 * - 7
28f0: 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  2 col0 FROM tab1
2900: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2910: 32 31 36 33 0d 0a 32 32 32 34 0d 0a 32 32 34 30  2163..2224..2240
2920: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2930: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2940: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2950: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2960: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2970: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2980: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 32  LECT DISTINCT 72
2990: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
29a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 32 0d 0a  cor0..----..72..
29b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29c0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
29d0: 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  CT col1 + - col0
29e0: 20 2a 20 31 39 20 41 53 20 63 6f 6c 31 20 46 52   * 19 AS col1 FR
29f0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2a00: 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30 36 0d 0a 2d 31  .----..-1206..-1
2a10: 35 30 37 0d 0a 2d 33 31 0d 0a 0d 0a 71 75 65 72  507..-31....quer
2a20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a30: 45 43 54 20 2d 20 37 35 20 2b 20 63 6f 72 30 2e  ECT - 75 + cor0.
2a40: 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col1 * cor0.col0
2a50: 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
2a60: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2a70: 2d 0d 0a 2d 31 33 35 39 35 0d 0a 2d 32 31 30 33  -..-13595..-2103
2a80: 0d 0a 2d 36 34 37 35 0d 0a 0d 0a 6f 6e 6c 79 69  ..-6475....onlyi
2a90: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
2aa0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
2ab0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
2ac0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
2ad0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2ae0: 62 65 6c 2d 37 30 0d 0a 53 45 4c 45 43 54 20 44  bel-70..SELECT D
2af0: 49 53 54 49 4e 43 54 20 36 38 20 2b 20 2d 20 63  ISTINCT 68 + - c
2b00: 6f 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol1 * CAST( NULL
2b10: 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
2b20: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
2b30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2b40: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2b50: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2b60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b70: 74 20 6c 61 62 65 6c 2d 37 30 0d 0a 53 45 4c 45  t label-70..SELE
2b80: 43 54 20 44 49 53 54 49 4e 43 54 20 36 38 20 2b  CT DISTINCT 68 +
2b90: 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28   - col1 * CAST (
2ba0: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2bb0: 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2bc0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2bd0: 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
2be0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bf0: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
2c00: 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - - col2 AS col
2c10: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2c20: 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d  -..-53..-9..-96.
2c30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c40: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2c50: 20 38 37 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20   87 + tab0.col0 
2c60: 2a 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d  * tab0.col2 FROM
2c70: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
2c80: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2c90: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
2ca0: 66 66 36 32 65 31 39 32 65 38 65 65 63 30 66 39  ff62e192e8eec0f9
2cb0: 61 65 31 30 38 35 38 65 35 33 61 65 66 37 38 0d  ae10858e53aef78.
2cc0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2cd0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2ce0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2cf0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2d00: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2d10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d20: 45 43 54 20 36 38 20 2a 20 34 20 63 6f 6c 32 20  ECT 68 * 4 col2 
2d30: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2d40: 0a 32 37 32 0d 0a 32 37 32 0d 0a 32 37 32 0d 0a  .272..272..272..
2d50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d60: 74 0d 0a 53 45 4c 45 43 54 20 32 34 20 2a 20 2d  t..SELECT 24 * -
2d70: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
2d80: 0a 2d 2d 2d 2d 0d 0a 2d 36 32 34 0d 0a 2d 36 34  .----..-624..-64
2d90: 38 0d 0a 2d 39 31 32 0d 0a 0d 0a 71 75 65 72 79  8..-912....query
2da0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2db0: 43 54 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20  CT ( - col2 ) * 
2dc0: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
2dd0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2de0: 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32  -1444..-676..-72
2df0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2e00: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 28  sort..SELECT ( (
2e10: 20 2b 20 63 6f 6c 31 20 29 20 29 20 2a 20 63 6f   + col1 ) ) * co
2e20: 6c 31 20 2d 20 2d 20 34 36 20 41 53 20 63 6f 6c  l1 - - 46 AS col
2e30: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2e40: 2d 0d 0a 31 34 36 0d 0a 32 31 35 0d 0a 37 32 32  -..146..215..722
2e50: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2e60: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2e70: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2e80: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2e90: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2ea0: 37 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  77..SELECT DISTI
2eb0: 4e 43 54 20 74 61 62 32 2e 63 6f 6c 31 20 44 49  NCT tab2.col1 DI
2ec0: 56 20 32 35 20 2d 20 63 6f 6c 30 20 41 53 20 63  V 25 - col0 AS c
2ed0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
2ee0: 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 37 36 0d 0a 2d 37  ---..-6..-76..-7
2ef0: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
2f00: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2f10: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2f20: 6f 72 74 20 6c 61 62 65 6c 2d 37 37 0d 0a 53 45  ort label-77..SE
2f30: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
2f40: 62 32 2e 63 6f 6c 31 20 2f 20 32 35 20 2d 20 63  b2.col1 / 25 - c
2f50: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2f60: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d   tab2..----..-6.
2f70: 0a 2d 37 36 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65  .-76..-79....que
2f80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2f90: 4c 45 43 54 20 2d 20 37 31 20 2d 20 2b 20 63 6f  LECT - 71 - + co
2fa0: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
2fb0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  tab0..----..-104
2fc0: 0d 0a 2d 31 35 33 0d 0a 2d 37 32 0d 0a 0d 0a 71  ..-153..-72....q
2fd0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2fe0: 53 45 4c 45 43 54 20 33 33 20 41 53 20 63 6f 6c  SELECT 33 AS col
2ff0: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
3000: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
3010: 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
3020: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
3030: 20 74 6f 20 36 32 30 64 33 38 34 32 38 36 65 38   to 620d384286e8
3040: 32 64 31 63 36 63 38 62 31 62 32 62 31 30 39 61  2d1c6c8b1b2b109a
3050: 37 64 61 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7da5....query I 
3060: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3070: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 39 32 20  DISTINCT - - 92 
3080: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
3090: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30a0: 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .92....query I r
30b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30c0: 4c 4c 20 34 33 20 2a 20 2d 20 63 6f 72 30 2e 63  LL 43 * - cor0.c
30d0: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
30e0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
30f0: 2d 2d 2d 0d 0a 2d 31 31 31 38 0d 0a 2d 31 31 36  ---..-1118..-116
3100: 31 0d 0a 2d 31 36 33 34 0d 0a 0d 0a 71 75 65 72  1..-1634....quer
3110: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3120: 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT - col2 * col
3130: 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  2 * + col1 + col
3140: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
3150: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
3160: 2d 0d 0a 2d 32 32 35 36 38 0d 0a 2d 32 34 35 33  -..-22568..-2453
3170: 31 0d 0a 2d 33 39 38 32 35 0d 0a 0d 0a 71 75 65  1..-39825....que
3180: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3190: 4c 45 43 54 20 2d 20 36 38 20 2b 20 63 6f 72 30  LECT - 68 + cor0
31a0: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
31b0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
31c0: 2d 2d 0d 0a 2d 34 32 0d 0a 2d 35 35 0d 0a 2d 35  --..-42..-55..-5
31d0: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
31e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31f0: 54 49 4e 43 54 20 2d 20 36 38 20 2a 20 2d 20 63  TINCT - 68 * - c
3200: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
3210: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
3220: 2d 2d 2d 0d 0a 31 37 36 38 0d 0a 31 38 33 36 0d  ---..1768..1836.
3230: 0a 32 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .2584....query I
3240: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3250: 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63   col1 + - cor0.c
3260: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol1 * col1 + col
3270: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
3280: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 33 0d  or0..----..-193.
3290: 0a 2d 33 33 34 34 0d 0a 2d 39 32 33 0d 0a 0d 0a  .-3344..-923....
32a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32b0: 0a 53 45 4c 45 43 54 20 33 20 2d 20 2b 20 63 6f  .SELECT 3 - + co
32c0: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
32d0: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
32e0: 2d 2d 0d 0a 2d 34 0d 0a 2d 37 35 0d 0a 2d 37 36  --..-4..-75..-76
32f0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
3300: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
3310: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
3320: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
3330: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3340: 38 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  87..SELECT ALL +
3350: 20 2b 20 39 34 20 44 49 56 20 63 6f 6c 32 20 41   + 94 DIV col2 A
3360: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
3370: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3380: 31 0d 0a 32 0d 0a 39 34 0d 0a 0d 0a 73 6b 69 70  1..2..94....skip
3390: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
33a0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
33b0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33c0: 2d 38 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  -87..SELECT ALL 
33d0: 2b 20 2b 20 39 34 20 2f 20 63 6f 6c 32 20 41 53  + + 94 / col2 AS
33e0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
33f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
3400: 0d 0a 32 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79  ..2..94....query
3410: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3420: 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b  CT cor0.col2 * +
3430: 20 28 20 31 20 29 20 41 53 20 63 6f 6c 31 20 46   ( 1 ) AS col1 F
3440: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
3450: 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
3460: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
3470: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
3480: 20 34 30 66 64 38 63 63 30 64 65 39 32 65 61 36   40fd8cc0de92ea6
3490: 38 64 37 33 36 33 34 63 32 64 38 66 37 35 62 66  8d73634c2d8f75bf
34a0: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
34b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
34c0: 54 49 4e 43 54 20 32 30 20 2a 20 39 20 46 52 4f  TINCT 20 * 9 FRO
34d0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34e0: 2d 2d 2d 2d 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65  ----..180....que
34f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3500: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
3510: 6c 31 20 2b 20 39 39 20 41 53 20 63 6f 6c 32 20  l1 + 99 AS col2 
3520: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
3530: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a 31 33  0..----..116..13
3540: 30 0d 0a 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20  0..158....query 
3550: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3560: 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  T + col0 * col2 
3570: 2b 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c  + - col1 - - col
3580: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
3590: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 0d 0a  or0..----..-27..
35a0: 37 32 39 36 0d 0a 37 33 30 0d 0a 0d 0a 71 75 65  7296..730....que
35b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35c0: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  LECT - col0 * co
35d0: 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l1 * cor0.col1 A
35e0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
35f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3600: 2d 31 33 35 32 30 0d 0a 2d 32 30 32 38 0d 0a 2d  -13520..-2028..-
3610: 36 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6400....query I 
3620: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3630: 2d 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 63  - ( - col0 ) * c
3640: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
3650: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
3660: 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d 0a  ---..1225..576..
3670: 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7921....query I 
3680: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3690: 44 49 53 54 49 4e 43 54 20 2b 20 28 20 32 33 20  DISTINCT + ( 23 
36a0: 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) * col1 FROM ta
36b0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
36c0: 0d 0a 32 33 30 0d 0a 32 39 39 0d 0a 35 39 38 0d  ..230..299..598.
36d0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
36e0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
36f0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
3700: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
3710: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
3720: 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  5..SELECT + col2
3730: 20 2b 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f   + col0 DIV + co
3740: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
3750: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a  cor0..----..33..
3760: 33 36 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66  36..83....skipif
3770: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
3780: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
3790: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
37a0: 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  5..SELECT + col2
37b0: 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32   + col0 / + col2
37c0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
37d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33 36  r0..----..33..36
37e0: 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..83....skipif m
37f0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
3800: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
3810: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
3820: 4c 4c 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f  LL + CAST ( + co
3830: 6c 30 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63  l0 AS REAL ) + c
3840: 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 / - col1 AS 
3850: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
3860: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d  S cor0..----..6.
3870: 0a 37 37 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  .77..78....query
3880: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3890: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
38a0: 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c  ( - col2 ) * col
38b0: 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
38c0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38   tab0..----..-28
38d0: 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a  38..-7462..-97..
38e0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
38f0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
3900: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
3910: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
3920: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38  rowsort label-98
3930: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
3940: 54 20 2b 20 2b 20 36 37 20 44 49 56 20 2d 20 74  T + + 67 DIV - t
3950: 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab0.col2 FROM ta
3960: 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
3970: 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  , tab1, tab2 AS 
3980: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor1..----..-2..
3990: 2d 36 37 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  -67..0....skipif
39a0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
39b0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
39c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
39d0: 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
39e0: 43 54 20 2b 20 2b 20 36 37 20 2f 20 2d 20 74 61  CT + + 67 / - ta
39f0: 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b0.col2 FROM tab
3a00: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  0, tab0 AS cor0,
3a10: 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
3a20: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  or1..----..-2..-
3a30: 36 37 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  67..0....query I
3a40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3a50: 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 28 20   DISTINCT - - ( 
3a60: 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 29 20 2a  - ( + col2 ) ) *
3a70: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 32   + cor0.col2 + 2
3a80: 36 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  6 FROM tab0 cor0
3a90: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 33 0d 0a 2d  ..----..-1063..-
3aa0: 36 36 39 38 0d 0a 32 35 0d 0a 0d 0a 71 75 65 72  6698..25....quer
3ab0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3ac0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
3ad0: 20 2b 20 32 32 20 41 53 20 63 6f 6c 30 20 46 52   + 22 AS col0 FR
3ae0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
3af0: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 0d 0a 2d 31  .----..-1188..-1
3b00: 32 35 34 0d 0a 2d 32 31 31 32 0d 0a 0d 0a 73 6b  254..-2112....sk
3b10: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
3b20: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
3b30: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
3b40: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
3b50: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
3b60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
3b70: 20 63 6f 6c 31 20 2b 20 37 36 20 63 6f 6c 30 20   col1 + 76 col0 
3b80: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
3b90: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 31 36  0..----..162..16
3ba0: 37 0d 0a 31 37 33 0d 0a 0d 0a 71 75 65 72 79 20  7..173....query 
3bb0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3bc0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38 20 2b  T DISTINCT - 8 +
3bd0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
3be0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
3bf0: 0a 31 38 0d 0a 31 39 0d 0a 33 30 0d 0a 0d 0a 71  .18..19..30....q
3c00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3c10: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 28  SELECT ALL + - (
3c20: 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
3c30: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  0 cor0..----..-8
3c40: 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71  6..-91..-97....q
3c50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3c60: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3c70: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  + cor0.col1 * + 
3c80: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 63  col2 + col1 AS c
3c90: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
3ca0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34   cor0..----..194
3cb0: 0d 0a 32 39 32 34 0d 0a 37 35 35 33 0d 0a 0d 0a  ..2924..7553....
3cc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3cd0: 0a 53 45 4c 45 43 54 20 2d 20 39 20 41 53 20 63  .SELECT - 9 AS c
3ce0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
3cf0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 2d 39  r0..----..-9..-9
3d00: 0d 0a 2d 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-9....query I 
3d10: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3d20: 2b 20 2d 20 63 6f 6c 31 20 2a 20 36 34 20 2b 20  + - col1 * 64 + 
3d30: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
3d40: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
3d50: 2d 2d 2d 2d 0d 0a 2d 35 34 31 38 0d 0a 2d 35 37  ----..-5418..-57
3d60: 33 33 0d 0a 2d 36 31 31 31 0d 0a 0d 0a 71 75 65  33..-6111....que
3d70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3d80: 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 33 31 20  LECT ALL - - 31 
3d90: 2a 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  * + ( - cor0.col
3da0: 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  1 ) FROM tab0 AS
3db0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
3dc0: 36 36 0d 0a 2d 32 38 32 31 0d 0a 2d 33 30 30 37  66..-2821..-3007
3dd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3de0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
3df0: 49 4e 43 54 20 2d 20 33 20 2a 20 2b 20 63 6f 72  INCT - 3 * + cor
3e00: 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
3e10: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
3e20: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 33  ..----..-21..-23
3e30: 34 0d 0a 2d 32 33 37 0d 0a 0d 0a 71 75 65 72 79  4..-237....query
3e40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3e50: 43 54 20 35 35 20 2a 20 63 6f 6c 32 20 2b 20 63  CT 55 * col2 + c
3e60: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
3e70: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
3e80: 2d 2d 2d 0d 0a 31 34 35 36 0d 0a 31 35 31 32 0d  ---..1456..1512.
3e90: 0a 32 31 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .2128....query I
3ea0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3eb0: 20 41 4c 4c 20 2d 20 2b 20 31 33 20 2b 20 2b 20   ALL - + 13 + + 
3ec0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
3ed0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
3ee0: 32 0d 0a 32 30 0d 0a 36 39 0d 0a 0d 0a 71 75 65  2..20..69....que
3ef0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3f00: 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20  LECT - - col2 * 
3f10: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20  + col0 * col0 + 
3f20: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
3f30: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3f40: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 34 0d 0a 31 38  ..----..1224..18
3f50: 39 37 35 0d 0a 36 34 39 34 34 30 0d 0a 0d 0a 71  975..649440....q
3f60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3f70: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
3f80: 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 36 33 20  2 * col2 + + 63 
3f90: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
3fa0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
3fb0: 0a 31 31 35 32 0d 0a 36 34 0d 0a 36 37 38 37 0d  .1152..64..6787.
3fc0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
3fd0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
3fe0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
3ff0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
4000: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
4010: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4020: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
4030: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b   + col2 * col0 +
4040: 20 28 20 2b 20 63 6f 6c 31 20 29 20 63 6f 6c 30   ( + col1 ) col0
4050: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
4060: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 36  r0..----..-23346
4070: 32 0d 0a 2d 34 36 30 0d 0a 2d 36 31 34 33 38 37  2..-460..-614387
4080: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4090: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
40a0: 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  INCT cor0.col1 *
40b0: 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
40c0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
40d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
40e0: 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
40f0: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
4100: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
4110: 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 28  TINCT + col2 * (
4120: 20 2d 20 33 39 20 2a 20 63 6f 6c 32 20 29 20 41   - 39 * col2 ) A
4130: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
4140: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4150: 2d 32 36 33 36 34 0d 0a 2d 32 38 34 33 31 0d 0a  -26364..-28431..
4160: 2d 35 36 33 31 36 0d 0a 0d 0a 71 75 65 72 79 20  -56316....query 
4170: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4180: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
4190: 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
41a0: 34 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  47 AS col1 FROM 
41b0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
41c0: 2d 2d 0d 0a 2d 31 31 30 34 0d 0a 2d 31 36 31 30  --..-1104..-1610
41d0: 0d 0a 2d 34 30 39 34 0d 0a 0d 0a 71 75 65 72 79  ..-4094....query
41e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
41f0: 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 32 20  CT ALL + + col2 
4200: 2a 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2b  * - ( + col0 ) +
4210: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   + col1 * + col2
4220: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
4230: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 35 36 0d  r0..----..-2356.
4240: 0a 2d 34 39 34 0d 0a 36 34 38 0d 0a 0d 0a 73 6b  .-494..648....sk
4250: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
4260: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
4270: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
4280: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
4290: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
42a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
42b0: 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  LL - + col0 + co
42c0: 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
42d0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
42e0: 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a 0d  .-19..-62..24...
42f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4300: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
4310: 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol0 + col0 * col
4320: 31 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  1 - cor0.col0 * 
4330: 2b 20 38 34 20 46 52 4f 4d 20 74 61 62 31 20 41  + 84 FROM tab1 A
4340: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
4350: 37 31 0d 0a 2d 34 36 37 32 0d 0a 2d 35 36 30 30  71..-4672..-5600
4360: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
4370: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
4380: 20 2b 20 35 32 20 2a 20 2b 20 34 37 20 41 53 20   + 52 * + 47 AS 
4390: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
43a0: 2d 2d 2d 2d 0d 0a 32 34 35 31 0d 0a 32 35 32 32  ----..2451..2522
43b0: 0d 0a 32 35 32 33 0d 0a 0d 0a 71 75 65 72 79 20  ..2523....query 
43c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
43d0: 54 20 41 4c 4c 20 35 20 41 53 20 63 6f 6c 30 20  T ALL 5 AS col0 
43e0: 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
43f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
4400: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
4410: 74 6f 20 36 30 33 35 36 32 38 36 39 34 62 64 65  to 6035628694bde
4420: 61 33 36 66 35 38 34 66 33 36 34 39 30 38 38 35  a36f584f36490885
4430: 35 31 64 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  51d....onlyif my
4440: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
4450: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
4460: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
4470: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4480: 65 6c 2d 31 32 32 0d 0a 53 45 4c 45 43 54 20 2b  el-122..SELECT +
4490: 20 63 6f 6c 30 20 44 49 56 20 43 41 53 54 28 20   col0 DIV CAST( 
44a0: 34 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  4 AS SIGNED ) + 
44b0: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20  col0 * - col2 * 
44c0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
44d0: 2d 2d 2d 2d 0d 0a 2d 33 36 34 36 34 0d 0a 2d 34  ----..-36464..-4
44e0: 32 31 32 0d 0a 2d 39 39 38 32 30 0d 0a 0d 0a 73  212..-99820....s
44f0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
4500: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
4510: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4520: 62 65 6c 2d 31 32 32 0d 0a 53 45 4c 45 43 54 20  bel-122..SELECT 
4530: 2b 20 63 6f 6c 30 20 2f 20 43 41 53 54 20 28 20  + col0 / CAST ( 
4540: 34 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  4 AS INTEGER ) +
4550: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a   col0 * - col2 *
4560: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
4570: 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 36 34 0d 0a 2d  .----..-36464..-
4580: 34 32 31 32 0d 0a 2d 39 39 38 32 30 0d 0a 0d 0a  4212..-99820....
4590: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
45a0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
45b0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
45c0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
45d0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 0d  wsort label-123.
45e0: 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
45f0: 30 20 2a 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  0 * col2 DIV col
4600: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
4610: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
4620: 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d  -..26..27..38...
4630: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
4640: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
4650: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4660: 6c 61 62 65 6c 2d 31 32 33 0d 0a 53 45 4c 45 43  label-123..SELEC
4670: 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  T cor0.col0 * co
4680: 6c 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 / col0 AS col
4690: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
46a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
46b0: 37 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..38....onlyif 
46c0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
46d0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
46e0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
46f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4700: 61 62 65 6c 2d 31 32 34 0d 0a 53 45 4c 45 43 54  abel-124..SELECT
4710: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   - col1 + + col2
4720: 20 44 49 56 20 2b 20 63 6f 6c 32 20 41 53 20 63   DIV + col2 AS c
4730: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
4740: 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39 30 0d 0a 2d  ---..-85..-90..-
4750: 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  96....skipif mys
4760: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
4770: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
4780: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 0d 0a  sort label-124..
4790: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
47a0: 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20  + col2 / + col2 
47b0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
47c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39  0..----..-85..-9
47d0: 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20  0..-96....query 
47e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
47f0: 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  T + col1 * col1 
4800: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
4810: 32 20 57 48 45 52 45 20 4e 4f 54 20 2b 20 63 6f  2 WHERE NOT + co
4820: 6c 30 20 4e 4f 54 20 49 4e 20 28 20 63 6f 6c 32  l0 NOT IN ( col2
4830: 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 29 0d 0a   * tab2.col1 )..
4840: 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
4850: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4860: 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
4870: 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
4880: 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
4890: 4a 4f 49 4e 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  JOIN tab1..----.
48a0: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
48b0: 6e 67 20 74 6f 20 37 66 34 61 39 62 66 32 34 64  ng to 7f4a9bf24d
48c0: 36 34 38 33 33 37 30 36 64 66 62 64 64 30 62 61  64833706dfbdd0ba
48d0: 66 34 39 64 37 39 0d 0a 0d 0a 71 75 65 72 79 20  f49d79....query 
48e0: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
48f0: 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  ECT * FROM tab2 
4900: 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20  WHERE NULL IN ( 
4910: 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 29 0d  col2 / + col2 ).
4920: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
4930: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
4940: 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
4950: 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
4960: 54 20 2d 20 63 6f 6c 30 20 4e 4f 54 20 49 4e 20  T - col0 NOT IN 
4970: 28 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 29 0d  ( col0 + col0 ).
4980: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
4990: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
49a0: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   - col2 AS col2 
49b0: 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
49c0: 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 3c 3d 20  NOT ( NULL ) <= 
49d0: 74 61 62 32 2e 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d  tab2.col1..----.
49e0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
49f0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
4a00: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
4a10: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
4a20: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
4a30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4a40: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
4a50: 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol2 - - col0 col
4a60: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
4a70: 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a  -..-16..-51..7..
4a80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4a90: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
4aa0: 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d  CT col0 * col0 -
4ab0: 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46   + col0 * col0 F
4ac0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
4ad0: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
4ae0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4af0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
4b00: 2d 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  - - col1 * col0 
4b10: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
4b20: 0a 35 37 36 0d 0a 37 35 0d 0a 39 36 30 0d 0a 0d  .576..75..960...
4b30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4b40: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
4b50: 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52  + col2 + col2 FR
4b60: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
4b70: 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d 0a  344..1458..627..
4b80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4b90: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
4ba0: 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  l0 * - col2 AS c
4bb0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol0 FROM tab0 WH
4bc0: 45 52 45 20 4e 55 4c 4c 20 3e 20 63 6f 6c 31 20  ERE NULL > col1 
4bd0: 41 4e 44 20 4e 55 4c 4c 20 3c 20 28 20 63 6f 6c  AND NULL < ( col
4be0: 30 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  0 - col0 * + col
4bf0: 31 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  1 * - tab0.col0 
4c00: 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
4c10: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4c20: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  CT + col2 * - co
4c30: 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 + - col0 AS c
4c40: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
4c50: 2d 2d 2d 0d 0a 2d 32 39 31 39 0d 0a 2d 33 33 31  ---..-2919..-331
4c60: 33 0d 0a 2d 39 32 39 36 0d 0a 0d 0a 71 75 65 72  3..-9296....quer
4c70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4c80: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
4c90: 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  ol1 + col0 + - c
4ca0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
4cb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39   cor0..----..-29
4cc0: 0d 0a 2d 33 0d 0a 2d 37 37 0d 0a 0d 0a 71 75 65  ..-3..-77....que
4cd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4ce0: 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
4cf0: 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63  l2 + + col1 AS c
4d00: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
4d10: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  r0..----..109..6
4d20: 37 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..80....onlyif 
4d30: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
4d40: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
4d50: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
4d60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4d70: 61 62 65 6c 2d 31 33 38 0d 0a 53 45 4c 45 43 54  abel-138..SELECT
4d80: 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 44 49   ALL - - col0 DI
4d90: 56 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  V - col0 + col1 
4da0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
4db0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
4dc0: 0a 38 35 0d 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 73  .85..90..96....s
4dd0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
4de0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
4df0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4e00: 62 65 6c 2d 31 33 38 0d 0a 53 45 4c 45 43 54 20  bel-138..SELECT 
4e10: 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2f 20 2d  ALL - - col0 / -
4e20: 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20   col0 + col1 AS 
4e30: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
4e40: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35  S cor0..----..85
4e50: 0d 0a 39 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  ..90..96....quer
4e60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4e70: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
4e80: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
4e90: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
4ea0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
4eb0: 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37  ---..-16..-51..7
4ec0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
4ed0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
4ee0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
4ef0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
4f00: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
4f10: 31 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  140..SELECT + co
4f20: 72 30 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31  r0.col1 DIV col1
4f30: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
4f40: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
4f50: 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b  .2..34..83....sk
4f60: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
4f70: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
4f80: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4f90: 65 6c 2d 31 34 30 0d 0a 53 45 4c 45 43 54 20 2b  el-140..SELECT +
4fa0: 20 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c   cor0.col1 / col
4fb0: 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 + col2 FROM ta
4fc0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
4fd0: 0d 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 71  ..2..34..83....q
4fe0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4ff0: 53 45 4c 45 43 54 20 41 4c 4c 20 37 20 2b 20 2d  SELECT ALL 7 + -
5000: 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
5010: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
5020: 2d 2d 0d 0a 2d 32 36 0d 0a 2d 37 35 0d 0a 36 0d  --..-26..-75..6.
5030: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
5040: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
5050: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
5060: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
5070: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
5080: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 0d  wsort label-142.
5090: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
50a0: 2e 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20  .col1 + + CAST( 
50b0: 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29  col1 AS SIGNED )
50c0: 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   * + cor0.col0 +
50d0: 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 38 34 20 46   + col2 * + 84 F
50e0: 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
50f0: 2d 2d 2d 0d 0a 31 35 30 37 38 0d 0a 33 35 37 36  ---..15078..3576
5100: 0d 0a 34 39 32 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..4922....skipif
5110: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
5120: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
5130: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5140: 34 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  42..SELECT ALL c
5150: 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 43 41 53  or0.col1 + + CAS
5160: 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45  T ( col1 AS INTE
5170: 47 45 52 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63  GER ) * + cor0.c
5180: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b  ol0 + + col2 * +
5190: 20 38 34 20 46 52 4f 4d 20 74 61 62 30 20 63 6f   84 FROM tab0 co
51a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 37 38 0d  r0..----..15078.
51b0: 0a 33 35 37 36 0d 0a 34 39 32 32 0d 0a 0d 0a 71  .3576..4922....q
51c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
51d0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
51e0: 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20  + col0 - col1 * 
51f0: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
5200: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
5210: 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32 0d 0a  ---..132..2862..
5220: 37 35 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7551....query I 
5230: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5240: 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 39 34 20  ALL + col1 + 94 
5250: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
5260: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30 0d 0a 31 38  0..----..180..18
5270: 35 0d 0a 31 39 31 0d 0a 0d 0a 71 75 65 72 79 20  5..191....query 
5280: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
5290: 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
52a0: 31 20 2a 20 28 20 2b 20 39 33 20 29 20 2b 20 2b  1 * ( + 93 ) + +
52b0: 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63 6f 6c 30   col0 * + ( col0
52c0: 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72   ) FROM tab2 cor
52d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 37 31 0d 0a  0..----..11571..
52e0: 32 39 33 32 0d 0a 37 38 32 32 0d 0a 0d 0a 71 75  2932..7822....qu
52f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5300: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 39  ELECT - col0 * 9
5310: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
5320: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 38 34  or0..----..-2184
5330: 0d 0a 2d 33 31 38 35 0d 0a 2d 38 30 39 39 0d 0a  ..-3185..-8099..
5340: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5350: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
5360: 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  r0.col1 + - col0
5370: 20 2a 20 31 30 20 41 53 20 63 6f 6c 32 20 46 52   * 10 AS col2 FR
5380: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
5390: 0a 2d 2d 2d 2d 0d 0a 2d 33 39 0d 0a 2d 37 32 31  .----..-39..-721
53a0: 0d 0a 2d 37 37 33 0d 0a 0d 0a 71 75 65 72 79 20  ..-773....query 
53b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
53c0: 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  T - col2 + col1 
53d0: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
53e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30   cor0..----..280
53f0: 35 0d 0a 37 33 38 30 0d 0a 39 36 0d 0a 0d 0a 6f  5..7380..96....o
5400: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
5410: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
5420: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
5430: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
5440: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 0d 0a  sort label-149..
5450: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
5460: 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  + - col2 DIV - c
5470: 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 + col1 FROM 
5480: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
5490: 2d 2d 0d 0a 38 37 0d 0a 39 32 0d 0a 39 38 0d 0a  --..87..92..98..
54a0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
54b0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
54c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
54d0: 20 6c 61 62 65 6c 2d 31 34 39 0d 0a 53 45 4c 45   label-149..SELE
54e0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
54f0: 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32 20 2b 20  col2 / - col2 + 
5500: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
5510: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37  S cor0..----..87
5520: 0d 0a 39 32 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70  ..92..98....skip
5530: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
5540: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
5550: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5560: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
5570: 6c 30 20 2a 20 43 41 53 54 20 28 20 63 6f 72 30  l0 * CAST ( cor0
5580: 2e 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20  .col2 AS REAL ) 
5590: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
55a0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
55b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
55c0: 36 35 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a  65..3712..7760..
55d0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
55e0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
55f0: 43 54 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20  CT - ( + col1 ) 
5600: 2a 20 2d 20 28 20 2b 20 63 6f 6c 31 20 2a 20 2d  * - ( + col1 * -
5610: 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20   col1 ) AS col0 
5620: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
5630: 0a 2d 32 30 35 33 37 39 0d 0a 2d 32 39 37 39 31  .-205379..-29791
5640: 0d 0a 2d 34 39 31 33 0d 0a 0d 0a 73 6b 69 70 69  ..-4913....skipi
5650: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
5660: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
5670: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
5680: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
5690: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
56a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
56b0: 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  + col1 + - col0 
56c0: 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  + col1 col1 FROM
56d0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34   tab1..----..-44
56e0: 0d 0a 2d 35 34 0d 0a 34 39 0d 0a 0d 0a 71 75 65  ..-54..49....que
56f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5700: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
5710: 74 61 62 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32  tab0.col0 + col2
5720: 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46   * col0 + col2 F
5730: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
5740: 31 35 34 37 39 0d 0a 32 38 38 39 0d 0a 33 34 33  15479..2889..343
5750: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
5760: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
5770: 61 62 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  ab0.col0 * col2 
5780: 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  + col1 * + col1 
5790: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
57a0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 35 37 39 0d 0a  0..----..15579..
57b0: 38 31 38 38 0d 0a 39 34 34 34 0d 0a 0d 0a 71 75  8188..9444....qu
57c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
57d0: 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 74  ELECT col1 * - t
57e0: 61 62 32 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  ab2.col2 * col1 
57f0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
5800: 0a 2d 31 30 39 38 32 0d 0a 2d 32 35 39 34 37 0d  .-10982..-25947.
5810: 0a 2d 39 30 35 30 36 0d 0a 0d 0a 73 6b 69 70 69  .-90506....skipi
5820: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
5830: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
5840: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
5850: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
5860: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
5870: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
5880: 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2d 20 74 61  tab0.col1 + - ta
5890: 62 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b  b0.col0 * col2 +
58a0: 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
58b0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
58c0: 32 39 36 0d 0a 2d 37 33 30 0d 0a 32 37 0d 0a 0d  296..-730..27...
58d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
58e0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
58f0: 2a 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2d 20  * tab2.col1 + - 
5900: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
5910: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35  M tab2..----..15
5920: 30 38 0d 0a 36 30 38 0d 0a 38 31 30 0d 0a 0d 0a  08..608..810....
5930: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
5940: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
5950: 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2b   + + tab0.col2 +
5960: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
5970: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 38 34 0d  0..----..63..84.
5980: 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  .95....query III
5990: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
59a0: 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45   * FROM tab1 WHE
59b0: 52 45 20 28 20 4e 55 4c 4c 20 29 20 49 4e 20 28  RE ( NULL ) IN (
59c0: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   + col0 + - col0
59d0: 20 2a 20 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d   * + col2 )..---
59e0: 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
59f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5a00: 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 32 20  TINCT tab0.col2 
5a10: 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  * + col0 * col2 
5a20: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
5a30: 0a 32 36 31 33 36 0d 0a 33 35 0d 0a 35 39 38 34  .26136..35..5984
5a40: 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  36....onlyif mys
5a50: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
5a60: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
5a70: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
5a80: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
5a90: 6c 2d 31 36 31 0d 0a 53 45 4c 45 43 54 20 63 6f  l-161..SELECT co
5aa0: 6c 30 20 2a 20 63 6f 6c 31 20 44 49 56 20 63 6f  l0 * col1 DIV co
5ab0: 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 + col0 AS col
5ac0: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
5ad0: 2d 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a  -..178..48..70..
5ae0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
5af0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
5b00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5b10: 20 6c 61 62 65 6c 2d 31 36 31 0d 0a 53 45 4c 45   label-161..SELE
5b20: 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f  CT col0 * col1 /
5b30: 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20   col1 + col0 AS 
5b40: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
5b50: 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37  ----..178..48..7
5b60: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
5b70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5b80: 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 31 20  TINCT tab1.col1 
5b90: 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  + - col0 * + col
5ba0: 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 * col2 FROM ta
5bb0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33 34 36  b1..----..-23346
5bc0: 32 0d 0a 2d 34 36 30 0d 0a 2d 36 31 34 33 38 37  2..-460..-614387
5bd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5be0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
5bf0: 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2d   * tab0.col2 + -
5c00: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f   col2 * col2 FRO
5c10: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab0..----..17
5c20: 34 39 0d 0a 37 33 38 0d 0a 39 36 0d 0a 0d 0a 71  49..738..96....q
5c30: 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
5c40: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46  ..SELECT ALL * F
5c50: 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e  ROM tab0 WHERE N
5c60: 4f 54 20 63 6f 6c 30 20 4e 4f 54 20 49 4e 20 28  OT col0 NOT IN (
5c70: 20 63 6f 6c 30 20 2b 20 2b 20 74 61 62 30 2e 63   col0 + + tab0.c
5c80: 6f 6c 31 20 2a 20 63 6f 6c 30 20 29 0d 0a 2d 2d  ol1 * col0 )..--
5c90: 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
5ca0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
5cb0: 4c 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  L col1 * - col0 
5cc0: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  + tab1.col0 FROM
5cd0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37   tab1..----..-57
5ce0: 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d 0a 0d 0a  6..-75..-960....
5cf0: 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
5d00: 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
5d10: 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20   tab0 WHERE NOT 
5d20: 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 49 4e 20 28  col2 + col1 IN (
5d30: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 29 0d 0a   col2 * col2 )..
5d40: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
5d50: 61 73 68 69 6e 67 20 74 6f 20 33 38 61 31 36 37  ashing to 38a167
5d60: 33 65 32 65 30 39 64 36 39 34 63 38 63 65 63 34  3e2e09d694c8cec4
5d70: 35 63 37 39 37 30 33 34 61 37 0d 0a 0d 0a 71 75  5c797034a7....qu
5d80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5d90: 45 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c  ELECT - tab1.col
5da0: 30 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  0 * col0 - col2 
5db0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
5dc0: 0a 2d 34 31 35 33 0d 0a 2d 36 33 0d 0a 2d 36 34  .-4153..-63..-64
5dd0: 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
5de0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
5df0: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
5e00: 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53  - col0 * col2 AS
5e10: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
5e20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39  cor0..----..-339
5e30: 35 0d 0a 2d 36 36 34 31 31 38 0d 0a 2d 36 38 31  5..-664118..-681
5e40: 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
5e50: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
5e60: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2d 20  col2 * - col2 - 
5e70: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
5e80: 2d 2d 2d 2d 0d 0a 31 34 30 36 0d 0a 36 35 30 0d  ----..1406..650.
5e90: 0a 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .702....query I 
5ea0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5eb0: 2d 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62 30 2e  - col2 * + tab0.
5ec0: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53  col2 + - col2 AS
5ed0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
5ee0: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 32 0d 0a 2d 32  .----..-1122..-2
5ef0: 0d 0a 2d 36 38 30 36 0d 0a 0d 0a 71 75 65 72 79  ..-6806....query
5f00: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5f10: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
5f20: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a   + col1 * col0 *
5f30: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f   col2 + col1 FRO
5f40: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34  M tab0..----..34
5f50: 39 33 0d 0a 36 36 34 32 39 31 0d 0a 36 38 32 33  93..664291..6823
5f60: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
5f70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
5f80: 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d  TINCT - col0 + -
5f90: 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 74 61 62   tab2.col1 * tab
5fa0: 32 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20  2.col1 + + col2 
5fb0: 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2d 20  * tab2.col2 * - 
5fc0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
5fd0: 2d 2d 2d 2d 0d 0a 2d 32 33 35 36 37 0d 0a 2d 32  ----..-23567..-2
5fe0: 34 39 31 36 0d 0a 2d 34 33 34 34 33 0d 0a 0d 0a  4916..-43443....
5ff0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6000: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a  .SELECT - col2 *
6010: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46   - col1 * col0 F
6020: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
6030: 33 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36 38  3395..664118..68
6040: 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  112....query III
6050: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6060: 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
6070: 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20   tab0 WHERE NOT 
6080: 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d 20  ( col2 * col1 - 
6090: 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20  + col0 / - col0 
60a0: 29 20 4e 4f 54 20 49 4e 20 28 20 2d 20 74 61 62  ) NOT IN ( - tab
60b0: 30 2e 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  0.col1 )..----..
60c0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
60d0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
60e0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
60f0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
6100: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37  rowsort label-17
6110: 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  5..SELECT col2 *
6120: 20 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f   - col0 DIV + co
6130: 6c 30 20 2d 20 2d 20 74 61 62 32 2e 63 6f 6c 31  l0 - - tab2.col1
6140: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
6150: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33  b2..----..-21..3
6160: 33 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  3..4....skipif m
6170: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
6180: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
6190: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 35  owsort label-175
61a0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
61b0: 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20  - col0 / + col0 
61c0: 2d 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 41 53  - - tab2.col1 AS
61d0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
61e0: 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a  .----..-21..33..
61f0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
6200: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
6210: 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63  ol1 + + col2 * c
6220: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
6230: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39   tab2..----..159
6240: 33 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a 0d 0a 71  3..663..868....q
6250: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6260: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
6270: 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  0 * col1 + - col
6280: 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
6290: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 36 0d  ab2..----..1326.
62a0: 0a 31 38 36 0d 0a 34 35 34 33 0d 0a 0d 0a 73 6b  .186..4543....sk
62b0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
62c0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
62d0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
62e0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
62f0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
6300: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
6310: 4c 4c 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 63  LL - tab2.col1 c
6320: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
6330: 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d  ---..-17..-31..-
6340: 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
6350: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
6360: 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 33 30  STINCT col2 + 30
6370: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   * - cor0.col2 *
6380: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
6390: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
63a0: 0a 2d 31 39 33 34 32 0d 0a 2d 32 35 30 38 33 0d  .-19342..-25083.
63b0: 0a 2d 34 35 39 39 34 0d 0a 0d 0a 71 75 65 72 79  .-45994....query
63c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
63d0: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e  CT ALL - + cor0.
63e0: 63 6f 6c 30 20 2a 20 28 20 2b 20 33 31 20 29 20  col0 * ( + 31 ) 
63f0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6400: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6410: 0a 2d 32 31 37 0d 0a 2d 32 34 31 38 0d 0a 2d 32  .-217..-2418..-2
6420: 34 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  449....query I r
6430: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
6440: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b  ISTINCT + col1 +
6450: 20 33 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31   3 + col0 * col1
6460: 20 2a 20 2b 20 31 34 20 41 53 20 63 6f 6c 30 20   * + 14 AS col0 
6470: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
6480: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 34 38 30 0d  0..----..113480.
6490: 0a 32 38 39 38 35 0d 0a 34 37 36 33 30 0d 0a 0d  .28985..47630...
64a0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
64b0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
64c0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
64d0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
64e0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 32  owsort label-182
64f0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20  ..SELECT col1 - 
6500: 2d 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c  - col0 DIV + col
6510: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
6520: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a  or0..----..132..
6530: 38 36 0d 0a 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  86..92....skipif
6540: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
6550: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6560: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6570: 38 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  82..SELECT col1 
6580: 2d 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c  - - col0 / + col
6590: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
65a0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a  or0..----..132..
65b0: 38 36 0d 0a 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  86..92....onlyif
65c0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
65d0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
65e0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
65f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6600: 6c 61 62 65 6c 2d 31 38 33 0d 0a 53 45 4c 45 43  label-183..SELEC
6610: 54 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63  T + - col1 - - c
6620: 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 46 52 4f  ol2 DIV col2 FRO
6630: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
6640: 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 39 30 0d 0a  ----..-85..-90..
6650: 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -96....skipif my
6660: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
6670: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
6680: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 33 0d  wsort label-183.
6690: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31  .SELECT + - col1
66a0: 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 32   - - col2 / col2
66b0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
66c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d  r0..----..-85..-
66d0: 39 30 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79  90..-96....query
66e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
66f0: 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 28 20  CT - - col0 + ( 
6700: 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 30 20  col0 ) * + col0 
6710: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6720: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6730: 0a 35 36 0d 0a 36 31 36 32 0d 0a 36 33 32 30 0d  .56..6162..6320.
6740: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6750: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 32  rt..SELECT - + 2
6760: 33 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  3 FROM tab1, tab
6770: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
6780: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
6790: 20 68 61 73 68 69 6e 67 20 74 6f 20 39 62 64 37   hashing to 9bd7
67a0: 32 31 66 39 39 64 37 39 64 63 65 32 31 62 31 64  21f99d79dce21b1d
67b0: 65 32 38 36 30 66 64 35 31 65 64 35 0d 0a 0d 0a  e2860fd51ed5....
67c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
67d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
67e0: 6c 32 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 32 20  l2 + - ( - col2 
67f0: 29 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  ) * col1 + col2 
6800: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6810: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 30 0d 0a 31  0..----..1440..1
6820: 35 31 32 0d 0a 36 38 34 0d 0a 0d 0a 6f 6e 6c 79  512..684....only
6830: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
6840: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
6850: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
6860: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
6870: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
6880: 61 62 65 6c 2d 31 38 37 0d 0a 53 45 4c 45 43 54  abel-187..SELECT
6890: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f   DISTINCT - + co
68a0: 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 * CAST( NULL 
68b0: 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2d 20 63  AS DECIMAL ) - c
68c0: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
68d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
68e0: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
68f0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
6900: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6910: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6920: 38 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  87..SELECT DISTI
6930: 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 43  NCT - + col2 * C
6940: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45  AST ( NULL AS RE
6950: 41 4c 20 29 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  AL ) - cor0.col0
6960: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6970: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
6980: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6990: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
69a0: 20 2b 20 2d 20 39 30 20 41 53 20 63 6f 6c 30 20   + - 90 AS col0 
69b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
69c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 32  0..----..-10..-2
69d0: 36 0d 0a 2d 38 37 0d 0a 0d 0a 71 75 65 72 79 20  6..-87....query 
69e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
69f0: 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 33 34 20  T - - col1 * 34 
6a00: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
6a10: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  2 cor0..----..10
6a20: 35 34 0d 0a 32 30 30 36 0d 0a 35 37 38 0d 0a 0d  54..2006..578...
6a30: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6a40: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
6a50: 2b 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63  + ( col2 ) * - c
6a60: 6f 6c 31 20 2b 20 39 32 20 2d 20 2d 20 63 6f 6c  ol1 + 92 - - col
6a70: 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 * + col1 FROM 
6a80: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
6a90: 2d 2d 0d 0a 2d 32 37 31 36 0d 0a 2d 33 35 38 31  --..-2716..-3581
6aa0: 38 0d 0a 2d 39 38 35 30 30 0d 0a 0d 0a 71 75 65  8..-98500....que
6ab0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6ac0: 4c 45 43 54 20 63 6f 6c 30 20 2a 20 31 33 20 2d  LECT col0 * 13 -
6ad0: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 46   col2 * - col0 F
6ae0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
6af0: 32 38 30 0d 0a 33 30 34 32 0d 0a 34 30 32 39 0d  280..3042..4029.
6b00: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
6b10: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
6b20: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
6b30: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
6b40: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
6b50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6b60: 45 43 54 20 2d 20 31 34 20 63 6f 6c 30 20 46 52  ECT - 14 col0 FR
6b70: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  OM tab1 AS cor0 
6b80: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c  CROSS JOIN tab2,
6b90: 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
6ba0: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
6bb0: 61 73 68 69 6e 67 20 74 6f 20 63 32 62 66 30 65  ashing to c2bf0e
6bc0: 32 34 32 30 64 32 32 63 64 35 38 64 37 65 65 33  2420d22cd58d7ee3
6bd0: 62 33 30 38 32 37 61 66 63 63 0d 0a 0d 0a 73 6b  b30827afcc....sk
6be0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
6bf0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
6c00: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
6c10: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
6c20: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
6c30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37  owsort..SELECT 7
6c40: 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  1 col0 FROM tab1
6c50: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 0d   cor0..----..71.
6c60: 0a 37 31 0d 0a 37 31 0d 0a 0d 0a 6f 6e 6c 79 69  .71..71....onlyi
6c70: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
6c80: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
6c90: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
6ca0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
6cb0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
6cc0: 62 65 6c 2d 31 39 34 0d 0a 53 45 4c 45 43 54 20  bel-194..SELECT 
6cd0: 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 63  DISTINCT CAST( c
6ce0: 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
6cf0: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
6d00: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
6d10: 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 73  109..67..80....s
6d20: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
6d30: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
6d40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
6d50: 62 65 6c 2d 31 39 34 0d 0a 53 45 4c 45 43 54 20  bel-194..SELECT 
6d60: 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
6d70: 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
6d80: 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ) + col2 AS col0
6d90: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
6da0: 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d  ..109..67..80...
6db0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6dc0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
6dd0: 6f 6c 32 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20  ol2 * tab0.col1 
6de0: 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 28 20 35  + + col0 * + ( 5
6df0: 34 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 33  4 ) * + col0 + 3
6e00: 32 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  2 * - col1 AS co
6e10: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
6e20: 2d 2d 0d 0a 32 35 35 31 34 0d 0a 34 31 37 33 36  --..25514..41736
6e30: 30 0d 0a 36 32 39 34 39 0d 0a 0d 0a 71 75 65 72  0..62949....quer
6e40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6e50: 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ECT + col1 * - c
6e60: 6f 6c 31 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ol1 + tab1.col0 
6e70: 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
6e80: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
6e90: 2d 35 39 38 0d 0a 35 34 30 0d 0a 38 37 31 0d 0a  -598..540..871..
6ea0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
6eb0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
6ec0: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
6ed0: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
6ee0: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
6ef0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6f00: 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2a  CT - tab0.col0 *
6f10: 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20   cor0.col1 col2 
6f20: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
6f30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
6f40: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
6f50: 30 36 66 31 61 61 36 35 38 33 39 63 31 62 66 63  06f1aa65839c1bfc
6f60: 38 35 38 31 35 38 30 62 61 63 64 62 36 37 38 37  8581580bacdb6787
6f70: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6f80: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
6f90: 49 4e 43 54 20 2b 20 31 39 20 2a 20 2b 20 63 6f  INCT + 19 * + co
6fa0: 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 * - col0 AS c
6fb0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
6fc0: 2d 2d 2d 0d 0a 2d 31 31 35 35 39 36 0d 0a 2d 31  ---..-115596..-1
6fd0: 31 38 35 37 39 0d 0a 2d 39 33 31 0d 0a 0d 0a 71  18579..-931....q
6fe0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6ff0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 31 38 20  SELECT ALL + 18 
7000: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
7010: 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
7020: 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
7030: 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab2 AS cor2..---
7040: 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
7050: 68 69 6e 67 20 74 6f 20 61 31 33 64 62 37 33 65  hing to a13db73e
7060: 63 39 33 34 37 35 64 32 38 32 31 63 62 34 61 36  c93475d2821cb4a6
7070: 64 30 65 66 66 32 39 38 0d 0a 0d 0a 71 75 65 72  d0eff298....quer
7080: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7090: 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  ECT - col2 + + c
70a0: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol0 * + col1 FRO
70b0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
70c0: 2d 2d 2d 2d 0d 0a 32 34 0d 0a 35 38 33 0d 0a 39  ----..24..583..9
70d0: 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  44....skipif pos
70e0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
70f0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
7100: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
7110: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
7120: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7130: 53 45 4c 45 43 54 20 31 30 20 2b 20 63 6f 72 30  SELECT 10 + cor0
7140: 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63  .col1 * - col2 c
7150: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
7160: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
7170: 33 38 0d 0a 2d 31 33 39 34 0d 0a 2d 35 36 30 0d  38..-1394..-560.
7180: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7190: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
71a0: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c   cor0.col0 * col
71b0: 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  1 * col0 + col0 
71c0: 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  * + col2 AS col1
71d0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
71e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 36 30  r0..----..118860
71f0: 0d 0a 35 30 33 32 38 0d 0a 37 32 38 31 30 39 0d  ..50328..728109.
7200: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7210: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
7220: 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  * col2 + - col0 
7230: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
7240: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
7250: 0a 2d 33 34 0d 0a 31 30 36 35 0d 0a 36 36 33 35  .-34..1065..6635
7260: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7270: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
7280: 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  INCT + - col1 + 
7290: 2d 20 63 6f 6c 31 20 2a 20 31 39 20 46 52 4f 4d  - col1 * 19 FROM
72a0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
72b0: 2d 2d 2d 0d 0a 2d 31 31 38 30 0d 0a 2d 33 34 30  ---..-1180..-340
72c0: 0d 0a 2d 36 32 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..-620....skipif
72d0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
72e0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
72f0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
7300: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
7310: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
7320: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7330: 4e 43 54 20 35 36 20 2b 20 2d 20 63 6f 72 30 2e  NCT 56 + - cor0.
7340: 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col0 * cor0.col0
7350: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
7360: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
7370: 34 30 34 30 0d 0a 2d 36 33 34 34 0d 0a 34 37 0d  4040..-6344..47.
7380: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
7390: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
73a0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
73b0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
73c0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
73d0: 30 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  06..SELECT ALL c
73e0: 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 63 6f 6c  ol2 DIV col2 col
73f0: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
7400: 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b  -..1..1..1....sk
7410: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
7420: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
7430: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
7440: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
7450: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
7460: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
7470: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
7480: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 36 0d  wsort label-206.
7490: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
74a0: 20 2f 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f   / col2 col1 FRO
74b0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab1..----..1.
74c0: 0a 31 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .1..1....onlyif 
74d0: 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
74e0: 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
74f0: 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
7500: 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
7510: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7520: 6c 2d 32 30 37 0d 0a 53 45 4c 45 43 54 20 44 49  l-207..SELECT DI
7530: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20  STINCT + col2 * 
7540: 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
7550: 44 45 43 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c  DECIMAL ) AS col
7560: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
7570: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
7580: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
7590: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
75a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
75b0: 74 20 6c 61 62 65 6c 2d 32 30 37 0d 0a 53 45 4c  t label-207..SEL
75c0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
75d0: 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20 28 20 4e  ol2 * - CAST ( N
75e0: 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41 53  ULL AS REAL ) AS
75f0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
7600: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
7610: 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ULL....onlyif my
7620: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
7630: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
7640: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
7650: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
7660: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7670: 32 30 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  208..SELECT ALL 
7680: 2d 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53 54 28  - - col2 * CAST(
7690: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
76a0: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
76b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
76c0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
76d0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
76e0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
76f0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7700: 62 65 6c 2d 32 30 38 0d 0a 53 45 4c 45 43 54 20  bel-208..SELECT 
7710: 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 43  ALL - - col2 * C
7720: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
7730: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
7740: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
7750: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
7760: 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
7770: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
7780: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
7790: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
77a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
77b0: 2d 32 30 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -209..SELECT DIS
77c0: 54 49 4e 43 54 20 2b 20 33 31 20 44 49 56 20 28  TINCT + 31 DIV (
77d0: 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 34   + tab1.col0 * 4
77e0: 37 20 29 20 2b 20 2d 20 32 36 20 41 53 20 63 6f  7 ) + - 26 AS co
77f0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
7800: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
7810: 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
7820: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
7830: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
7840: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 39 0d 0a  sort label-209..
7850: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7860: 2b 20 33 31 20 2f 20 28 20 2b 20 74 61 62 31 2e  + 31 / ( + tab1.
7870: 63 6f 6c 30 20 2a 20 34 37 20 29 20 2b 20 2d 20  col0 * 47 ) + - 
7880: 32 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  26 AS col2 FROM 
7890: 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 0d  tab1, tab1 cor0.
78a0: 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 0d 0a 71 75  .----..-26....qu
78b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
78c0: 45 4c 45 43 54 20 2b 20 33 20 2a 20 2d 20 39 33  ELECT + 3 * - 93
78d0: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
78e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
78f0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
7900: 20 74 6f 20 34 32 36 38 37 65 37 32 31 63 33 64   to 42687e721c3d
7910: 38 38 35 38 37 31 38 35 39 65 38 30 37 65 32 32  885871859e807e22
7920: 65 66 64 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  efd8....onlyif m
7930: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
7940: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
7950: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
7960: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
7970: 62 65 6c 2d 32 31 31 0d 0a 53 45 4c 45 43 54 20  bel-211..SELECT 
7980: 63 6f 6c 32 20 2b 20 39 37 20 44 49 56 20 34 35  col2 + 97 DIV 45
7990: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
79a0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
79b0: 0d 0a 32 38 0d 0a 32 39 0d 0a 34 30 0d 0a 0d 0a  ..28..29..40....
79c0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
79d0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
79e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
79f0: 61 62 65 6c 2d 32 31 31 0d 0a 53 45 4c 45 43 54  abel-211..SELECT
7a00: 20 63 6f 6c 32 20 2b 20 39 37 20 2f 20 34 35 20   col2 + 97 / 45 
7a10: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
7a20: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
7a30: 0a 32 38 0d 0a 32 39 0d 0a 34 30 0d 0a 0d 0a 6f  .28..29..40....o
7a40: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
7a50: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
7a60: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
7a70: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
7a80: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 32 0d 0a  sort label-212..
7a90: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7aa0: 2b 20 63 6f 6c 32 20 44 49 56 20 2b 20 37 33 20  + col2 DIV + 73 
7ab0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
7ac0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d  0..----..0..1...
7ad0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
7ae0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
7af0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
7b00: 6c 61 62 65 6c 2d 32 31 32 0d 0a 53 45 4c 45 43  label-212..SELEC
7b10: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
7b20: 32 20 2f 20 2b 20 37 33 20 46 52 4f 4d 20 74 61  2 / + 73 FROM ta
7b30: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7b40: 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20  ..0..1....query 
7b50: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7b60: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
7b70: 6f 6c 32 20 2a 20 2d 20 32 31 20 46 52 4f 4d 20  ol2 * - 21 FROM 
7b80: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
7b90: 2d 2d 0d 0a 31 37 32 32 0d 0a 32 31 0d 0a 36 39  --..1722..21..69
7ba0: 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
7bb0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
7bc0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
7bd0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
7be0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7bf0: 2d 32 31 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -214..SELECT + -
7c00: 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c   col2 + cor0.col
7c10: 30 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f  0 DIV + col1 FRO
7c20: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
7c30: 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 32 37 0d 0a  ----..-25..-27..
7c40: 2d 33 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -34....skipif my
7c50: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
7c60: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
7c70: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 34 0d  wsort label-214.
7c80: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32  .SELECT + - col2
7c90: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2b   + cor0.col0 / +
7ca0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
7cb0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
7cc0: 32 35 0d 0a 2d 32 37 0d 0a 2d 33 34 0d 0a 0d 0a  25..-27..-34....
7cd0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
7ce0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
7cf0: 20 2d 20 63 6f 6c 30 20 2b 20 38 34 20 41 53 20   - col0 + 84 AS 
7d00: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
7d10: 2d 2d 2d 2d 0d 0a 32 30 0d 0a 34 0d 0a 38 31 0d  ----..20..4..81.
7d20: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
7d30: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
7d40: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
7d50: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
7d60: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
7d70: 31 36 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d  16..SELECT + ( -
7d80: 20 63 6f 6c 30 20 29 20 44 49 56 20 2b 20 63 6f   col0 ) DIV + co
7d90: 6c 31 20 2b 20 2d 20 37 31 20 41 53 20 63 6f 6c  l1 + - 71 AS col
7da0: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
7db0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 0d 0a  or0..----..-71..
7dc0: 2d 37 32 0d 0a 2d 37 35 0d 0a 0d 0a 73 6b 69 70  -72..-75....skip
7dd0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
7de0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
7df0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
7e00: 2d 32 31 36 0d 0a 53 45 4c 45 43 54 20 2b 20 28  -216..SELECT + (
7e10: 20 2d 20 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f   - col0 ) / + co
7e20: 6c 31 20 2b 20 2d 20 37 31 20 41 53 20 63 6f 6c  l1 + - 71 AS col
7e30: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
7e40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 0d 0a  or0..----..-71..
7e50: 2d 37 32 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72  -72..-75....quer
7e60: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7e70: 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  ECT + + col2 * -
7e80: 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53 20   col1 - col1 AS 
7e90: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
7ea0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
7eb0: 35 39 33 0d 0a 2d 36 36 33 0d 0a 2d 38 36 38 0d  593..-663..-868.
7ec0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7ed0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7ee0: 4e 43 54 20 31 36 20 2a 20 2b 20 63 6f 72 30 2e  NCT 16 * + cor0.
7ef0: 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col1 + col2 FROM
7f00: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
7f10: 2d 2d 2d 0d 0a 33 31 30 0d 0a 35 32 33 0d 0a 39  ---..310..523..9
7f20: 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  70....onlyif mys
7f30: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
7f40: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
7f50: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
7f60: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
7f70: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
7f80: 31 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  19..SELECT ALL -
7f90: 20 2b 20 43 41 53 54 28 20 2d 20 33 20 41 53 20   + CAST( - 3 AS 
7fa0: 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 31 20  SIGNED ) + col1 
7fb0: 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  * + col0 AS col2
7fc0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
7fd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 36 0d 0a  r0..----..1346..
7fe0: 32 32 30 0d 0a 34 36 30 35 0d 0a 0d 0a 73 6b 69  220..4605....ski
7ff0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
8000: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
8010: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
8020: 6c 2d 32 31 39 0d 0a 53 45 4c 45 43 54 20 41 4c  l-219..SELECT AL
8030: 4c 20 2d 20 2b 20 43 41 53 54 20 28 20 2d 20 33  L - + CAST ( - 3
8040: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
8050: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col1 * + col0 AS
8060: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
8070: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
8080: 33 34 36 0d 0a 32 32 30 0d 0a 34 36 30 35 0d 0a  346..220..4605..
8090: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
80a0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
80b0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
80c0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
80d0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32  rowsort label-22
80e0: 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  0..SELECT - col2
80f0: 20 44 49 56 20 63 6f 6c 32 20 2b 20 63 6f 6c 30   DIV col2 + col0
8100: 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63   DIV - col0 AS c
8110: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
8120: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
8130: 0a 2d 32 0d 0a 2d 32 0d 0a 0d 0a 73 6b 69 70 69  .-2..-2....skipi
8140: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
8150: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
8160: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8170: 32 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  220..SELECT - co
8180: 6c 32 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  l2 / col2 + col0
8190: 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   / - col0 AS col
81a0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
81b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  or0..----..-2..-
81c0: 32 0d 0a 2d 32 0d 0a 0d 0a 71 75 65 72 79 20 49  2..-2....query I
81d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
81e0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
81f0: 20 37 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   78 FROM tab0..-
8200: 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 31 33 0d 0a 31  ---..102..113..1
8210: 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  67....query I ro
8220: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 35  wsort..SELECT 25
8230: 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 2d   * tab0.col0 + -
8240: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
8250: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
8260: 31 34 33 0d 0a 35 36 37 0d 0a 38 37 34 0d 0a 0d  143..567..874...
8270: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
8280: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
8290: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
82a0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
82b0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 33  owsort label-223
82c0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
82d0: 28 20 2d 20 63 6f 6c 31 20 29 20 44 49 56 20 63  ( - col1 ) DIV c
82e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
82f0: 2d 2d 2d 0d 0a 31 36 0d 0a 33 30 0d 0a 35 38 0d  ---..16..30..58.
8300: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
8310: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
8320: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8330: 74 20 6c 61 62 65 6c 2d 32 32 33 0d 0a 53 45 4c  t label-223..SEL
8340: 45 43 54 20 63 6f 6c 31 20 2b 20 28 20 2d 20 63  ECT col1 + ( - c
8350: 6f 6c 31 20 29 20 2f 20 63 6f 6c 31 20 46 52 4f  ol1 ) / col1 FRO
8360: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36  M tab2..----..16
8370: 0d 0a 33 30 0d 0a 35 38 0d 0a 0d 0a 6f 6e 6c 79  ..30..58....only
8380: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
8390: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
83a0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
83b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
83c0: 74 20 6c 61 62 65 6c 2d 32 32 34 0d 0a 53 45 4c  t label-224..SEL
83d0: 45 43 54 20 32 34 20 2a 20 2b 20 63 6f 6c 30 20  ECT 24 * + col0 
83e0: 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  DIV + col0 + - c
83f0: 6f 6c 32 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 31  ol2 * + ( - col1
8400: 20 2a 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   * - ( + col2 ) 
8410: 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
8420: 2d 0d 0a 2d 31 31 39 37 38 34 0d 0a 2d 33 32 34  -..-119784..-324
8430: 36 36 0d 0a 2d 37 35 37 39 32 0d 0a 0d 0a 73 6b  66..-75792....sk
8440: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
8450: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
8460: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8470: 65 6c 2d 32 32 34 0d 0a 53 45 4c 45 43 54 20 32  el-224..SELECT 2
8480: 34 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63  4 * + col0 / + c
8490: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b  ol0 + - col2 * +
84a0: 20 28 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20   ( - col1 * - ( 
84b0: 2b 20 63 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20  + col2 ) ) FROM 
84c0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39  tab1..----..-119
84d0: 37 38 34 0d 0a 2d 33 32 34 36 36 0d 0a 2d 37 35  784..-32466..-75
84e0: 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  792....query I r
84f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
8500: 4c 4c 20 2b 20 33 38 20 2b 20 28 20 63 6f 6c 32  LL + 38 + ( col2
8510: 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20   + - ( - col2 ) 
8520: 2a 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  * - col0 ) FROM 
8530: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 37  tab0..----..-717
8540: 38 0d 0a 2d 37 32 31 0d 0a 34 0d 0a 0d 0a 71 75  8..-721..4....qu
8550: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8560: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
8570: 6c 30 20 2b 20 34 39 20 2a 20 2d 20 63 6f 6c 31  l0 + 49 * - col1
8580: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8590: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 37 0d  r0..----..-1277.
85a0: 0a 2d 35 35 34 0d 0a 2d 37 31 37 0d 0a 0d 0a 71  .-554..-717....q
85b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
85c0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
85d0: 32 20 2b 20 2b 20 34 32 20 2a 20 2d 20 63 6f 6c  2 + + 42 * - col
85e0: 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  1 * col0 + col1 
85f0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
8600: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 33 32 35 31  0..----..-193251
8610: 0d 0a 2d 35 36 34 32 37 0d 0a 2d 39 31 31 30 0d  ..-56427..-9110.
8620: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8630: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
8640: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63  ol0 + - col1 * c
8650: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
8660: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
8670: 2d 2d 2d 0d 0a 2d 31 32 36 34 0d 0a 2d 32 31 30  ---..-1264..-210
8680: 0d 0a 2d 34 35 32 34 0d 0a 0d 0a 6f 6e 6c 79 69  ..-4524....onlyi
8690: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
86a0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
86b0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
86c0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
86d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
86e0: 62 65 6c 2d 32 32 39 0d 0a 53 45 4c 45 43 54 20  bel-229..SELECT 
86f0: 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 43 41 53  DISTINCT - - CAS
8700: 54 28 20 31 20 41 53 20 53 49 47 4e 45 44 20 29  T( 1 AS SIGNED )
8710: 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 34 39   * + col2 - + 49
8720: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
8730: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
8740: 0d 0a 34 37 0d 0a 35 0d 0a 38 0d 0a 0d 0a 73 6b  ..47..5..8....sk
8750: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
8760: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
8770: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8780: 65 6c 2d 32 32 39 0d 0a 53 45 4c 45 43 54 20 44  el-229..SELECT D
8790: 49 53 54 49 4e 43 54 20 2d 20 2d 20 43 41 53 54  ISTINCT - - CAST
87a0: 20 28 20 31 20 41 53 20 49 4e 54 45 47 45 52 20   ( 1 AS INTEGER 
87b0: 29 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 34  ) * + col2 - + 4
87c0: 39 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  9 AS col0 FROM t
87d0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
87e0: 2d 0d 0a 34 37 0d 0a 35 0d 0a 38 0d 0a 0d 0a 6f  -..47..5..8....o
87f0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
8800: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
8810: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
8820: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
8830: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8840: 74 20 6c 61 62 65 6c 2d 32 33 30 0d 0a 53 45 4c  t label-230..SEL
8850: 45 43 54 20 2b 20 43 41 53 54 28 20 63 6f 6c 31  ECT + CAST( col1
8860: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63   AS SIGNED ) - c
8870: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
8880: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
8890: 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a  ---..53..9..96..
88a0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
88b0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
88c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
88d0: 20 6c 61 62 65 6c 2d 32 33 30 0d 0a 53 45 4c 45   label-230..SELE
88e0: 43 54 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 31  CT + CAST ( col1
88f0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20   AS INTEGER ) - 
8900: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
8910: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
8920: 2d 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d  ----..53..9..96.
8930: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8940: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
8950: 4e 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  NCT col1 + col0 
8960: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
8970: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8980: 31 33 34 0d 0a 31 36 37 0d 0a 32 36 39 0d 0a 0d  134..167..269...
8990: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
89a0: 0d 0a 53 45 4c 45 43 54 20 2b 20 39 39 20 2b 20  ..SELECT + 99 + 
89b0: 2d 20 31 37 20 2a 20 2b 20 63 6f 6c 31 20 46 52  - 17 * + col1 FR
89c0: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
89d0: 2d 2d 0d 0a 2d 31 39 30 0d 0a 2d 34 32 38 0d 0a  --..-190..-428..
89e0: 2d 39 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -904....query I 
89f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8a00: 41 4c 4c 20 2b 20 31 20 2b 20 2b 20 63 6f 72 30  ALL + 1 + + cor0
8a10: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
8a20: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
8a30: 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33  .----..27..28..3
8a40: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
8a50: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8a60: 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63  TINCT - col2 + c
8a70: 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 28 20 2b 20  ol1 * - ( - ( + 
8a80: 63 6f 6c 31 20 29 20 29 20 41 53 20 63 6f 6c 32  col1 ) ) AS col2
8a90: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
8aa0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 31 0d 0a 33  r0..----..251..3
8ab0: 34 35 35 0d 0a 39 33 34 0d 0a 0d 0a 71 75 65 72  455..934....quer
8ac0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8ad0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
8ae0: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 38  ol1 * + col1 + 8
8af0: 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  8 AS col1 FROM t
8b00: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
8b10: 37 34 38 34 0d 0a 38 33 36 39 0d 0a 39 34 39 37  7484..8369..9497
8b20: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
8b30: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
8b40: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
8b50: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
8b60: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
8b70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
8b80: 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 38 36 20  LECT ALL + - 86 
8b90: 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  - + col1 col1 FR
8ba0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8bb0: 0a 2d 2d 2d 2d 0d 0a 2d 31 37 32 0d 0a 2d 31 37  .----..-172..-17
8bc0: 37 0d 0a 2d 31 38 33 0d 0a 0d 0a 71 75 65 72 79  7..-183....query
8bd0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8be0: 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT + col0 * - co
8bf0: 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 + + col0 FROM
8c00: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
8c10: 2d 2d 2d 0d 0a 2d 34 30 33 32 0d 0a 2d 36 0d 0a  ---..-4032..-6..
8c20: 2d 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -6320....query I
8c30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8c40: 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 33 33   DISTINCT + - 33
8c50: 20 2b 20 63 6f 6c 32 20 2b 20 28 20 39 38 20 29   + col2 + ( 98 )
8c60: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
8c70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 0d 0a 36  r0..----..147..6
8c80: 36 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  6..98....query I
8c90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8ca0: 20 41 4c 4c 20 2b 20 2d 20 32 39 20 2a 20 2d 20   ALL + - 29 * - 
8cb0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col0 + + col0 AS
8cc0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
8cd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
8ce0: 30 35 30 0d 0a 32 36 37 30 0d 0a 37 32 30 0d 0a  050..2670..720..
8cf0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8d00: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
8d10: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  CT + - col0 * + 
8d20: 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col1 + col2 * co
8d30: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
8d40: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
8d50: 0a 2d 33 30 36 38 0d 0a 2d 36 39 37 0d 0a 36 32  .-3068..-697..62
8d60: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
8d70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
8d80: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   + - cor0.col1 +
8d90: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
8da0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
8db0: 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a  .----..-24..19..
8dc0: 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
8dd0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
8de0: 4c 20 2d 20 34 37 20 2a 20 2d 20 63 6f 6c 32 20  L - 47 * - col2 
8df0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
8e00: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
8e10: 0a 31 35 35 31 0d 0a 33 38 35 34 0d 0a 34 37 0d  .1551..3854..47.
8e20: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
8e30: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
8e40: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
8e50: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
8e60: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8e70: 34 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  43..SELECT - + c
8e80: 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b  ol1 DIV + col0 +
8e90: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
8ea0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  2 cor0..----..-2
8eb0: 36 0d 0a 2d 33 31 0d 0a 2d 33 38 0d 0a 0d 0a 73  6..-31..-38....s
8ec0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8ed0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8ee0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8ef0: 62 65 6c 2d 32 34 33 0d 0a 53 45 4c 45 43 54 20  bel-243..SELECT 
8f00: 2d 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c  - + col1 / + col
8f10: 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  0 + - col2 FROM 
8f20: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
8f30: 0a 2d 32 36 0d 0a 2d 33 31 0d 0a 2d 33 38 0d 0a  .-26..-31..-38..
8f40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8f50: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
8f60: 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 63 6f  CT + + col1 - co
8f70: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
8f80: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
8f90: 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  --..0....query I
8fa0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8fb0: 20 41 4c 4c 20 28 20 37 33 20 29 20 2b 20 2d 20   ALL ( 73 ) + - 
8fc0: 74 61 62 30 2e 63 6f 6c 30 20 2a 20 28 20 2b 20  tab0.col0 * ( + 
8fd0: 63 6f 6c 31 20 2b 20 2b 20 74 61 62 30 2e 63 6f  col1 + + tab0.co
8fe0: 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l0 ) FROM tab0..
8ff0: 2d 2d 2d 2d 0d 0a 2d 31 35 39 34 37 0d 0a 2d 32  ----..-15947..-2
9000: 35 36 37 0d 0a 2d 34 35 34 37 0d 0a 0d 0a 71 75  567..-4547....qu
9010: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9020: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
9030: 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   * col1 + col2 *
9040: 20 2b 20 36 20 46 52 4f 4d 20 74 61 62 32 0d 0a   + 6 FROM tab2..
9050: 2d 2d 2d 2d 0d 0a 2d 33 33 32 35 0d 0a 2d 36 31  ----..-3325..-61
9060: 0d 0a 2d 37 39 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-799....onlyif
9070: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
9080: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
9090: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
90a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
90b0: 6c 61 62 65 6c 2d 32 34 37 0d 0a 53 45 4c 45 43  label-247..SELEC
90c0: 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 72  T + col0 DIV cor
90d0: 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20  0.col2 + col0 + 
90e0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 31  - cor0.col0 col1
90f0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
9100: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r0..----..0..1..
9110: 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  35....skipif pos
9120: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
9130: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
9140: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
9150: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
9160: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9170: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9180: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9190: 62 65 6c 2d 32 34 37 0d 0a 53 45 4c 45 43 54 20  bel-247..SELECT 
91a0: 2b 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f  + col0 / cor0.co
91b0: 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  l2 + col0 + - co
91c0: 72 30 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f  r0.col0 col1 FRO
91d0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
91e0: 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35 0d 0a  ----..0..1..35..
91f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9200: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
9210: 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor1.col1 FROM t
9220: 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
9230: 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
9240: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
9250: 20 68 61 73 68 69 6e 67 20 74 6f 20 37 35 39 39   hashing to 7599
9260: 62 34 38 30 31 32 35 64 65 35 32 31 65 66 65 64  b480125de521efed
9270: 37 31 62 35 62 32 34 31 33 63 37 64 0d 0a 0d 0a  71b5b2413c7d....
9280: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9290: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
92a0: 20 34 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   40 FROM tab1 co
92b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
92c0: 34 30 0d 0a 33 37 0d 0a 0d 0a 73 6b 69 70 69 66  40..37....skipif
92d0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
92e0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
92f0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
9300: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
9310: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
9320: 72 74 0d 0a 53 45 4c 45 43 54 20 36 39 20 63 6f  rt..SELECT 69 co
9330: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
9340: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 39 0d 0a 36 39 0d  0..----..69..69.
9350: 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .69....query I r
9360: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
9370: 4c 4c 20 28 20 2b 20 74 61 62 32 2e 63 6f 6c 31  LL ( + tab2.col1
9380: 20 2a 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   * col1 ) FROM t
9390: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a  ab2..----..289..
93a0: 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 71 75 65  3481..961....que
93b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
93c0: 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c 30 20 2a  LECT cor1.col0 *
93d0: 20 63 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f   cor1.col0 AS co
93e0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l0 FROM tab2, ta
93f0: 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b2 AS cor0, tab2
9400: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
9410: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
9420: 67 20 74 6f 20 33 36 38 62 32 32 36 38 66 61 38  g to 368b2268fa8
9430: 35 63 31 64 39 39 62 62 64 30 38 36 66 34 35 39  5c1d99bbd086f459
9440: 31 62 30 32 62 0d 0a 0d 0a 71 75 65 72 79 20 49  1b02b....query I
9450: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9460: 20 2b 20 34 38 20 2a 20 31 33 20 46 52 4f 4d 20   + 48 * 13 FROM 
9470: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
9480: 2d 2d 0d 0a 36 32 34 0d 0a 36 32 34 0d 0a 36 32  --..624..624..62
9490: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
94a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
94b0: 20 2d 20 63 6f 6c 32 20 2b 20 37 31 20 29 20 2a   - col2 + 71 ) *
94c0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
94d0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
94e0: 35 31 0d 0a 2d 38 39 36 0d 0a 32 30 30 30 0d 0a  51..-896..2000..
94f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9500: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
9510: 20 2b 20 28 20 2d 20 39 35 20 29 20 2b 20 63 6f   + ( - 95 ) + co
9520: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
9530: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
9540: 2d 2d 0d 0a 2d 33 38 0d 0a 32 36 0d 0a 38 31 0d  --..-38..26..81.
9550: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9560: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
9570: 4e 43 54 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e  NCT col1 * tab1.
9580: 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 38 30  col0 + col2 + 80
9590: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
95a0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 36 0d 0a  b1..----..1216..
95b0: 32 31 32 0d 0a 37 37 37 0d 0a 0d 0a 71 75 65 72  212..777....quer
95c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
95d0: 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 30 20 2b  ECT - ( - col0 +
95e0: 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 29 20   + ( - col1 ) ) 
95f0: 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  * - col0 AS col0
9600: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
9610: 0d 0a 2d 31 36 30 32 30 0d 0a 2d 32 36 34 30 0d  ..-16020..-2640.
9620: 0a 2d 34 36 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-4620....onlyif
9630: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
9640: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
9650: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
9660: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
9670: 6c 61 62 65 6c 2d 32 35 38 0d 0a 53 45 4c 45 43  label-258..SELEC
9680: 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 43 41 53  T ALL col2 + CAS
9690: 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
96a0: 44 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  D ) * + cor0.col
96b0: 32 20 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 28  2 DIV + col2 + (
96c0: 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   - col1 ) AS col
96d0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
96e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a  or0..----..111..
96f0: 31 36 33 0d 0a 33 31 0d 0a 0d 0a 73 6b 69 70 69  163..31....skipi
9700: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
9710: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
9720: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9730: 32 35 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  258..SELECT ALL 
9740: 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 63 6f  col2 + CAST ( co
9750: 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
9760: 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20  * + cor0.col2 / 
9770: 2b 20 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c  + col2 + ( - col
9780: 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
9790: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
97a0: 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 36 33 0d 0a 33  ---..111..163..3
97b0: 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  1....onlyif mysq
97c0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
97d0: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
97e0: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
97f0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
9800: 2d 32 35 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -259..SELECT DIS
9810: 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  TINCT - + cor0.c
9820: 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 2d  ol0 DIV col0 + -
9830: 20 28 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   ( - col2 * + co
9840: 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  l0 ) FROM tab0 A
9850: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34  S cor0..----..34
9860: 0d 0a 37 32 39 37 0d 0a 37 39 31 0d 0a 0d 0a 73  ..7297..791....s
9870: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
9880: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
9890: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
98a0: 62 65 6c 2d 32 35 39 0d 0a 53 45 4c 45 43 54 20  bel-259..SELECT 
98b0: 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72  DISTINCT - + cor
98c0: 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20  0.col0 / col0 + 
98d0: 2d 20 28 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  - ( - col2 * + c
98e0: 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol0 ) FROM tab0 
98f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
9900: 34 0d 0a 37 32 39 37 0d 0a 37 39 31 0d 0a 0d 0a  4..7297..791....
9910: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9920: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9930: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 35 32 20 2a   + col0 + - 52 *
9940: 20 2b 20 34 30 20 41 53 20 63 6f 6c 32 20 46 52   + 40 AS col2 FR
9950: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
9960: 2d 2d 0d 0a 2d 32 30 30 30 0d 0a 2d 32 30 31 36  --..-2000..-2016
9970: 0d 0a 2d 32 30 37 37 0d 0a 0d 0a 71 75 65 72 79  ..-2077....query
9980: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9990: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
99a0: 2d 20 32 36 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 26 AS col1 FRO
99b0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
99c0: 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 34 34  ----..-1534..-44
99d0: 32 0d 0a 2d 38 30 36 0d 0a 0d 0a 71 75 65 72 79  2..-806....query
99e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
99f0: 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a  CT + tab1.col1 *
9a00: 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   + col2 * - col1
9a10: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
9a20: 0d 0a 2d 31 36 32 32 34 0d 0a 2d 33 36 35 30 34  ..-16224..-36504
9a30: 0d 0a 2d 35 37 30 30 0d 0a 0d 0a 73 6b 69 70 69  ..-5700....skipi
9a40: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
9a50: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
9a60: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
9a70: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
9a80: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
9a90: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
9aa0: 20 2a 20 36 33 20 63 6f 6c 31 20 46 52 4f 4d 20   * 63 col1 FROM 
9ab0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 34 30 32  tab1..----..3402
9ac0: 0d 0a 33 35 39 31 0d 0a 36 30 34 38 0d 0a 0d 0a  ..3591..6048....
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 2b 20 39 38 20 41 53 20  .SELECT + 98 AS 
9af0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
9b00: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
9b10: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
9b20: 67 20 74 6f 20 66 39 64 65 65 38 63 32 31 31 31  g to f9dee8c2111
9b30: 36 66 31 61 65 64 36 34 61 63 35 31 36 30 65 31  6f1aed64ac5160e1
9b40: 39 30 38 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  90809....query I
9b50: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9b60: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   - cor0.col2 * -
9b70: 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 72 30   ( col0 ) + cor0
9b80: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
9b90: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
9ba0: 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32  .----..165..3712
9bb0: 0d 0a 37 37 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..7760....onlyif
9bc0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
9bd0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
9be0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
9bf0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
9c00: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
9c10: 65 6c 2d 32 36 36 0d 0a 53 45 4c 45 43 54 20 2b  el-266..SELECT +
9c20: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 28   + cor0.col0 + (
9c30: 20 28 20 2b 20 63 6f 6c 32 20 29 20 29 20 2b 20   ( + col2 ) ) + 
9c40: 43 41 53 54 28 20 31 36 20 41 53 20 53 49 47 4e  CAST( 16 AS SIGN
9c50: 45 44 20 29 20 2a 20 2b 20 63 6f 6c 31 20 63 6f  ED ) * + col1 co
9c60: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
9c70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 33 33  cor0..----..1433
9c80: 0d 0a 31 35 38 38 0d 0a 31 36 32 37 0d 0a 0d 0a  ..1588..1627....
9c90: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
9ca0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
9cb0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
9cc0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
9cd0: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
9ce0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
9cf0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
9d00: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36  rowsort label-26
9d10: 36 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  6..SELECT + + co
9d20: 72 30 2e 63 6f 6c 30 20 2b 20 28 20 28 20 2b 20  r0.col0 + ( ( + 
9d30: 63 6f 6c 32 20 29 20 29 20 2b 20 43 41 53 54 20  col2 ) ) + CAST 
9d40: 28 20 31 36 20 41 53 20 49 4e 54 45 47 45 52 20  ( 16 AS INTEGER 
9d50: 29 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20  ) * + col1 col2 
9d60: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
9d70: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 33 33 0d 0a 31  0..----..1433..1
9d80: 35 38 38 0d 0a 31 36 32 37 0d 0a 0d 0a 71 75 65  588..1627....que
9d90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9da0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 28 20  LECT - col1 + ( 
9db0: 31 33 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  13 ) AS col1 FRO
9dc0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
9dd0: 2d 2d 2d 2d 0d 0a 2d 37 33 0d 0a 2d 37 38 0d 0a  ----..-73..-78..
9de0: 2d 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -84....query I r
9df0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
9e00: 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32  ISTINCT - - col2
9e10: 20 2a 20 2b 20 36 37 20 46 52 4f 4d 20 74 61 62   * + 67 FROM tab
9e20: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
9e30: 0a 32 32 31 31 0d 0a 35 34 39 34 0d 0a 36 37 0d  .2211..5494..67.
9e40: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9e50: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
9e60: 20 63 6f 6c 30 20 2a 20 32 35 20 41 53 20 63 6f   col0 * 25 AS co
9e70: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
9e80: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 30  cor0..----..1600
9e90: 0d 0a 32 30 30 30 0d 0a 37 35 0d 0a 0d 0a 71 75  ..2000..75....qu
9ea0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9eb0: 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
9ec0: 30 20 2a 20 2d 20 28 20 2d 20 36 32 20 29 20 46  0 * - ( - 62 ) F
9ed0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
9ee0: 2d 2d 2d 0d 0a 34 33 34 0d 0a 34 38 33 36 0d 0a  ---..434..4836..
9ef0: 34 38 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4898....onlyif m
9f00: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
9f10: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
9f20: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
9f30: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
9f40: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
9f50: 2d 32 37 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -271..SELECT col
9f60: 32 20 2a 20 2b 20 43 41 53 54 28 20 2b 20 35 34  2 * + CAST( + 54
9f70: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
9f80: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
9f90: 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 30 37 38  ----..2916..3078
9fa0: 0d 0a 35 31 38 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..5184....skipif
9fb0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
9fc0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
9fd0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
9fe0: 37 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  71..SELECT col2 
9ff0: 2a 20 2b 20 43 41 53 54 20 28 20 2b 20 35 34 20  * + CAST ( + 54 
a000: 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
a010: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
a020: 2d 2d 2d 2d 0d 0a 32 39 31 36 0d 0a 33 30 37 38  ----..2916..3078
a030: 0d 0a 35 31 38 34 0d 0a 0d 0a 71 75 65 72 79 20  ..5184....query 
a040: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a050: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
a060: 31 20 2b 20 28 20 2b 20 28 20 2d 20 63 6f 6c 31  1 + ( + ( - col1
a070: 20 29 20 29 20 2a 20 2d 20 32 36 20 41 53 20 63   ) ) * - 26 AS c
a080: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
a090: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 32   cor0..----..232
a0a0: 32 0d 0a 32 34 35 37 0d 0a 32 36 31 39 0d 0a 0d  2..2457..2619...
a0b0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
a0c0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
a0d0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
a0e0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
a0f0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
a100: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a110: 54 20 63 6f 6c 32 20 2b 20 38 38 20 63 6f 6c 30  T col2 + 88 col0
a120: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
a130: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 0d 0a 31  r0..----..142..1
a140: 34 35 0d 0a 31 38 34 0d 0a 0d 0a 71 75 65 72 79  45..184....query
a150: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a160: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
a170: 28 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 29 20  ( - tab2.col1 ) 
a180: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a190: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a 2d  2..----..-289..-
a1a0: 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 71 75  3481..-961....qu
a1b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a1c0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
a1d0: 20 2d 20 2d 20 38 33 20 46 52 4f 4d 20 74 61 62   - - 83 FROM tab
a1e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 34 38 0d  0..----..-6..48.
a1f0: 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .59....query I r
a200: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
a210: 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2b 20 63   tab1.col2 + + c
a220: 6f 6c 31 20 2d 20 2b 20 32 37 20 46 52 4f 4d 20  ol1 - + 27 FROM 
a230: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30  tab1..----..-110
a240: 0d 0a 2d 35 35 0d 0a 2d 37 34 0d 0a 0d 0a 71 75  ..-55..-74....qu
a250: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a260: 45 4c 45 43 54 20 38 38 20 2a 20 2d 20 63 6f 72  ELECT 88 * - cor
a270: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
a280: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a290: 2d 34 37 35 32 0d 0a 2d 35 30 31 36 0d 0a 2d 38  -4752..-5016..-8
a2a0: 34 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  448....skipif po
a2b0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
a2c0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
a2d0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
a2e0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
a2f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a300: 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
a310: 32 20 2b 20 31 37 20 63 6f 6c 30 20 46 52 4f 4d  2 + 17 col0 FROM
a320: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
a330: 2d 2d 2d 0d 0a 34 33 0d 0a 34 34 0d 0a 35 35 0d  ---..43..44..55.
a340: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
a350: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
a360: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
a370: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
a380: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
a390: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a3a0: 45 43 54 20 2d 20 39 20 2a 20 2b 20 63 6f 6c 32  ECT - 9 * + col2
a3b0: 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 63   + col2 + col2 c
a3c0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
a3d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37   cor0..----..-37
a3e0: 38 0d 0a 2d 33 39 39 0d 0a 2d 36 37 32 0d 0a 0d  8..-399..-672...
a3f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a400: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
a410: 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + ( cor0.col2 + 
a420: 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  + col1 * cor0.co
a430: 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
a440: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
a450: 2d 2d 2d 2d 0d 0a 31 39 35 0d 0a 32 39 35 37 0d  ----..195..2957.
a460: 0a 37 36 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .7635....query I
a470: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a480: 20 41 4c 4c 20 2b 20 28 20 2b 20 33 36 20 29 20   ALL + ( + 36 ) 
a490: 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
a4a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38   cor0..----..118
a4b0: 38 0d 0a 32 39 35 32 0d 0a 33 36 0d 0a 0d 0a 71  8..2952..36....q
a4c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a4d0: 53 45 4c 45 43 54 20 2d 20 2d 20 39 34 20 2a 20  SELECT - - 94 * 
a4e0: 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  + col2 + + col1 
a4f0: 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  + col2 * - col2 
a500: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
a510: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
a520: 0a 2d 31 37 39 0d 0a 32 31 31 39 0d 0a 32 31 38  .-179..2119..218
a530: 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
a540: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
a550: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
a560: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
a570: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
a580: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a590: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
a5a0: 20 33 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20   32 * col0 col1 
a5b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
a5c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 34 38 0d 0a 32  0..----..2048..2
a5d0: 35 36 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  560..96....query
a5e0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a5f0: 43 54 20 2b 20 2b 20 37 34 20 2a 20 63 6f 6c 32  CT + + 74 * col2
a600: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
a610: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
a620: 39 32 34 0d 0a 31 39 39 38 0d 0a 32 38 31 32 0d  924..1998..2812.
a630: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
a640: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d  rt..SELECT - ( -
a650: 20 63 6f 6c 32 20 29 20 2b 20 33 30 20 41 53 20   col2 ) + 30 AS 
a660: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
a670: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
a680: 36 0d 0a 38 34 0d 0a 38 37 0d 0a 0d 0a 71 75 65  6..84..87....que
a690: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
a6a0: 4c 45 43 54 20 2d 20 32 35 20 41 53 20 63 6f 6c  LECT - 25 AS col
a6b0: 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  0 FROM tab2 cor0
a6c0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 0d 0a 2d 32 35  ..----..-25..-25
a6d0: 0d 0a 2d 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-25....query I
a6e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a6f0: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
a700: 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - + col2 AS col
a710: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
a720: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a  or0..----..-28..
a730: 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72  -47..-83....quer
a740: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a750: 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT - cor0.col1 
a760: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
a770: 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  0, tab2 AS cor0,
a780: 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
a790: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
a7a0: 61 73 68 69 6e 67 20 74 6f 20 36 65 30 62 37 64  ashing to 6e0b7d
a7b0: 35 38 33 62 63 32 63 35 33 38 34 32 31 36 36 64  583bc2c53842166d
a7c0: 33 65 36 62 61 32 64 36 64 32 0d 0a 0d 0a 71 75  3e6ba2d6d2....qu
a7d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
a7e0: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  ELECT + col1 + c
a7f0: 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 33  ol0 * col2 * - 3
a800: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
a810: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 30  ab1..----..-1130
a820: 37 38 0d 0a 2d 32 33 38 30 36 37 0d 0a 2d 34 39  78..-238067..-49
a830: 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  96....onlyif mys
a840: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
a850: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
a860: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
a870: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a880: 6c 2d 32 39 30 0d 0a 53 45 4c 45 43 54 20 43 41  l-290..SELECT CA
a890: 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ST( col2 AS SIGN
a8a0: 45 44 20 29 20 44 49 56 20 2d 20 63 6f 6c 31 20  ED ) DIV - col1 
a8b0: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
a8c0: 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
a8d0: 31 35 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 73 6b  15..31..59....sk
a8e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
a8f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
a900: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a910: 65 6c 2d 32 39 30 0d 0a 53 45 4c 45 43 54 20 43  el-290..SELECT C
a920: 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e  AST ( col2 AS IN
a930: 54 45 47 45 52 20 29 20 2f 20 2d 20 63 6f 6c 31  TEGER ) / - col1
a940: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
a950: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
a960: 0a 31 35 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71  .15..31..59....q
a970: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a980: 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20  SELECT col2 + - 
a990: 74 61 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c 31  tab1.col2 * col1
a9a0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
a9b0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d  b1..----..-1152.
a9c0: 0a 2d 31 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a  .-1350..-513....
a9d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a9e0: 0a 53 45 4c 45 43 54 20 2b 20 28 20 74 61 62 31  .SELECT + ( tab1
a9f0: 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20  .col0 ) AS col1 
aa00: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
aa10: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
aa20: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
aa30: 74 6f 20 64 64 31 38 62 39 33 32 36 33 61 36 63  to dd18b93263a6c
aa40: 64 34 32 35 66 63 37 63 63 38 34 64 39 31 33 37  d425fc7cc84d9137
aa50: 38 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  870....skipif po
aa60: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
aa70: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
aa80: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
aa90: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
aaa0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
aab0: 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
aac0: 6f 6c 30 20 2b 20 2d 20 32 37 20 63 6f 6c 31 20  ol0 + - 27 col1 
aad0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
aae0: 0a 2d 33 0d 0a 36 32 0d 0a 38 0d 0a 0d 0a 71 75  .-3..62..8....qu
aaf0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ab00: 45 4c 45 43 54 20 39 35 20 2b 20 63 6f 6c 32 20  ELECT 95 + col2 
ab10: 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  * col1 * - col2 
ab20: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
ab30: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 37 31 33  1..----..-119713
ab40: 0d 0a 2d 33 32 33 39 35 0d 0a 2d 37 35 37 32 31  ..-32395..-75721
ab50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ab60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
ab70: 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 2d  - ( - col2 ) * -
ab80: 20 63 6f 6c 30 20 2b 20 35 35 20 46 52 4f 4d 20   col0 + 55 FROM 
ab90: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
aba0: 0a 2d 31 33 34 0d 0a 2d 31 39 37 33 0d 0a 2d 32  .-134..-1973..-2
abb0: 39 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  947....query I r
abc0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
abd0: 20 32 33 20 2a 20 33 30 20 46 52 4f 4d 20 74 61   23 * 30 FROM ta
abe0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
abf0: 36 39 30 0d 0a 2d 36 39 30 0d 0a 2d 36 39 30 0d  690..-690..-690.
ac00: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
ac10: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
ac20: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
ac30: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
ac40: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
ac50: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ac60: 45 43 54 20 2d 20 39 38 20 63 6f 6c 32 20 46 52  ECT - 98 col2 FR
ac70: 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
ac80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
ac90: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
aca0: 20 66 31 37 62 37 30 30 38 61 37 64 65 61 65 31   f17b7008a7deae1
acb0: 65 62 35 61 32 65 37 30 37 65 63 32 33 37 36 33  eb5a2e707ec23763
acc0: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
acd0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
ace0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
acf0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
ad00: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
ad10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ad20: 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b  ELECT + - col1 +
ad30: 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 63   col0 * - col1 c
ad40: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
ad50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a  r0..----..-104..
ad60: 2d 31 30 35 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 71  -1053..-650....q
ad70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ad80: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
ad90: 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  - col1 * col0 + 
ada0: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
adb0: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
adc0: 2d 2d 2d 0d 0a 2d 31 33 36 30 0d 0a 2d 32 34 38  ---..-1360..-248
add0: 0d 0a 2d 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79  ..-4661....query
ade0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
adf0: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20  CT ALL + col2 + 
ae00: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 28 20  - cor0.col1 * ( 
ae10: 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  - col1 ) FROM ta
ae20: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
ae30: 0d 0a 37 34 32 39 0d 0a 38 33 36 33 0d 0a 39 34  ..7429..8363..94
ae40: 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
ae50: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ae60: 53 54 49 4e 43 54 20 2b 20 2d 20 39 35 20 2b 20  STINCT + - 95 + 
ae70: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
ae80: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
ae90: 36 0d 0a 2d 36 34 0d 0a 2d 37 38 0d 0a 0d 0a 71  6..-64..-78....q
aea0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
aeb0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
aec0: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col1 + + col0 * 
aed0: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
aee0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
aef0: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 30 35  ..----..104..105
af00: 33 0d 0a 36 35 30 0d 0a 0d 0a 71 75 65 72 79 20  3..650....query 
af10: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
af20: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
af30: 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20  * col1 * - col1 
af40: 2b 20 2d 20 34 20 2b 20 63 6f 6c 31 20 2a 20 63  + - 4 + col1 * c
af50: 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 36 35 20  or0.col2 * + 65 
af60: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
af70: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
af80: 0a 2d 31 37 31 38 31 32 0d 0a 31 39 31 35 35 0d  .-171812..19155.
af90: 0a 34 37 36 37 34 0d 0a 0d 0a 71 75 65 72 79 20  .47674....query 
afa0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
afb0: 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b  T ALL + - col1 +
afc0: 20 63 6f 6c 31 20 2b 20 35 31 20 46 52 4f 4d 20   col1 + 51 FROM 
afd0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
afe0: 0a 35 31 0d 0a 35 31 0d 0a 35 31 0d 0a 0d 0a 71  .51..51..51....q
aff0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
b000: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33 35 20  SELECT ALL + 35 
b010: 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
b020: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
b030: 0d 0a 31 31 33 0d 0a 31 31 34 0d 0a 34 32 0d 0a  ..113..114..42..
b040: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b050: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
b060: 43 54 20 2b 20 31 33 20 2b 20 2b 20 63 6f 72 30  CT + 13 + + cor0
b070: 2e 63 6f 6c 30 20 2a 20 2d 20 34 37 20 2b 20 2b  .col0 * - 47 + +
b080: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f   col0 * col0 FRO
b090: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
b0a0: 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 31 31 30 31  ----..-119..1101
b0b0: 0d 0a 32 36 35 33 0d 0a 0d 0a 71 75 65 72 79 20  ..2653....query 
b0c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b0d0: 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e  T DISTINCT tab0.
b0e0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
b0f0: 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
b100: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  r0..----..86..91
b110: 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..97....query I 
b120: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b130: 32 35 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  25 * - col1 + co
b140: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
b150: 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 32 31 38 34  --..-2064..-2184
b160: 0d 0a 2d 32 33 32 38 0d 0a 0d 0a 73 6b 69 70 69  ..-2328....skipi
b170: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
b180: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
b190: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
b1a0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
b1b0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
b1c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
b1d0: 49 4e 43 54 20 32 32 20 63 6f 6c 30 20 46 52 4f  INCT 22 col0 FRO
b1e0: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32  M tab2..----..22
b1f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b200: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
b210: 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20  INCT - + col2 * 
b220: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
b230: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
b240: 2d 0d 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36  -..-1..-1089..-6
b250: 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  724....query I r
b260: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
b270: 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2d 20   ( + col2 ) * - 
b280: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
b290: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
b2a0: 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d  9..2028..3002...
b2b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b2c0: 0d 0a 53 45 4c 45 43 54 20 36 38 20 41 53 20 63  ..SELECT 68 AS c
b2d0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
b2e0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
b2f0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
b300: 20 74 6f 20 35 39 39 62 65 65 31 35 61 63 34 63   to 599bee15ac4c
b310: 63 33 39 62 38 35 39 38 35 34 65 30 37 64 66 65  c39b859854e07dfe
b320: 37 39 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7990....query I 
b330: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b340: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20  + col1 + col2 * 
b350: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  - col2 AS col0 F
b360: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
b370: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 33 0d 0a 2d  ..----..-1003..-
b380: 36 36 33 33 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  6633..96....quer
b390: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b3a0: 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 35 37 20  ECT - col1 * 57 
b3b0: 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
b3c0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
b3d0: 0d 0a 2d 31 35 33 36 0d 0a 2d 36 32 37 0d 0a 2d  ..-1536..-627..-
b3e0: 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
b3f0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
b400: 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 35  ISTINCT col1 * 5
b410: 37 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  7 FROM tab1 cor0
b420: 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 35 37  ..----..1482..57
b430: 30 0d 0a 37 34 31 0d 0a 0d 0a 71 75 65 72 79 20  0..741....query 
b440: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b450: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
b460: 31 20 2a 20 2d 20 31 36 20 2a 20 2b 20 39 34 20  1 * - 16 * + 94 
b470: 2b 20 63 6f 6c 30 20 2a 20 32 37 20 46 52 4f 4d  + col0 * 27 FROM
b480: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
b490: 0d 0a 31 32 39 39 39 32 0d 0a 31 33 39 32 36 37  ..129992..139267
b4a0: 0d 0a 31 34 36 38 33 33 0d 0a 0d 0a 71 75 65 72  ..146833....quer
b4b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
b4c0: 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
b4d0: 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 38  1 + - col1 * + 8
b4e0: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
b4f0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
b500: 2d 0d 0a 2d 36 38 38 30 0d 0a 2d 37 32 38 30 0d  -..-6880..-7280.
b510: 0a 2d 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  .-7760....query 
b520: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b530: 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 35 32 20  T ALL col2 * 52 
b540: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
b550: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 36 0d 0a 34  0..----..1716..4
b560: 32 36 34 0d 0a 35 32 0d 0a 0d 0a 6f 6e 6c 79 69  264..52....onlyi
b570: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
b580: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
b590: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
b5a0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
b5b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
b5c0: 62 65 6c 2d 33 31 39 0d 0a 53 45 4c 45 43 54 20  bel-319..SELECT 
b5d0: 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 43  ALL + col1 * + C
b5e0: 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53 20 53  AST( + col1 AS S
b5f0: 49 47 4e 45 44 20 29 20 63 6f 6c 30 20 46 52 4f  IGNED ) col0 FRO
b600: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
b610: 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38 31  ----..7396..8281
b620: 0d 0a 39 34 30 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..9409....skipif
b630: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
b640: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
b650: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
b660: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
b670: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
b680: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
b690: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b6a0: 74 20 6c 61 62 65 6c 2d 33 31 39 0d 0a 53 45 4c  t label-319..SEL
b6b0: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
b6c0: 20 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 31   + CAST ( + col1
b6d0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 63 6f   AS INTEGER ) co
b6e0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
b6f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36  cor0..----..7396
b700: 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a  ..8281..9409....
b710: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
b720: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
b730: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
b740: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
b750: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 30 0d  wsort label-320.
b760: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
b770: 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20 2d 20  cor0.col1 DIV - 
b780: 38 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  84 AS col2 FROM 
b790: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
b7a0: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
b7b0: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
b7c0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
b7d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
b7e0: 62 65 6c 2d 33 32 30 0d 0a 53 45 4c 45 43 54 20  bel-320..SELECT 
b7f0: 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
b800: 31 20 2f 20 2d 20 38 34 20 41 53 20 63 6f 6c 32  1 / - 84 AS col2
b810: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
b820: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
b830: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
b840: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
b850: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
b860: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
b870: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b880: 2d 33 32 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -321..SELECT ALL
b890: 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   + + col0 + - co
b8a0: 6c 31 20 44 49 56 20 2d 20 38 31 20 46 52 4f 4d  l1 DIV - 81 FROM
b8b0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
b8c0: 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 39 30 0d  ---..25..36..90.
b8d0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
b8e0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
b8f0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b900: 74 20 6c 61 62 65 6c 2d 33 32 31 0d 0a 53 45 4c  t label-321..SEL
b910: 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30  ECT ALL + + col0
b920: 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 38 31   + - col1 / - 81
b930: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
b940: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36  r0..----..25..36
b950: 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..90....onlyif m
b960: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
b970: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
b980: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
b990: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
b9a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b9b0: 2d 33 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -322..SELECT DIS
b9c0: 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 43  TINCT col1 + - C
b9d0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
b9e0: 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41  NED ) * + col1 A
b9f0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
ba00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ba10: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
ba20: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
ba30: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
ba40: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 32  owsort label-322
ba50: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
ba60: 54 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20  T col1 + - CAST 
ba70: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
ba80: 52 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  R ) * + col1 AS 
ba90: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
baa0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
bab0: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
bac0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
bad0: 63 6f 6c 31 20 2b 20 2d 20 28 20 63 6f 6c 32 20  col1 + - ( col2 
bae0: 29 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ) * + col1 * - c
baf0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
bb00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33   cor0..----..243
bb10: 39 38 32 0d 0a 36 37 38 39 35 31 0d 0a 39 33 31  982..678951..931
bb20: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
bb30: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
bb40: 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 32 37   + + col0 + - 27
bb50: 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
bb60: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
bb70: 2d 0d 0a 33 33 34 0d 0a 34 33 31 0d 0a 37 30 35  -..334..431..705
bb80: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
bb90: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
bba0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
bbb0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
bbc0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
bbd0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 35  owsort label-325
bbe0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
bbf0: 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
bc00: 53 49 47 4e 45 44 20 29 20 2f 20 63 6f 6c 32 20  SIGNED ) / col2 
bc10: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
bc20: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
bc30: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
bc40: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
bc50: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
bc60: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
bc70: 6c 2d 33 32 35 0d 0a 53 45 4c 45 43 54 20 2d 20  l-325..SELECT - 
bc80: 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55  col2 + CAST ( NU
bc90: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
bca0: 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  / col2 AS col2 F
bcb0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
bcc0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
bcd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
bce0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 32  ort..SELECT - 42
bcf0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
bd00: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
bd10: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 31  0..----..-15..-1
bd20: 36 0d 0a 2d 34 0d 0a 0d 0a 71 75 65 72 79 20 49  6..-4....query I
bd30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bd40: 20 2b 20 33 32 20 2b 20 63 6f 6c 30 20 46 52 4f   + 32 + col0 FRO
bd50: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
bd60: 2d 0d 0a 31 32 31 0d 0a 35 36 0d 0a 36 37 0d 0a  -..121..56..67..
bd70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bd80: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
bd90: 37 36 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  76 + + col1 FROM
bda0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
bdb0: 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 34 35 0d 0a 2d  ---..-17..-45..-
bdc0: 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
bdd0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 37  wsort..SELECT 17
bde0: 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
bdf0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  0 cor0..----..14
be00: 36 32 0d 0a 31 35 34 37 0d 0a 31 36 34 39 0d 0a  62..1547..1649..
be10: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
be20: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
be30: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
be40: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
be50: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
be60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
be70: 43 54 20 41 4c 4c 20 2d 20 37 36 20 2a 20 2b 20  CT ALL - 76 * + 
be80: 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
be90: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
bea0: 2d 35 33 32 0d 0a 2d 35 39 32 38 0d 0a 2d 36 30  -532..-5928..-60
beb0: 30 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  04....onlyif mys
bec0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
bed0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
bee0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
bef0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
bf00: 6c 2d 33 33 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-331..SELECT DI
bf10: 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31  STINCT cor0.col1
bf20: 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   DIV - col0 FROM
bf30: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
bf40: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d  ---..-1..-2..-3.
bf50: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
bf60: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
bf70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
bf80: 74 20 6c 61 62 65 6c 2d 33 33 31 0d 0a 53 45 4c  t label-331..SEL
bf90: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
bfa0: 30 2e 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30 20  0.col1 / - col0 
bfb0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
bfc0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d  0..----..-1..-2.
bfd0: 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-3....query I r
bfe0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
bff0: 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 63   col2 + col2 * c
c000: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
c010: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
c020: 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a 39 38  ..2871..7544..98
c030: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c040: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
c050: 6c 31 20 2a 20 32 38 20 2b 20 2b 20 63 6f 72 30  l1 * 28 + + cor0
c060: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
c070: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
c080: 0a 2d 2d 2d 2d 0d 0a 32 34 33 32 0d 0a 32 36 33  .----..2432..263
c090: 37 0d 0a 32 37 35 31 0d 0a 0d 0a 6f 6e 6c 79 69  7..2751....onlyi
c0a0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
c0b0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
c0c0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
c0d0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
c0e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
c0f0: 62 65 6c 2d 33 33 34 0d 0a 53 45 4c 45 43 54 20  bel-334..SELECT 
c100: 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2a 20 2b  ALL ( col1 ) * +
c110: 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e 55   col1 + CAST( NU
c120: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63  LL AS SIGNED ) c
c130: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
c140: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
c150: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
c160: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
c170: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
c180: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
c190: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
c1a0: 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
c1b0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
c1c0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
c1d0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
c1e0: 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  34..SELECT ALL (
c1f0: 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 31   col1 ) * + col1
c200: 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
c210: 53 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 31  S INTEGER ) col1
c220: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
c230: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
c240: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
c250: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
c260: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
c270: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
c280: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
c290: 6f 72 74 20 6c 61 62 65 6c 2d 33 33 35 0d 0a 53  ort label-335..S
c2a0: 45 4c 45 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f  ELECT + + ( + co
c2b0: 6c 32 20 29 20 2a 20 63 6f 6c 32 20 44 49 56 20  l2 ) * col2 DIV 
c2c0: 32 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  20 FROM tab2 AS 
c2d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a  cor0..----..33..
c2e0: 33 36 0d 0a 37 32 0d 0a 0d 0a 73 6b 69 70 69 66  36..72....skipif
c2f0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
c300: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
c310: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
c320: 33 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28  35..SELECT + + (
c330: 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 32   + col2 ) * col2
c340: 20 2f 20 32 30 20 46 52 4f 4d 20 74 61 62 32 20   / 20 FROM tab2 
c350: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
c360: 33 0d 0a 33 36 0d 0a 37 32 0d 0a 0d 0a 73 6b 69  3..36..72....ski
c370: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
c380: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
c390: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c3a0: 45 43 54 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  ECT CAST ( - col
c3b0: 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 52 45  0 * + col2 AS RE
c3c0: 41 4c 20 29 20 2b 20 2d 20 33 36 20 46 52 4f 4d  AL ) + - 36 FROM
c3d0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31   tab0..----..-71
c3e0: 0d 0a 2d 37 33 33 34 0d 0a 2d 38 32 38 0d 0a 0d  ..-7334..-828...
c3f0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
c400: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
c410: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
c420: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
c430: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 37  owsort label-337
c440: 0d 0a 53 45 4c 45 43 54 20 36 20 2a 20 33 20 2a  ..SELECT 6 * 3 *
c450: 20 63 6f 6c 31 20 2b 20 34 20 44 49 56 20 63 6f   col1 + 4 DIV co
c460: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
c470: 2d 2d 0d 0a 31 35 34 38 0d 0a 31 36 33 38 0d 0a  --..1548..1638..
c480: 31 37 34 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  1746....skipif m
c490: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
c4a0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
c4b0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 37  owsort label-337
c4c0: 0d 0a 53 45 4c 45 43 54 20 36 20 2a 20 33 20 2a  ..SELECT 6 * 3 *
c4d0: 20 63 6f 6c 31 20 2b 20 34 20 2f 20 63 6f 6c 30   col1 + 4 / col0
c4e0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
c4f0: 0d 0a 31 35 34 38 0d 0a 31 36 33 38 0d 0a 31 37  ..1548..1638..17
c500: 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  46....query I ro
c510: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
c520: 32 30 20 2b 20 36 32 20 41 53 20 63 6f 6c 31 20  20 + 62 AS col1 
c530: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c540: 30 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a 38 32 0d  0..----..82..82.
c550: 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .82....skipif my
c560: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
c570: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
c580: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
c590: 4c 20 2d 20 2b 20 43 41 53 54 20 28 20 2b 20 63  L - + CAST ( + c
c5a0: 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ol0 AS REAL ) * 
c5b0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  + cor0.col1 * + 
c5c0: 28 20 2b 20 35 37 20 29 20 41 53 20 63 6f 6c 30  ( + 57 ) AS col0
c5d0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
c5e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 34 38 30  r0..----..-36480
c5f0: 0d 0a 2d 34 34 34 36 0d 0a 2d 35 39 32 38 30 0d  ..-4446..-59280.
c600: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
c610: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
c620: 4e 43 54 20 35 20 2d 20 2b 20 63 6f 6c 32 20 46  NCT 5 - + col2 F
c630: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
c640: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 32  ..----..-21..-22
c650: 0d 0a 2d 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-33....query I
c660: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
c670: 20 2d 20 35 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   - 50 * cor0.col
c680: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
c690: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 30  or0..----..-1300
c6a0: 0d 0a 2d 31 33 35 30 0d 0a 2d 31 39 30 30 0d 0a  ..-1350..-1900..
c6b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c6c0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
c6d0: 63 6f 6c 32 20 29 20 2d 20 63 6f 6c 31 20 41 53  col2 ) - col1 AS
c6e0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
c6f0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
c700: 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 71  53..-9..-96....q
c710: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
c720: 53 45 4c 45 43 54 20 34 38 20 2b 20 2d 20 63 6f  SELECT 48 + - co
c730: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
c740: 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
c750: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
c760: 68 61 73 68 69 6e 67 20 74 6f 20 32 66 39 34 33  hashing to 2f943
c770: 36 36 30 36 39 37 36 37 63 30 34 30 35 32 35 66  66069767c040525f
c780: 64 34 34 37 34 39 35 39 64 61 37 0d 0a 0d 0a 6f  d4474959da7....o
c790: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
c7a0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
c7b0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
c7c0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
c7d0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 34 0d 0a  sort label-344..
c7e0: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
c7f0: 2a 20 32 33 20 44 49 56 20 34 38 20 41 53 20 63  * 23 DIV 48 AS c
c800: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
c810: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
c820: 0d 0a 2d 33 39 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  ..-39..0....skip
c830: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
c840: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
c850: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
c860: 2d 33 34 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -344..SELECT - +
c870: 20 63 6f 6c 32 20 2a 20 32 33 20 2f 20 34 38 20   col2 * 23 / 48 
c880: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
c890: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
c8a0: 0a 2d 31 35 0d 0a 2d 33 39 0d 0a 30 0d 0a 0d 0a  .-15..-39..0....
c8b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c8c0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
c8d0: 20 2b 20 34 20 41 53 20 63 6f 6c 30 20 46 52 4f   + 4 AS col0 FRO
c8e0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
c8f0: 2d 2d 2d 2d 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  ----..4....query
c900: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c910: 43 54 20 41 4c 4c 20 2d 20 2d 20 39 31 20 46 52  CT ALL - - 91 FR
c920: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
c930: 2d 2d 0d 0a 39 31 0d 0a 39 31 0d 0a 39 31 0d 0a  --..91..91..91..
c940: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
c950: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
c960: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
c970: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
c980: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
c990: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c9a0: 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  CT + col0 - - co
c9b0: 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f  r0.col1 col2 FRO
c9c0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
c9d0: 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39  ----..137..38..9
c9e0: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
c9f0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
ca00: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
ca10: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
ca20: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
ca30: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34  rowsort label-34
ca40: 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  8..SELECT ALL - 
ca50: 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28 20 2b  col1 * - CAST( +
ca60: 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20   col2 AS SIGNED 
ca70: 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ) + cor0.col0 * 
ca80: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
ca90: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
caa0: 31 33 0d 0a 34 36 36 36 0d 0a 37 36 34 38 0d 0a  13..4666..7648..
cab0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
cac0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
cad0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
cae0: 20 6c 61 62 65 6c 2d 33 34 38 0d 0a 53 45 4c 45   label-348..SELE
caf0: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
cb00: 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20  - CAST ( + col2 
cb10: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
cb20: 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  or0.col0 * col0 
cb30: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
cb40: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 33 0d 0a 34  0..----..1413..4
cb50: 36 36 36 0d 0a 37 36 34 38 0d 0a 0d 0a 71 75 65  666..7648....que
cb60: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
cb70: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  LECT - col0 * - 
cb80: 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col0 * - cor0.co
cb90: 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30  l0 + col2 * col0
cba0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
cbb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 34 0d 0a  r0..----..-154..
cbc0: 2d 34 37 32 35 32 34 0d 0a 2d 34 39 30 30 33 37  -472524..-490037
cbd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
cbe0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
cbf0: 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 36 34 20 46   + col0 + - 64 F
cc00: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
cc10: 2d 33 35 0d 0a 31 30 0d 0a 32 39 0d 0a 0d 0a 71  -35..10..29....q
cc20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
cc30: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
cc40: 2d 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e 63 6f  - col0 + tab1.co
cc50: 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l1 + - col1 FROM
cc60: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   tab1..----..-3.
cc70: 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65  .-64..-80....que
cc80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
cc90: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
cca0: 63 6f 6c 32 20 2b 20 2d 20 74 61 62 32 2e 63 6f  col2 + - tab2.co
ccb0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
ccc0: 2d 2d 0d 0a 31 34 30 36 0d 0a 36 35 30 0d 0a 37  --..1406..650..7
ccd0: 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
cce0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ccf0: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20  STINCT - col2 + 
cd00: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20  + col0 * col1 * 
cd10: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
cd20: 2d 2d 2d 2d 0d 0a 33 33 39 34 0d 0a 36 36 34 30  ----..3394..6640
cd30: 33 36 0d 0a 36 38 30 37 39 0d 0a 0d 0a 71 75 65  36..68079....que
cd40: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
cd50: 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LECT + col1 * + 
cd60: 36 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  60 FROM tab1..--
cd70: 2d 2d 0d 0a 31 35 36 30 0d 0a 36 30 30 0d 0a 37  --..1560..600..7
cd80: 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
cd90: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
cda0: 2b 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c  + col2 * ( - col
cdb0: 31 20 29 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 ) + col1 * col
cdc0: 31 20 2a 20 2b 20 31 34 20 46 52 4f 4d 20 74 61  1 * + 14 FROM ta
cdd0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
cde0: 0d 0a 31 31 31 38 0d 0a 38 30 36 30 0d 0a 38 33  ..1118..8060..83
cdf0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
ce00: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ce10: 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + - col0 * - co
ce20: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
ce30: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
ce40: 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37  --..1040..640..7
ce50: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
ce60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ce70: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a   + col1 * col2 *
ce80: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
ce90: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
cea0: 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32 35 39  ----..10982..259
ceb0: 34 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 71 75 65  47..90506....que
cec0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ced0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
cee0: 2d 20 63 6f 6c 30 20 2a 20 2d 20 33 30 20 41 53  - col0 * - 30 AS
cef0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
cf00: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
cf10: 31 30 0d 0a 32 33 34 30 0d 0a 32 33 37 30 0d 0a  10..2340..2370..
cf20: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cf30: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
cf40: 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 2a 20  col0 - - col1 * 
cf50: 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
cf60: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
cf70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d  or0..----..1328.
cf80: 0a 31 34 30 37 0d 0a 36 33 34 0d 0a 0d 0a 71 75  .1407..634....qu
cf90: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
cfa0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
cfb0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63   - cor0.col2 - c
cfc0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
cfd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
cfe0: 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a 0d 0a  4..-117..-34....
cff0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
d000: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
d010: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
d020: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
d030: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
d040: 72 74 20 6c 61 62 65 6c 2d 33 36 31 0d 0a 53 45  rt label-361..SE
d050: 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
d060: 6c 30 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l0 + CAST( NULL 
d070: 41 53 20 44 45 43 49 4d 41 4c 20 29 20 41 53 20  AS DECIMAL ) AS 
d080: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
d090: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
d0a0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
d0b0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
d0c0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
d0d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d0e0: 20 6c 61 62 65 6c 2d 33 36 31 0d 0a 53 45 4c 45   label-361..SELE
d0f0: 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  CT + + cor0.col0
d100: 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
d110: 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 30  S REAL ) AS col0
d120: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
d130: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
d140: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
d150: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d160: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
d170: 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29  ol2 + ( - col1 )
d180: 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 32 31 20 41   * - col0 * 21 A
d190: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
d1a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d1b0: 31 37 30 31 36 31 0d 0a 34 33 33 37 37 0d 0a 37  170161..43377..7
d1c0: 31 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1296....query I 
d1d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d1e0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20  DISTINCT col1 * 
d1f0: 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53  + col2 + col1 AS
d200: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
d210: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
d220: 39 34 0d 0a 32 39 32 34 0d 0a 37 35 35 33 0d 0a  94..2924..7553..
d230: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d240: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
d250: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  CT - col0 * col1
d260: 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20 2a 20   + - ( col0 ) * 
d270: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
d280: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
d290: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 32 0d 0a 2d  ..----..-1272..-
d2a0: 33 33 36 30 0d 0a 2d 38 30 31 0d 0a 0d 0a 71 75  3360..-801....qu
d2b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d2c0: 45 4c 45 43 54 20 36 34 20 2b 20 2d 20 63 6f 6c  ELECT 64 + - col
d2d0: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
d2e0: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
d2f0: 2d 31 34 0d 0a 2d 31 35 0d 0a 35 37 0d 0a 0d 0a  -14..-15..57....
d300: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d310: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
d320: 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f   col0 * - ( + co
d330: 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l1 ) AS col1 FRO
d340: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
d350: 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31 30 35  ----..-104..-105
d360: 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 6f 6e 6c 79 69  3..-650....onlyi
d370: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
d380: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
d390: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
d3a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d3b0: 20 6c 61 62 65 6c 2d 33 36 37 0d 0a 53 45 4c 45   label-367..SELE
d3c0: 43 54 20 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f  CT - col0 DIV co
d3d0: 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l1 + - col0 FROM
d3e0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
d3f0: 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 39 0d 0a 2d 38  ---..-7..-79..-8
d400: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
d410: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
d420: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
d430: 6f 72 74 20 6c 61 62 65 6c 2d 33 36 37 0d 0a 53  ort label-367..S
d440: 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 63  ELECT - col0 / c
d450: 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f  ol1 + - col0 FRO
d460: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
d470: 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 39 0d 0a 2d  ----..-7..-79..-
d480: 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  83....skipif pos
d490: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
d4a0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
d4b0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
d4c0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
d4d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d4e0: 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20  SELECT col2 + + 
d4f0: 32 35 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  25 col0 FROM tab
d500: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
d510: 0a 35 31 0d 0a 35 32 0d 0a 36 33 0d 0a 0d 0a 71  .51..52..63....q
d520: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d530: 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
d540: 6c 31 20 2a 20 35 34 20 41 53 20 63 6f 6c 32 20  l1 * 54 AS col2 
d550: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
d560: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 34 0d 0a  0..----..-1404..
d570: 2d 35 34 30 0d 0a 2d 37 30 32 0d 0a 0d 0a 71 75  -540..-702....qu
d580: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d590: 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31 20  ELECT tab1.col1 
d5a0: 2a 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63  * tab1.col1 AS c
d5b0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
d5c0: 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a 36  ---..100..169..6
d5d0: 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
d5e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
d5f0: 53 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 31  STINCT tab0.col1
d600: 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
d610: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
d620: 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
d630: 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  .-8099....query 
d640: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d650: 54 20 2d 20 32 20 46 52 4f 4d 20 74 61 62 32 2c  T - 2 FROM tab2,
d660: 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74   tab2 AS cor0, t
d670: 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab2 AS cor1, tab
d680: 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  0 AS cor2..----.
d690: 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68 69  .81 values hashi
d6a0: 6e 67 20 74 6f 20 66 62 62 64 63 36 39 65 64 34  ng to fbbdc69ed4
d6b0: 62 63 39 61 36 38 66 34 34 64 31 62 61 38 36 37  bc9a68f44d1ba867
d6c0: 62 36 32 30 62 33 0d 0a 0d 0a 71 75 65 72 79 20  b620b3....query 
d6d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d6e0: 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 28 20 63  T + + col1 + ( c
d6f0: 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  or0.col1 + cor0.
d700: 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46  col2 ) AS col2 F
d710: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
d720: 0d 0a 2d 2d 2d 2d 0d 0a 31 39 35 0d 0a 32 30 35  ..----..195..205
d730: 0d 0a 32 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..264....query I
d740: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
d750: 20 41 4c 4c 20 2b 20 28 20 2b 20 63 6f 6c 32 20   ALL + ( + col2 
d760: 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ) * - cor0.col1 
d770: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
d780: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
d790: 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
d7a0: 35 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  570....onlyif my
d7b0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
d7c0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
d7d0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
d7e0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
d7f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d800: 33 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  375..SELECT DIST
d810: 49 4e 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20  INCT CAST( NULL 
d820: 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20  AS SIGNED ) + - 
d830: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col0 * + col1 + 
d840: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
d850: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
d860: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
d870: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
d880: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
d890: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d8a0: 33 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  375..SELECT DIST
d8b0: 49 4e 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  INCT CAST ( NULL
d8c0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
d8d0: 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20  - col0 * + col1 
d8e0: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
d8f0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
d900: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ---..NULL....onl
d910: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
d920: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
d930: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
d940: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
d950: 72 74 20 6c 61 62 65 6c 2d 33 37 36 0d 0a 53 45  rt label-376..SE
d960: 4c 45 43 54 20 2d 20 38 34 20 44 49 56 20 33 33  LECT - 84 DIV 33
d970: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
d980: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
d990: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 2d 35  0..----..-56..-5
d9a0: 39 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b 69 70 69 66  9..-98....skipif
d9b0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d9c0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d9d0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d9e0: 37 36 0d 0a 53 45 4c 45 43 54 20 2d 20 38 34 20  76..SELECT - 84 
d9f0: 2f 20 33 33 20 2d 20 63 6f 6c 32 20 41 53 20 63  / 33 - col2 AS c
da00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
da10: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36   cor0..----..-56
da20: 0d 0a 2d 35 39 0d 0a 2d 39 38 0d 0a 0d 0a 6f 6e  ..-59..-98....on
da30: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
da40: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
da50: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
da60: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
da70: 6f 72 74 20 6c 61 62 65 6c 2d 33 37 37 0d 0a 53  ort label-377..S
da80: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
da90: 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2d   cor0.col2 DIV -
daa0: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 46   col2 + - col2 F
dab0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
dac0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 33 34 0d  ..----..-2..-34.
dad0: 0a 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-83....skipif m
dae0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
daf0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
db00: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 37  owsort label-377
db10: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
db20: 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20  T + cor0.col2 / 
db30: 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  - col2 + - col2 
db40: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
db50: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 33 34  0..----..-2..-34
db60: 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-83....query I
db70: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
db80: 20 2b 20 2d 20 32 39 20 2a 20 2d 20 63 6f 72 30   + - 29 * - cor0
db90: 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63  .col2 + col1 * c
dba0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
dbb0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   cor0..----..106
dbc0: 35 39 0d 0a 38 33 35 33 0d 0a 39 34 33 38 0d 0a  59..8353..9438..
dbd0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
dbe0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
dbf0: 20 2b 20 35 36 20 2b 20 63 6f 6c 31 20 46 52 4f   + 56 + col1 FRO
dc00: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 32  M tab2..----..42
dc10: 33 0d 0a 34 34 32 37 0d 0a 34 34 34 31 0d 0a 0d  3..4427..4441...
dc20: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
dc30: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
dc40: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
dc50: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
dc60: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
dc70: 6f 72 74 20 6c 61 62 65 6c 2d 33 38 30 0d 0a 53  ort label-380..S
dc80: 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55  ELECT - CAST( NU
dc90: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
dca0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
dcb0: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
dcc0: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
dcd0: 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39  ashing to cd7a79
dce0: 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61 66  01e47c15155404af
dcf0: 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b  f0d216fe0b....sk
dd00: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
dd10: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
dd20: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
dd30: 65 6c 2d 33 38 30 0d 0a 53 45 4c 45 43 54 20 2d  el-380..SELECT -
dd40: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
dd50: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
dd60: 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
dd70: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
dd80: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
dd90: 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37  g to cd7a7901e47
dda0: 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31  c15155404aff0d21
ddb0: 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49  6fe0b....query I
ddc0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ddd0: 20 41 4c 4c 20 2b 20 31 31 20 41 53 20 63 6f 6c   ALL + 11 AS col
dde0: 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
ddf0: 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
de00: 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
de10: 20 68 61 73 68 69 6e 67 20 74 6f 20 36 39 31 31   hashing to 6911
de20: 36 37 33 37 66 33 66 35 37 65 32 65 33 32 37 33  6737f3f57e2e3273
de30: 66 36 64 62 62 30 34 64 30 33 36 63 0d 0a 0d 0a  f6dbb04d036c....
de40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
de50: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
de60: 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 37 35 20 2a   - col2 * - 75 *
de70: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
de80: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
de90: 2d 2d 2d 2d 0d 0a 2d 32 35 32 38 0d 0a 2d 35 34  ----..-2528..-54
dea0: 37 32 35 39 0d 0a 2d 35 39 33 31 34 0d 0a 0d 0a  7259..-59314....
deb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
dec0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 36  .SELECT ALL - 86
ded0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
dee0: 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 33  1..----..-29..-3
def0: 32 0d 0a 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..10....onlyif 
df00: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
df10: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
df20: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
df30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
df40: 61 62 65 6c 2d 33 38 34 0d 0a 53 45 4c 45 43 54  abel-384..SELECT
df50: 20 2d 20 63 6f 6c 30 20 44 49 56 20 28 20 2b 20   - col0 DIV ( + 
df60: 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46  col1 ) AS col2 F
df70: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
df80: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
df90: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
dfa0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
dfb0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
dfc0: 33 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  384..SELECT - co
dfd0: 6c 30 20 2f 20 28 20 2b 20 63 6f 6c 31 20 29 20  l0 / ( + col1 ) 
dfe0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
dff0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
e000: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
e010: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
e020: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
e030: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
e040: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
e050: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e060: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
e070: 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 63 6f  col1 + - col0 co
e080: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
e090: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 34  cor0..----..2814
e0a0: 0d 0a 36 32 0d 0a 37 33 37 33 0d 0a 0d 0a 73 6b  ..62..7373....sk
e0b0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
e0c0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
e0d0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
e0e0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
e0f0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
e100: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
e110: 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30   + col2 + + col0
e120: 20 2a 20 34 31 20 2d 20 2b 20 63 6f 6c 32 20 2a   * 41 - + col2 *
e130: 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   - col2 col0 FRO
e140: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
e150: 2d 2d 2d 2d 0d 0a 33 38 34 38 0d 0a 34 36 34 35  ----..3848..4645
e160: 0d 0a 39 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..989....query I
e170: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e180: 20 41 4c 4c 20 2b 20 2d 20 28 20 2b 20 63 6f 6c   ALL + - ( + col
e190: 31 20 29 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63  1 ) + ( - cor0.c
e1a0: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol2 ) FROM tab2 
e1b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d  cor0..----..-55.
e1c0: 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 6f 6e 6c  .-58..-85....onl
e1d0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
e1e0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
e1f0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
e200: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
e210: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e220: 6c 61 62 65 6c 2d 33 38 38 0d 0a 53 45 4c 45 43  label-388..SELEC
e230: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34 33 20  T DISTINCT - 43 
e240: 2a 20 63 6f 6c 30 20 2f 20 43 41 53 54 28 20 4e  * col0 / CAST( N
e250: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
e260: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
e270: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
e280: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
e290: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
e2a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e2b0: 6c 61 62 65 6c 2d 33 38 38 0d 0a 53 45 4c 45 43  label-388..SELEC
e2c0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 34 33 20  T DISTINCT - 43 
e2d0: 2a 20 63 6f 6c 30 20 2f 20 43 41 53 54 20 28 20  * col0 / CAST ( 
e2e0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
e2f0: 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
e300: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
e310: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e320: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
e330: 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63  NCT + - col0 + c
e340: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
e350: 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
e360: 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a  ..-19..-62..24..
e370: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e380: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
e390: 43 54 20 38 33 20 41 53 20 63 6f 6c 30 20 46 52  CT 83 AS col0 FR
e3a0: 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  OM tab2, tab2 AS
e3b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 33 0d   cor0..----..83.
e3c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e3d0: 72 74 0d 0a 53 45 4c 45 43 54 20 32 36 20 2a 20  rt..SELECT 26 * 
e3e0: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  + cor0.col1 FROM
e3f0: 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
e400: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
e410: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
e420: 65 36 38 32 32 61 35 62 65 62 36 30 64 64 30 35  e6822a5beb60dd05
e430: 37 30 30 63 35 65 64 64 32 63 36 38 32 62 36 0d  700c5edd2c682b6.
e440: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e450: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
e460: 4e 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  NCT col2 + col2 
e470: 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f  - + ( col1 ) FRO
e480: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
e490: 34 0d 0a 31 37 39 0d 0a 38 32 0d 0a 0d 0a 71 75  4..179..82....qu
e4a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
e4b0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2d  ELECT ALL col1 -
e4c0: 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2b 20 28 20   - col0 * ( + ( 
e4d0: 63 6f 6c 31 20 29 20 29 20 41 53 20 63 6f 6c 31  col1 ) ) AS col1
e4e0: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
e4f0: 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31  ..2150..3492..81
e500: 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
e510: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 36  wsort..SELECT 46
e520: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
e530: 62 31 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41  b1, tab0, tab1 A
e540: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
e550: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
e560: 74 6f 20 32 66 39 37 39 32 34 62 35 37 62 37 33  to 2f97924b57b73
e570: 31 30 32 32 33 33 64 66 37 63 39 63 65 38 61 64  102233df7c9ce8ad
e580: 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
e590: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
e5a0: 20 28 20 74 61 62 30 2e 63 6f 6c 30 20 29 20 2a   ( tab0.col0 ) *
e5b0: 20 36 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c   61 * + tab0.col
e5c0: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
e5d0: 2d 0d 0a 2d 32 31 33 35 0d 0a 2d 34 34 35 31 37  -..-2135..-44517
e5e0: 38 0d 0a 2d 34 38 33 31 32 0d 0a 0d 0a 71 75 65  8..-48312....que
e5f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e600: 4c 45 43 54 20 2b 20 2b 20 28 20 2b 20 63 6f 6c  LECT + + ( + col
e610: 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 28  2 ) * - col1 + (
e620: 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   + col0 ) AS col
e630: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
e640: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 31 34  or0..----..-2814
e650: 0d 0a 2d 36 32 0d 0a 2d 37 33 37 33 0d 0a 0d 0a  ..-62..-7373....
e660: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e670: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
e680: 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 41   * + tab1.col0 A
e690: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
e6a0: 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34  ..----..162..364
e6b0: 38 0d 0a 37 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  8..7680....onlyi
e6c0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
e6d0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
e6e0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
e6f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e700: 20 6c 61 62 65 6c 2d 33 39 38 0d 0a 53 45 4c 45   label-398..SELE
e710: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 44 49  CT ALL - col1 DI
e720: 56 20 2b 20 28 20 2d 20 35 37 20 29 20 46 52 4f  V + ( - 57 ) FRO
e730: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
e740: 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
e750: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
e760: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
e770: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39  rowsort label-39
e780: 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  8..SELECT ALL - 
e790: 63 6f 6c 31 20 2f 20 2b 20 28 20 2d 20 35 37 20  col1 / + ( - 57 
e7a0: 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
e7b0: 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
e7c0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
e7d0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
e7e0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
e7f0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
e800: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
e810: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
e820: 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 33 38 20 63  LL col0 * + 38 c
e830: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
e840: 2d 2d 2d 0d 0a 32 36 36 0d 0a 32 39 36 34 0d 0a  ---..266..2964..
e850: 33 30 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3002....onlyif m
e860: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
e870: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
e880: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
e890: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e8a0: 62 65 6c 2d 34 30 30 0d 0a 53 45 4c 45 43 54 20  bel-400..SELECT 
e8b0: 63 6f 6c 31 20 44 49 56 20 2d 20 38 30 20 46 52  col1 DIV - 80 FR
e8c0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
e8d0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
e8e0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
e8f0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
e900: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e910: 20 6c 61 62 65 6c 2d 34 30 30 0d 0a 53 45 4c 45   label-400..SELE
e920: 43 54 20 63 6f 6c 31 20 2f 20 2d 20 38 30 20 46  CT col1 / - 80 F
e930: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
e940: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
e950: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e960: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 36 20  rt..SELECT + 66 
e970: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
e980: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
e990: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
e9a0: 32 39 37 39 34 39 31 35 62 35 38 35 65 65 61 38  29794915b585eea8
e9b0: 34 38 61 64 36 37 30 30 37 35 34 35 32 63 38 38  48ad670075452c88
e9c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e9d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
e9e0: 20 2b 20 28 20 2b 20 36 39 20 29 20 46 52 4f 4d   + ( + 69 ) FROM
e9f0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   tab0..----..104
ea00: 0d 0a 31 35 38 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c  ..158..93....onl
ea10: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
ea20: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
ea30: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
ea40: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
ea50: 72 74 20 6c 61 62 65 6c 2d 34 30 33 0d 0a 53 45  rt label-403..SE
ea60: 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  LECT - cor0.col1
ea70: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44   + + cor0.col2 D
ea80: 49 56 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f  IV cor0.col1 FRO
ea90: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
eaa0: 2d 0d 0a 2d 32 34 0d 0a 2d 35 0d 0a 2d 36 0d 0a  -..-24..-5..-6..
eab0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
eac0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
ead0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
eae0: 20 6c 61 62 65 6c 2d 34 30 33 0d 0a 53 45 4c 45   label-403..SELE
eaf0: 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  CT - cor0.col1 +
eb00: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 63   + cor0.col2 / c
eb10: 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
eb20: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
eb30: 32 34 0d 0a 2d 35 0d 0a 2d 36 0d 0a 0d 0a 6f 6e  24..-5..-6....on
eb40: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
eb50: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
eb60: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
eb70: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
eb80: 6f 72 74 20 6c 61 62 65 6c 2d 34 30 34 0d 0a 53  ort label-404..S
eb90: 45 4c 45 43 54 20 2d 20 31 30 20 44 49 56 20 32  ELECT - 10 DIV 2
eba0: 34 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  4 FROM tab2 AS c
ebb0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
ebc0: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
ebd0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
ebe0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
ebf0: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 30 34 0d 0a  sort label-404..
ec00: 53 45 4c 45 43 54 20 2d 20 31 30 20 2f 20 32 34  SELECT - 10 / 24
ec10: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
ec20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
ec30: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
ec40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
ec50: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol1 * col1 * col
ec60: 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
ec70: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ec80: 2d 0d 0a 31 30 30 30 0d 0a 31 37 35 37 36 0d 0a  -..1000..17576..
ec90: 32 31 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2197....query I 
eca0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
ecb0: 2d 20 63 6f 6c 30 20 2a 20 36 32 20 41 53 20 63  - col0 * 62 AS c
ecc0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
ecd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33   cor0..----..-43
ece0: 34 0d 0a 2d 34 38 33 36 0d 0a 2d 34 38 39 38 0d  4..-4836..-4898.
ecf0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
ed00: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
ed10: 2a 20 35 33 20 46 52 4f 4d 20 74 61 62 31 20 63  * 53 FROM tab1 c
ed20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36 32 0d  or0..----..2862.
ed30: 0a 33 30 32 31 0d 0a 35 30 38 38 0d 0a 0d 0a 71  .3021..5088....q
ed40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ed50: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
ed60: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col0 + + col2 * 
ed70: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
ed80: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ed90: 2d 32 39 31 33 0d 0a 2d 33 31 38 35 0d 0a 2d 39  -2913..-3185..-9
eda0: 31 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  136....query I r
edb0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
edc0: 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 31 39 20 2a   - col2 * - 19 *
edd0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
ede0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
edf0: 32 32 37 34 0d 0a 31 35 39 30 33 0d 0a 32 39 31  2274..15903..291
ee00: 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  46....onlyif mys
ee10: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
ee20: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
ee30: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
ee40: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
ee50: 6c 2d 34 31 30 0d 0a 53 45 4c 45 43 54 20 38 37  l-410..SELECT 87
ee60: 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   DIV - col0 FROM
ee70: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
ee80: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 32 39  ---..-1..-1..-29
ee90: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
eea0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
eeb0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
eec0: 72 74 20 6c 61 62 65 6c 2d 34 31 30 0d 0a 53 45  rt label-410..SE
eed0: 4c 45 43 54 20 38 37 20 2f 20 2d 20 63 6f 6c 30  LECT 87 / - col0
eee0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
eef0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
ef00: 0d 0a 2d 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-29....query I
ef10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ef20: 20 2b 20 2d 20 31 20 2a 20 2d 20 35 37 20 2a 20   + - 1 * - 57 * 
ef30: 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  - col2 FROM tab1
ef40: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ef50: 2d 33 30 37 38 0d 0a 2d 33 32 34 39 0d 0a 2d 35  -3078..-3249..-5
ef60: 34 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  472....query I r
ef70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
ef80: 20 2d 20 37 30 20 2a 20 63 6f 6c 30 20 41 53 20   - 70 * col0 AS 
ef90: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
efa0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39  S cor0..----..49
efb0: 30 0d 0a 35 34 36 30 0d 0a 35 35 33 30 0d 0a 0d  0..5460..5530...
efc0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
efd0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
efe0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
eff0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
f000: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 33  owsort label-413
f010: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
f020: 32 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20 63  2 DIV + col1 + c
f030: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f  ol0 * - col0 FRO
f040: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
f050: 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37 39 32 31  225..-576..-7921
f060: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
f070: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
f080: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
f090: 72 74 20 6c 61 62 65 6c 2d 34 31 33 0d 0a 53 45  rt label-413..SE
f0a0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20  LECT ALL col2 / 
f0b0: 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20  + col1 + col0 * 
f0c0: 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
f0d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d  ..----..-1225..-
f0e0: 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 6f 6e  576..-7921....on
f0f0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
f100: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
f110: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
f120: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
f130: 6f 72 74 20 6c 61 62 65 6c 2d 34 31 34 0d 0a 53  ort label-414..S
f140: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
f150: 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   DIV col1 + col2
f160: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
f170: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
f180: 0a 31 30 34 0d 0a 31 31 39 0d 0a 33 34 0d 0a 0d  .104..119..34...
f190: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
f1a0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
f1b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
f1c0: 6c 61 62 65 6c 2d 34 31 34 0d 0a 53 45 4c 45 43  label-414..SELEC
f1d0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f 20 63  T ALL + col2 / c
f1e0: 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol1 + col2 + col
f1f0: 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
f200: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a  ab2..----..104..
f210: 31 31 39 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70 69  119..34....skipi
f220: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
f230: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
f240: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
f250: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
f260: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
f270: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
f280: 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 63   * + tab0.col2 c
f290: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
f2a0: 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d  ---..2838..7462.
f2b0: 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .97....onlyif my
f2c0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
f2d0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
f2e0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
f2f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f300: 65 6c 2d 34 31 36 0d 0a 53 45 4c 45 43 54 20 2b  el-416..SELECT +
f310: 20 2b 20 33 33 20 2b 20 63 6f 72 30 2e 63 6f 6c   + 33 + cor0.col
f320: 30 20 2b 20 32 34 20 44 49 56 20 28 20 2d 20 63  0 + 24 DIV ( - c
f330: 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
f340: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f350: 0a 2d 2d 2d 2d 0d 0a 31 31 31 0d 0a 31 31 31 0d  .----..111..111.
f360: 0a 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .40....skipif my
f370: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
f380: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
f390: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 31 36 0d  wsort label-416.
f3a0: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 33 33 20 2b  .SELECT + + 33 +
f3b0: 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 32 34 20   cor0.col0 + 24 
f3c0: 2f 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20  / ( - col1 ) AS 
f3d0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
f3e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
f3f0: 31 0d 0a 31 31 31 0d 0a 34 30 0d 0a 0d 0a 71 75  1..111..40....qu
f400: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f410: 45 4c 45 43 54 20 2b 20 33 34 20 2b 20 2b 20 63  ELECT + 34 + + c
f420: 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol0 * col2 + col
f430: 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
f440: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
f450: 32 35 30 0d 0a 33 37 33 39 0d 0a 37 38 31 30 0d  250..3739..7810.
f460: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f470: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
f480: 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  NCT col1 * col2 
f490: 2b 20 2d 20 33 36 20 46 52 4f 4d 20 74 61 62 30  + - 36 FROM tab0
f4a0: 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 32 0d 0a 36 31  ..----..2802..61
f4b0: 0d 0a 37 34 32 36 0d 0a 0d 0a 71 75 65 72 79 20  ..7426....query 
f4c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f4d0: 54 20 2d 20 28 20 63 6f 6c 30 20 29 20 2d 20 2b  T - ( col0 ) - +
f4e0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
f4f0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
f500: 31 37 38 0d 0a 2d 34 38 0d 0a 2d 37 30 0d 0a 0d  178..-48..-70...
f510: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
f520: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
f530: 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 29 20 2b   - tab1.col1 ) +
f540: 20 36 31 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f   61 + + col1 FRO
f550: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
f560: 33 0d 0a 38 31 0d 0a 38 37 0d 0a 0d 0a 71 75 65  3..81..87....que
f570: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f580: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
f590: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col0 * - col0 + 
f5a0: 2d 20 35 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  - 5 + + col1 FRO
f5b0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 30  M tab1..----..30
f5c0: 0d 0a 34 31 30 31 0d 0a 36 34 30 38 0d 0a 0d 0a  ..4101..6408....
f5d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f5e0: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 36 33 20 41  .SELECT + - 63 A
f5f0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
f600: 2c 20 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72  , tab2, tab2 cor
f610: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
f620: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 63  es hashing to fc
f630: 30 62 35 33 33 63 32 37 37 33 61 30 61 38 30 32  0b533c2773a0a802
f640: 65 31 66 63 38 33 31 37 64 63 65 62 66 32 0d 0a  e1fc8317dcebf2..
f650: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
f660: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
f670: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
f680: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
f690: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
f6a0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f6b0: 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31  CT col2 * - col1
f6c0: 20 2b 20 30 20 2b 20 63 6f 6c 31 20 63 6f 6c 32   + 0 + col1 col2
f6d0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
f6e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 35 0d  r0..----..-1235.
f6f0: 0a 2d 31 33 37 38 0d 0a 2d 35 36 30 0d 0a 0d 0a  .-1378..-560....
f700: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f710: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
f720: 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63 6f   ( + col1 ) + co
f730: 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l2 * cor0.col1 A
f740: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
f750: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f760: 31 31 38 31 0d 0a 31 34 32 37 0d 0a 35 31 36 0d  1181..1427..516.
f770: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f780: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
f790: 6f 6c 31 20 2a 20 2d 20 35 39 20 46 52 4f 4d 20  ol1 * - 59 FROM 
f7a0: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
f7b0: 0a 2d 31 30 30 33 0d 0a 2d 31 38 32 39 0d 0a 2d  .-1003..-1829..-
f7c0: 33 34 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3481....query I 
f7d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f7e0: 44 49 53 54 49 4e 43 54 20 36 36 20 41 53 20 63  DISTINCT 66 AS c
f7f0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol2 FROM tab2, t
f800: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f810: 2d 0d 0a 36 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -..66....onlyif 
f820: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
f830: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
f840: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
f850: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
f860: 61 62 65 6c 2d 34 32 37 0d 0a 53 45 4c 45 43 54  abel-427..SELECT
f870: 20 63 6f 6c 32 20 44 49 56 20 37 30 20 2b 20 2b   col2 DIV 70 + +
f880: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
f890: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab1..----..3
f8a0: 0d 0a 36 34 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70  ..64..81....skip
f8b0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
f8c0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
f8d0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
f8e0: 2d 34 32 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  -427..SELECT col
f8f0: 32 20 2f 20 37 30 20 2b 20 2b 20 63 6f 6c 30 20  2 / 70 + + col0 
f900: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
f910: 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a  1..----..3..64..
f920: 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  81....onlyif mys
f930: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
f940: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
f950: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
f960: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
f970: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
f980: 32 38 0d 0a 53 45 4c 45 43 54 20 2b 20 38 35 20  28..SELECT + 85 
f990: 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  - + col2 * + col
f9a0: 31 20 2a 20 43 41 53 54 28 20 2d 20 37 32 20 41  1 * CAST( - 72 A
f9b0: 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
f9c0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
f9d0: 2d 2d 0d 0a 31 30 31 31 37 33 0d 0a 34 31 31 32  --..101173..4112
f9e0: 35 0d 0a 38 39 39 34 31 0d 0a 0d 0a 73 6b 69 70  5..89941....skip
f9f0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
fa00: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
fa10: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
fa20: 2d 34 32 38 0d 0a 53 45 4c 45 43 54 20 2b 20 38  -428..SELECT + 8
fa30: 35 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  5 - + col2 * + c
fa40: 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 2d 20 37  ol1 * CAST ( - 7
fa50: 32 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  2 AS INTEGER ) F
fa60: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
fa70: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 31 37 33 0d 0a  ..----..101173..
fa80: 34 31 31 32 35 0d 0a 38 39 39 34 31 0d 0a 0d 0a  41125..89941....
fa90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
faa0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
fab0: 20 2d 20 2b 20 37 37 20 41 53 20 63 6f 6c 30 20   - + 77 AS col0 
fac0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
fad0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 37 0d 0a 0d 0a  0..----..-77....
fae0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
faf0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
fb00: 6c 31 20 2a 20 35 30 20 41 53 20 63 6f 6c 30 20  l1 * 50 AS col0 
fb10: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
fb20: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 35 30 0d 0a  0..----..-1550..
fb30: 2d 32 39 35 30 0d 0a 2d 38 35 30 0d 0a 0d 0a 71  -2950..-850....q
fb40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
fb50: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
fb60: 2b 20 63 6f 6c 32 20 2a 20 34 35 20 2a 20 63 6f  + col2 * 45 * co
fb70: 72 30 2e 63 6f 6c 31 20 2b 20 32 31 20 2a 20 2b  r0.col1 + 21 * +
fb80: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
fb90: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
fba0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 34  cor0..----..1284
fbb0: 30 33 0d 0a 33 33 37 35 31 32 0d 0a 34 33 38 36  03..337512..4386
fbc0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
fbd0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
fbe0: 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  col0 - col2 * - 
fbf0: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
fc00: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
fc10: 2d 2d 2d 2d 0d 0a 30 0d 0a 37 32 30 39 0d 0a 37  ----..0..7209..7
fc20: 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  68....onlyif mys
fc30: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
fc40: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
fc50: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
fc60: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
fc70: 6c 2d 34 33 33 0d 0a 53 45 4c 45 43 54 20 41 4c  l-433..SELECT AL
fc80: 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  L + col0 * + col
fc90: 32 20 2b 20 63 6f 6c 32 20 2a 20 34 39 20 44 49  2 + col2 * 49 DI
fca0: 56 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  V + col0 col0 FR
fcb0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
fcc0: 0a 2d 2d 2d 2d 0d 0a 31 30 34 34 0d 0a 33 36 39  .----..1044..369
fcd0: 31 0d 0a 37 37 33 38 0d 0a 0d 0a 73 6b 69 70 69  1..7738....skipi
fce0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
fcf0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
fd00: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
fd10: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
fd20: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
fd30: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
fd40: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
fd50: 72 74 20 6c 61 62 65 6c 2d 34 33 33 0d 0a 53 45  rt label-433..SE
fd60: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
fd70: 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  * + col2 + col2 
fd80: 2a 20 34 39 20 2f 20 2b 20 63 6f 6c 30 20 63 6f  * 49 / + col0 co
fd90: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
fda0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 34  cor0..----..1044
fdb0: 0d 0a 33 36 39 31 0d 0a 37 37 33 38 0d 0a 0d 0a  ..3691..7738....
fdc0: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
fdd0: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
fde0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
fdf0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
fe00: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
fe10: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fe20: 20 36 38 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63   68 + col2 * + c
fe30: 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
fe40: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
fe50: 0d 0a 31 31 35 37 0d 0a 36 37 39 32 0d 0a 36 39  ..1157..6792..69
fe60: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
fe70: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
fe80: 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  l2 + col0 + - co
fe90: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
fea0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
feb0: 2d 2d 0d 0a 2d 32 39 0d 0a 2d 33 0d 0a 2d 37 37  --..-29..-3..-77
fec0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
fed0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
fee0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b   + cor0.col2 + +
fef0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
ff00: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
ff10: 34 36 0d 0a 33 0d 0a 39 39 0d 0a 0d 0a 71 75 65  46..3..99....que
ff20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
ff30: 4c 45 43 54 20 33 37 20 2b 20 2d 20 63 6f 6c 32  LECT 37 + - col2
ff40: 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
ff50: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
ff60: 2d 0d 0a 31 33 34 0d 0a 32 38 37 35 0d 0a 37 34  -..134..2875..74
ff70: 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
ff80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
ff90: 2b 20 63 6f 6c 30 20 2b 20 2d 20 31 36 20 2a 20  + col0 + - 16 * 
ffa0: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
ffb0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
ffc0: 2d 31 32 30 30 0d 0a 2d 34 35 0d 0a 2d 39 36 30  -1200..-45..-960
ffd0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ffe0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
fff0: 49 4e 43 54 20 2b 20 31 32 20 41 53 20 63 6f 6c  INCT + 12 AS col
10000 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
10010 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 0d 0a 71 75  ..----..12....qu
10020 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10030 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20 29  ELECT - ( col2 )
10040 20 2a 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f   * ( col0 ) + co
10050 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l2 * + cor0.col0
10060 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
10070 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
10080 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
10090 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
100a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63  T DISTINCT - - c
100b0 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20 37 37 20  ol2 + col2 * 77 
100c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
100d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
100e0 0a 32 35 37 34 0d 0a 36 33 39 36 0d 0a 37 38 0d  .2574..6396..78.
100f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10100 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
10110 20 2d 20 38 36 20 2a 20 63 6f 6c 32 20 2b 20 63   - 86 * col2 + c
10120 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
10130 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
10140 2d 2d 2d 0d 0a 34 36 39 38 0d 0a 34 39 35 39 0d  ---..4698..4959.
10150 0a 38 33 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .8352....query I
10160 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10170 20 35 39 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   59 * cor0.col2 
10180 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
10190 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
101a0 0a 33 31 38 36 0d 0a 33 33 36 33 0d 0a 35 36 36  .3186..3363..566
101b0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
101c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
101d0 20 2d 20 30 20 2b 20 2d 20 63 6f 6c 31 20 41 53   - 0 + - col1 AS
101e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
101f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
10200 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a  86..-91..-97....
10210 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10220 0a 53 45 4c 45 43 54 20 32 37 20 46 52 4f 4d 20  .SELECT 27 FROM 
10230 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30 20  tab1, tab0 cor0 
10240 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d  CROSS JOIN tab0.
10250 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
10260 20 68 61 73 68 69 6e 67 20 74 6f 20 31 61 33 63   hashing to 1a3c
10270 65 66 35 63 33 33 62 38 66 38 37 66 66 65 64 65  ef5c33b8f87ffede
10280 64 33 37 38 66 64 32 30 37 37 35 33 0d 0a 0d 0a  d378fd207753....
10290 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
102a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 34 31  .SELECT ALL - 41
102b0 20 2a 20 2b 20 35 37 20 2a 20 2b 20 63 6f 6c 30   * + 57 * + col0
102c0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
102d0 0d 0a 2d 31 34 39 35 36 38 0d 0a 2d 31 38 36 39  ..-149568..-1869
102e0 36 30 0d 0a 2d 37 30 31 31 0d 0a 0d 0a 6f 6e 6c  60..-7011....onl
102f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
10300 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
10310 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
10320 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
10330 72 74 20 6c 61 62 65 6c 2d 34 34 37 0d 0a 53 45  rt label-447..SE
10340 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
10350 6c 32 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20  l2 DIV - col1 + 
10360 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col2 + + col0 AS
10370 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
10380 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
10390 31 36 0d 0a 31 36 39 0d 0a 35 35 0d 0a 0d 0a 73  16..169..55....s
103a0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
103b0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
103c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
103d0 62 65 6c 2d 34 34 37 0d 0a 53 45 4c 45 43 54 20  bel-447..SELECT 
103e0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2f 20  DISTINCT col2 / 
103f0 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20  - col1 + col2 + 
10400 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
10410 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
10420 0d 0a 2d 2d 2d 2d 0d 0a 31 31 36 0d 0a 31 36 39  ..----..116..169
10430 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..55....query I 
10440 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10450 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col0 * col1 + co
10460 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
10470 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
10480 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39  .2150..3492..819
10490 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
104a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
104b0 54 49 4e 43 54 20 2d 20 2d 20 39 38 20 46 52 4f  TINCT - - 98 FRO
104c0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
104d0 2d 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..98....skipif 
104e0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
104f0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
10500 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
10510 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
10520 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10530 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 31 20 63  t..SELECT - 81 c
10540 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
10550 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 31   cor0..----..-81
10560 0d 0a 2d 38 31 0d 0a 2d 38 31 0d 0a 0d 0a 71 75  ..-81..-81....qu
10570 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10580 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
10590 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b   col1 + col1 * +
105a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
105b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
105c0 30 34 0d 0a 31 30 35 33 0d 0a 36 35 30 0d 0a 0d  04..1053..650...
105d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
105e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
105f0 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  T - col0 * col0 
10600 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  + col1 * + col1 
10610 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
10620 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 39 39 36 0d 0a  0..----..-3996..
10630 2d 36 32 33 31 0d 0a 36 36 37 0d 0a 0d 0a 6f 6e  -6231..667....on
10640 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
10650 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
10660 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
10670 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
10680 6f 72 74 20 6c 61 62 65 6c 2d 34 35 33 0d 0a 53  ort label-453..S
10690 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56  ELECT - col1 DIV
106a0 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20   col2 + col2 AS 
106b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
106c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  S cor0..----..-9
106d0 36 0d 0a 33 31 0d 0a 38 31 0d 0a 0d 0a 73 6b 69  6..31..81....ski
106e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
106f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
10700 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
10710 6c 2d 34 35 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-453..SELECT - 
10720 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 2b 20 63 6f  col1 / col2 + co
10730 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
10740 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
10750 2d 2d 0d 0a 2d 39 36 0d 0a 33 31 0d 0a 38 31 0d  --..-96..31..81.
10760 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10770 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
10780 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  NCT col0 + col0 
10790 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e  * - col0 * cor0.
107a0 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 41 53 20 63  col0 - col0 AS c
107b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
107c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
107d0 38 32 34 0d 0a 2d 34 32 38 37 35 0d 0a 2d 37 30  824..-42875..-70
107e0 34 39 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4969....query I 
107f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10800 63 6f 6c 30 20 2a 20 2d 20 28 20 2d 20 63 6f 6c  col0 * - ( - col
10810 31 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  1 ) * col1 + + c
10820 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
10830 2d 2d 2d 0d 0a 32 32 39 31 30 0d 0a 32 37 31 35  ---..22910..2715
10840 39 36 0d 0a 36 37 33 34 0d 0a 0d 0a 73 6b 69 70  96..6734....skip
10850 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
10860 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
10870 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
10880 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
10890 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
108a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b  sort..SELECT ( +
108b0 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 63 6f 6c   cor0.col1 ) col
108c0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
108d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
108e0 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..97....query I
108f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10900 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
10910 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 + - cor0.col
10920 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  0 * + col2 AS co
10930 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
10940 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39  cor0..----..-159
10950 0d 0a 2d 33 35 38 34 0d 0a 2d 37 36 30 30 0d 0a  ..-3584..-7600..
10960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10970 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
10980 43 54 20 2b 20 32 38 20 2a 20 63 6f 6c 30 20 2b  CT + 28 * col0 +
10990 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
109a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
109b0 32 32 39 0d 0a 32 32 34 33 0d 0a 32 32 37 0d 0a  229..2243..227..
109c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
109d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
109e0 43 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20  CT + - ( + col1 
109f0 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ) * col2 FROM ta
10a00 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10a10 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a  ..-2838..-7462..
10a20 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -97....skipif po
10a30 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
10a40 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
10a50 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
10a60 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
10a70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10a80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
10a90 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + - col1 * + co
10aa0 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30  r0.col2 + + cor0
10ab0 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20  .col2 col2 FROM 
10ac0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
10ad0 2d 2d 0d 0a 2d 31 31 33 39 0d 0a 2d 31 33 32 34  --..-1139..-1324
10ae0 0d 0a 2d 35 30 33 0d 0a 0d 0a 71 75 65 72 79 20  ..-503....query 
10af0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10b00 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 63 6f 6c  T ALL col2 - col
10b10 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
10b20 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
10b30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10b40 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 39 20  rt..SELECT + 29 
10b50 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  + - cor0.col2 AS
10b60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
10b70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
10b80 39 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79  9..2..3....query
10b90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10ba0 43 54 20 44 49 53 54 49 4e 43 54 20 31 35 20 2b  CT DISTINCT 15 +
10bb0 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
10bc0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 32 0d  1..----..-11..2.
10bd0 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .5....query I ro
10be0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 36  wsort..SELECT 46
10bf0 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 2a   * - tab0.col0 *
10c00 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
10c10 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
10c20 2d 2d 0d 0a 2d 31 36 31 30 0d 0a 2d 33 33 35 37  --..-1610..-3357
10c30 30 38 0d 0a 2d 33 36 34 33 32 0d 0a 0d 0a 6f 6e  08..-36432....on
10c40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
10c50 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
10c60 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
10c70 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
10c80 6f 72 74 20 6c 61 62 65 6c 2d 34 36 35 0d 0a 53  ort label-465..S
10c90 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 35 20 44  ELECT ALL + 75 D
10ca0 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46  IV col0 + col2 F
10cb0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
10cc0 32 36 0d 0a 33 37 0d 0a 33 38 0d 0a 0d 0a 73 6b  26..37..38....sk
10cd0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
10ce0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
10cf0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
10d00 65 6c 2d 34 36 35 0d 0a 53 45 4c 45 43 54 20 41  el-465..SELECT A
10d10 4c 4c 20 2b 20 37 35 20 2f 20 63 6f 6c 30 20 2b  LL + 75 / col0 +
10d20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
10d30 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33 37 0d 0a 33  .----..26..37..3
10d40 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
10d50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
10d60 54 49 4e 43 54 20 2b 20 38 37 20 2b 20 63 6f 6c  TINCT + 87 + col
10d70 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
10d80 2d 0d 0a 31 36 35 0d 0a 31 36 36 0d 0a 39 34 0d  -..165..166..94.
10d90 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
10da0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
10db0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
10dc0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
10dd0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
10de0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10df0 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30  ECT ALL - + cor0
10e00 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c  .col2 * col0 col
10e10 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
10e20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a  or0..----..-35..
10e30 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 6f  -7298..-792....o
10e40 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
10e50 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
10e60 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
10e70 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
10e80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10e90 74 20 6c 61 62 65 6c 2d 34 36 38 0d 0a 53 45 4c  t label-468..SEL
10ea0 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 28 20  ECT ALL - CAST( 
10eb0 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
10ec0 29 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 72  ) + + col1 / cor
10ed0 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  0.col2 col2 FROM
10ee0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
10ef0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
10f00 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
10f10 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
10f20 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
10f30 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
10f40 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
10f50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
10f60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
10f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10f80 20 6c 61 62 65 6c 2d 34 36 38 0d 0a 53 45 4c 45   label-468..SELE
10f90 43 54 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20  CT ALL - CAST ( 
10fa0 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b  NULL AS REAL ) +
10fb0 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 72 30 2e 63   + col1 / cor0.c
10fc0 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
10fd0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
10fe0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
10ff0 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
11000 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
11010 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
11020 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
11030 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11040 6c 2d 34 36 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-469..SELECT + 
11050 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 37 35 20  - col2 DIV + 75 
11060 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
11070 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
11080 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
11090 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
110a0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
110b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
110c0 6c 2d 34 36 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-469..SELECT + 
110d0 2d 20 63 6f 6c 32 20 2f 20 2b 20 37 35 20 41 53  - col2 / + 75 AS
110e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
110f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
11100 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  1..0..0....query
11110 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
11120 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20  CT ALL col2 * + 
11130 31 38 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  18 FROM tab2..--
11140 2d 2d 0d 0a 34 36 38 0d 0a 34 38 36 0d 0a 36 38  --..468..486..68
11150 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
11160 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
11170 20 63 6f 6c 31 20 2a 20 36 20 46 52 4f 4d 20 74   col1 * 6 FROM t
11180 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a  ab1..----..156..
11190 36 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  60..78....query 
111a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
111b0 54 20 41 4c 4c 20 2d 20 74 61 62 30 2e 63 6f 6c  T ALL - tab0.col
111c0 30 20 2a 20 2d 20 33 33 20 46 52 4f 4d 20 74 61  0 * - 33 FROM ta
111d0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 35 0d 0a  b0..----..1155..
111e0 32 39 33 37 0d 0a 37 39 32 0d 0a 0d 0a 6f 6e 6c  2937..792....onl
111f0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
11200 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
11210 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
11220 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
11230 72 74 20 6c 61 62 65 6c 2d 34 37 33 0d 0a 53 45  rt label-473..SE
11240 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33 37  LECT DISTINCT 37
11250 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20 2d 20 63   * tab2.col1 - c
11260 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 41 53 20  ol0 DIV col0 AS 
11270 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
11280 2d 2d 2d 2d 0d 0a 31 31 34 36 0d 0a 32 31 38 32  ----..1146..2182
11290 0d 0a 36 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..628....skipif 
112a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
112b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
112c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
112d0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
112e0 43 54 20 33 37 20 2a 20 74 61 62 32 2e 63 6f 6c  CT 37 * tab2.col
112f0 31 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  1 - col0 / col0 
11300 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11310 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 36 0d 0a 32  2..----..1146..2
11320 31 38 32 0d 0a 36 32 38 0d 0a 0d 0a 71 75 65 72  182..628....quer
11330 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11340 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 39 36  ECT ALL - ( - 96
11350 20 29 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   ) - - col1 FROM
11360 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32   tab0..----..182
11370 0d 0a 31 38 37 0d 0a 31 39 33 0d 0a 0d 0a 71 75  ..187..193....qu
11380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11390 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
113a0 20 63 6f 6c 30 20 29 20 2d 20 2b 20 74 61 62 31   col0 ) - + tab1
113b0 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a  .col1 * - col1 *
113c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
113d0 0a 2d 2d 2d 2d 0d 0a 31 30 36 34 0d 0a 31 37 35  .----..1064..175
113e0 37 39 0d 0a 32 32 37 37 0d 0a 0d 0a 71 75 65 72  79..2277....quer
113f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11400 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 30  ECT ALL - ( col0
11410 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   ) + - col1 FROM
11420 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
11430 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a 2d  ---..-29..-74..-
11440 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
11450 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
11460 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col2 + + col0 * 
11470 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  + cor0.col2 AS c
11480 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
11490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35   cor0..----..205
114a0 34 0d 0a 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a  4..216..3040....
114b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
114c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
114d0 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   - cor0.col1 AS 
114e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
114f0 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61  tab0 AS cor0, ta
11500 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b0 AS cor1..----
11510 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d  ..-86..-91..-97.
11520 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11530 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
11540 31 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  1 * + col0 * + c
11550 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
11560 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
11570 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 36 34 31 31  ---..3395..66411
11580 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a 71 75 65 72  8..68112....quer
11590 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
115a0 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63  ECT - col1 * ( c
115b0 6f 6c 32 20 29 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 ) + col1 AS 
115c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
115d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
115e0 34 37 35 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d  475..-629..-806.
115f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11600 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
11610 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 36 33 20  NCT - col2 + 63 
11620 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
11630 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
11640 0a 2d 33 33 0d 0a 36 0d 0a 39 0d 0a 0d 0a 71 75  .-33..6..9....qu
11650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11660 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
11670 20 63 6f 6c 32 20 2a 20 2d 20 38 37 20 46 52 4f   col2 * - 87 FRO
11680 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
11690 2d 2d 2d 2d 0d 0a 2d 32 32 36 32 0d 0a 2d 32 33  ----..-2262..-23
116a0 34 39 0d 0a 2d 33 33 30 36 0d 0a 0d 0a 71 75 65  49..-3306....que
116b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
116c0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d 20 2b 20  LECT + col0 - + 
116d0 32 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  24 AS col1 FROM 
116e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
116f0 2d 2d 0d 0a 2d 32 31 0d 0a 34 30 0d 0a 35 36 0d  --..-21..40..56.
11700 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
11710 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
11720 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
11730 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
11740 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
11750 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11760 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63  ECT - col1 - - c
11770 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 * + cor0.col
11780 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0 col2 FROM tab1
11790 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
117a0 0d 0a 34 30 38 36 0d 0a 36 33 38 37 0d 0a 0d 0a  ..4086..6387....
117b0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
117c0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
117d0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
117e0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
117f0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
11800 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11810 20 2b 20 2b 20 28 20 2b 20 35 36 20 29 20 2a 20   + + ( + 56 ) * 
11820 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
11830 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
11840 2d 2d 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31 39 36  ---..-1344..-196
11850 30 0d 0a 2d 34 39 38 34 0d 0a 0d 0a 71 75 65 72  0..-4984....quer
11860 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11870 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 32 35 20  ECT - col0 * 25 
11880 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11890 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
118a0 0a 2d 31 36 30 30 0d 0a 2d 32 30 30 30 0d 0a 2d  .-1600..-2000..-
118b0 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
118c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
118d0 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 31 2e 63  r0.col1 * cor1.c
118e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
118f0 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
11900 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
11910 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
11920 6e 67 20 74 6f 20 34 33 30 37 61 35 63 36 37 39  ng to 4307a5c679
11930 31 32 65 36 33 63 34 37 62 37 34 32 38 33 63 30  12e63c47b74283c0
11940 39 38 38 62 39 36 0d 0a 0d 0a 71 75 65 72 79 20  988b96....query 
11950 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11960 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  T - col1 * - col
11970 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  2 + cor0.col1 FR
11980 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
11990 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33  .----..1261..143
119a0 30 0d 0a 35 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  0..580....onlyif
119b0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
119c0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
119d0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
119e0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
119f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11a00 65 6c 2d 34 38 39 0d 0a 53 45 4c 45 43 54 20 2b  el-489..SELECT +
11a10 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
11a20 49 47 4e 45 44 20 29 20 2a 20 39 30 20 46 52 4f  IGNED ) * 90 FRO
11a30 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
11a40 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
11a50 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
11a60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
11a70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
11a80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
11a90 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  89..SELECT + CAS
11aa0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
11ab0 47 45 52 20 29 20 2a 20 39 30 20 46 52 4f 4d 20  GER ) * 90 FROM 
11ac0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11ad0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
11ae0 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
11af0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
11b00 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
11b10 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
11b20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11b30 62 65 6c 2d 34 39 30 0d 0a 53 45 4c 45 43 54 20  bel-490..SELECT 
11b40 2b 20 28 20 63 6f 6c 31 20 29 20 44 49 56 20 2b  + ( col1 ) DIV +
11b50 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 33 20 2a   cor0.col1 - 3 *
11b60 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63   ( + col2 ) AS c
11b70 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
11b80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
11b90 33 0d 0a 2d 37 37 0d 0a 2d 38 30 0d 0a 0d 0a 73  3..-77..-80....s
11ba0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
11bb0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
11bc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11bd0 62 65 6c 2d 34 39 30 0d 0a 53 45 4c 45 43 54 20  bel-490..SELECT 
11be0 2b 20 28 20 63 6f 6c 31 20 29 20 2f 20 2b 20 63  + ( col1 ) / + c
11bf0 6f 72 30 2e 63 6f 6c 31 20 2d 20 33 20 2a 20 28  or0.col1 - 3 * (
11c00 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   + col2 ) AS col
11c10 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
11c20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 0d  or0..----..-113.
11c30 0a 2d 37 37 0d 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c  .-77..-80....onl
11c40 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
11c50 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
11c60 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
11c70 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
11c80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11c90 6c 61 62 65 6c 2d 34 39 31 0d 0a 53 45 4c 45 43  label-491..SELEC
11ca0 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  T col0 * col1 + 
11cb0 43 41 53 54 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  CAST( - cor0.col
11cc0 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  2 AS SIGNED ) FR
11cd0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
11ce0 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 35 38 33 0d 0a  .----..24..583..
11cf0 39 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  944....skipif my
11d00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
11d10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
11d20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 31 0d  wsort label-491.
11d30 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63  .SELECT col0 * c
11d40 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 2d 20 63  ol1 + CAST ( - c
11d50 6f 72 30 2e 63 6f 6c 32 20 41 53 20 49 4e 54 45  or0.col2 AS INTE
11d60 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 31 20  GER ) FROM tab1 
11d70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
11d80 34 0d 0a 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 71  4..583..944....q
11d90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11da0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
11db0 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
11dc0 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  1 AS cor0, tab0 
11dd0 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53  AS cor1, tab0 AS
11de0 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   cor2..----..2..
11df0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11e00 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 30 20 2b  t..SELECT + 80 +
11e10 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
11e20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
11e30 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 35 0d  .----..104..115.
11e40 0a 31 36 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .169....onlyif m
11e50 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
11e60 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
11e70 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
11e80 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
11e90 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
11ea0 2d 34 39 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -494..SELECT - c
11eb0 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol0 * CAST( NULL
11ec0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63   AS SIGNED ) + c
11ed0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 * + col0 FRO
11ee0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
11ef0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
11f00 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
11f10 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
11f20 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
11f30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
11f40 39 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  94..SELECT - col
11f50 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  0 * CAST ( NULL 
11f60 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
11f70 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f  ol1 * + col0 FRO
11f80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
11f90 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
11fa0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
11fb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11fc0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 37  T DISTINCT - - 7
11fd0 39 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  9 FROM tab2, tab
11fe0 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  1, tab0 AS cor0.
11ff0 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 0d 0a 71 75 65  .----..79....que
12000 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12010 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e  LECT ALL + tab0.
12020 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46 52  col1 * + col0 FR
12030 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
12040 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
12050 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12060 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
12070 31 20 2a 20 28 20 2b 20 38 31 20 29 20 41 53 20  1 * ( + 81 ) AS 
12080 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
12090 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
120a0 39 36 36 0d 0a 2d 37 33 37 31 0d 0a 2d 37 38 35  966..-7371..-785
120b0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
120c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
120d0 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  1.col2 AS col2 F
120e0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
120f0 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
12100 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
12110 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
12120 20 37 37 38 36 37 31 38 62 64 38 30 34 32 30 32   7786718bd804202
12130 32 35 33 37 33 37 38 64 34 30 65 63 38 37 34 37  2537378d40ec8747
12140 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
12150 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
12160 6f 6c 32 20 2a 20 37 20 41 53 20 63 6f 6c 32 20  ol2 * 7 AS col2 
12170 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
12180 2d 2d 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d 31 38 39  ----..-182..-189
12190 0d 0a 2d 32 36 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..-266....skipif
121a0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
121b0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
121c0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
121d0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
121e0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
121f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
12200 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20 2a   col1 * ( col1 *
12210 20 63 6f 6c 32 20 29 20 2b 20 36 38 20 63 6f 6c   col2 ) + 68 col
12220 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
12230 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 35 30  or0..----..11050
12240 0d 0a 32 36 30 31 35 0d 0a 39 30 35 37 34 0d 0a  ..26015..90574..
12250 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12260 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
12270 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
12280 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12290 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30  rowsort label-50
122a0 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
122b0 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44  CT + cor0.col2 D
122c0 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a  IV col0 + col1 *
122d0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 36   + cor0.col2 - 6
122e0 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  1 col0 FROM tab2
122f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12300 31 34 37 33 0d 0a 35 38 35 0d 0a 37 37 39 0d 0a  1473..585..779..
12310 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
12320 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
12330 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
12340 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
12350 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
12360 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
12370 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
12380 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12390 35 30 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  501..SELECT DIST
123a0 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  INCT + cor0.col2
123b0 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a   / col0 + col1 *
123c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 36   + cor0.col2 - 6
123d0 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  1 col0 FROM tab2
123e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
123f0 31 34 37 33 0d 0a 35 38 35 0d 0a 37 37 39 0d 0a  1473..585..779..
12400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12410 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
12420 63 6f 6c 31 20 2a 20 33 20 41 53 20 63 6f 6c 30  col1 * 3 AS col0
12430 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
12440 0d 0a 32 35 38 0d 0a 32 37 33 0d 0a 32 39 31 0d  ..258..273..291.
12450 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12460 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
12470 4e 43 54 20 28 20 63 6f 6c 30 20 29 20 2b 20 63  NCT ( col0 ) + c
12480 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
12490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38   cor0..----..178
124a0 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79  ..48..70....only
124b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
124c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
124d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
124e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
124f0 74 20 6c 61 62 65 6c 2d 35 30 34 0d 0a 53 45 4c  t label-504..SEL
12500 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
12510 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  2 * - cor0.col1 
12520 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  + + col1 + + col
12530 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 46 52 4f  1 DIV + col0 FRO
12540 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
12550 2d 2d 2d 2d 0d 0a 2d 31 32 33 35 0d 0a 2d 31 33  ----..-1235..-13
12560 37 30 0d 0a 2d 35 36 30 0d 0a 0d 0a 73 6b 69 70  70..-560....skip
12570 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12580 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12590 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
125a0 2d 35 30 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -504..SELECT DIS
125b0 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  TINCT col2 * - c
125c0 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  or0.col1 + + col
125d0 31 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63  1 + + col1 / + c
125e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
125f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
12600 33 35 0d 0a 2d 31 33 37 30 0d 0a 2d 35 36 30 0d  35..-1370..-560.
12610 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12620 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
12630 2a 20 2d 20 37 39 20 2b 20 63 6f 6c 32 20 41 53  * - 79 + col2 AS
12640 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
12650 0a 2d 2d 2d 2d 0d 0a 2d 35 32 36 0d 0a 2d 36 31  .----..-526..-61
12660 33 36 0d 0a 2d 36 32 30 33 0d 0a 0d 0a 71 75 65  36..-6203....que
12670 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12680 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
12690 37 30 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  70 * + col2 AS c
126a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
126b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37   cor0..----..-37
126c0 38 30 0d 0a 2d 33 39 39 30 0d 0a 2d 36 37 32 30  80..-3990..-6720
126d0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
126e0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
126f0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
12700 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
12710 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
12720 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12730 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 37 32  LECT DISTINCT 72
12740 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
12750 0a 2d 2d 2d 2d 0d 0a 37 32 0d 0a 0d 0a 71 75 65  .----..72....que
12760 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12770 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a  LECT tab1.col2 *
12780 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f   + tab1.col1 FRO
12790 4d 20 74 61 62 31 2c 20 74 61 62 32 20 63 6f 72  M tab1, tab2 cor
127a0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
127b0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 36 61  s hashing to 16a
127c0 65 30 65 31 30 39 30 63 62 30 39 62 39 33 38 35  e0e1090cb09b9385
127d0 34 61 34 37 38 38 66 31 37 37 31 36 62 0d 0a 0d  4a4788f17716b...
127e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
127f0 0d 0a 53 45 4c 45 43 54 20 35 31 20 2a 20 2d 20  ..SELECT 51 * - 
12800 38 36 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  86 + col0 AS col
12810 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
12820 2d 0d 0a 2d 34 33 30 37 0d 0a 2d 34 33 30 38 0d  -..-4307..-4308.
12830 0a 2d 34 33 37 39 0d 0a 0d 0a 73 6b 69 70 69 66  .-4379....skipif
12840 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
12850 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
12860 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
12870 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
12880 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
12890 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
128a0 2a 20 2b 20 37 32 20 63 6f 6c 31 20 46 52 4f 4d  * + 72 col1 FROM
128b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 38 38   tab1..----..388
128c0 38 0d 0a 34 31 30 34 0d 0a 36 39 31 32 0d 0a 0d  8..4104..6912...
128d0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
128e0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
128f0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
12900 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
12910 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
12920 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12930 54 20 44 49 53 54 49 4e 43 54 20 30 20 2a 20 2d  T DISTINCT 0 * -
12940 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
12950 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab0..----..0...
12960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12970 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 39  ..SELECT ALL ( 9
12980 32 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 29 20  2 + tab2.col0 ) 
12990 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
129a0 0a 31 37 30 0d 0a 31 37 31 0d 0a 39 39 0d 0a 0d  .170..171..99...
129b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
129c0 0d 0a 53 45 4c 45 43 54 20 31 39 20 2a 20 2b 20  ..SELECT 19 * + 
129d0 38 33 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  83 FROM tab2..--
129e0 2d 2d 0d 0a 31 35 37 37 0d 0a 31 35 37 37 0d 0a  --..1577..1577..
129f0 31 35 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1577....query I 
12a00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12a10 63 6f 6c 32 20 2a 20 36 37 20 2a 20 2b 20 63 6f  col2 * 67 * + co
12a20 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
12a30 2d 2d 0d 0a 31 39 35 33 37 32 0d 0a 32 31 37 36  --..195372..2176
12a40 38 33 0d 0a 36 31 37 34 37 32 0d 0a 0d 0a 71 75  83..617472....qu
12a50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12a60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
12a70 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32   col2 ) * - col2
12a80 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
12a90 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  b0..----..-1..-1
12aa0 30 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 71 75  089..-6724....qu
12ab0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12ac0 45 4c 45 43 54 20 2b 20 28 20 30 20 29 20 41 53  ELECT + ( 0 ) AS
12ad0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
12ae0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
12af0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12b00 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12b10 43 54 20 2b 20 32 37 20 2a 20 33 35 20 46 52 4f  CT + 27 * 35 FRO
12b20 4d 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61  M tab2, tab1, ta
12b30 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b1 cor0..----..9
12b40 34 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  45....skipif pos
12b50 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
12b60 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
12b70 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
12b80 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
12b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12ba0 53 45 4c 45 43 54 20 2b 20 34 20 2a 20 63 6f 6c  SELECT + 4 * col
12bb0 30 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  0 * + tab1.col0 
12bc0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
12bd0 2d 2d 2d 2d 0d 0a 31 36 33 38 34 0d 0a 32 35 36  ----..16384..256
12be0 30 30 0d 0a 33 36 0d 0a 0d 0a 71 75 65 72 79 20  00..36....query 
12bf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
12c00 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e  T col0 + + cor0.
12c10 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52  col1 + + col0 FR
12c20 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
12c30 2d 2d 0d 0a 31 33 38 0d 0a 31 37 33 0d 0a 33 32  --..138..173..32
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 44 49 53 54  ort..SELECT DIST
12c60 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  INCT col0 + - co
12c70 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l0 - cor0.col1 A
12c80 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
12c90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12ca0 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d  -86..-91..-97...
12cb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12cc0 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 72 30 2e  ..SELECT ( cor0.
12cd0 63 6f 6c 32 20 29 20 2a 20 28 20 2b 20 63 6f 6c  col2 ) * ( + col
12ce0 30 20 29 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  0 ) - cor0.col1 
12cf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
12d00 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 0d 0a 33 36  0..----..136..36
12d10 33 38 0d 0a 37 36 36 37 0d 0a 0d 0a 6f 6e 6c 79  38..7667....only
12d20 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
12d30 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
12d40 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
12d50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12d60 74 20 6c 61 62 65 6c 2d 35 32 32 0d 0a 53 45 4c  t label-522..SEL
12d70 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 44  ECT ALL - col2 D
12d80 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  IV + cor0.col1 +
12d90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
12da0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
12db0 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70  ..33..82....skip
12dc0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12dd0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12de0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12df0 2d 35 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -522..SELECT ALL
12e00 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63 6f 72 30   - col2 / + cor0
12e10 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f  .col1 + col2 FRO
12e20 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
12e30 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d  ----..1..33..82.
12e40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12e50 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
12e60 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63  NCT - + col1 * c
12e70 6f 6c 31 20 2d 20 36 30 20 46 52 4f 4d 20 74 61  ol1 - 60 FROM ta
12e80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12e90 0d 0a 2d 37 34 35 36 0d 0a 2d 38 33 34 31 0d 0a  ..-7456..-8341..
12ea0 2d 39 34 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -9469....query I
12eb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12ec0 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30   - col0 * - col0
12ed0 20 2a 20 2d 20 28 20 2d 20 28 20 2b 20 63 6f 6c   * - ( - ( + col
12ee0 32 20 29 20 29 20 41 53 20 63 6f 6c 31 20 46 52  2 ) ) AS col1 FR
12ef0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
12f00 2d 2d 0d 0a 31 32 32 35 0d 0a 31 39 30 30 38 0d  --..1225..19008.
12f10 0a 36 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79  .649522....query
12f20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12f30 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
12f40 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 * - cor0.col1
12f50 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63   * col0 + cor0.c
12f60 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
12f70 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
12f80 0d 0a 32 36 30 0d 0a 34 30 39 37 30 0d 0a 38 33  ..260..40970..83
12f90 32 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  213....query I r
12fa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
12fb0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 39 33 20   cor0.col0 + 93 
12fc0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
12fd0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
12fe0 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
12ff0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
13000 67 20 74 6f 20 34 36 63 35 36 39 64 66 30 38 63  g to 46c569df08c
13010 38 36 32 64 66 65 38 39 36 66 34 34 66 37 37 61  862dfe896f44f77a
13020 32 37 33 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49  27313....query I
13030 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13040 20 41 4c 4c 20 2b 20 31 20 2d 20 63 6f 6c 31 20   ALL + 1 - col1 
13050 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
13060 0a 2d 38 35 0d 0a 2d 39 30 0d 0a 2d 39 36 0d 0a  .-85..-90..-96..
13070 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13080 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 35  t..SELECT ALL 85
13090 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30   FROM tab1, tab0
130a0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
130b0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
130c0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
130d0 74 6f 20 65 34 63 66 39 34 63 66 30 63 63 36 33  to e4cf94cf0cc63
130e0 32 61 63 66 66 33 30 61 64 31 64 61 63 36 31 37  2acff30ad1dac617
130f0 63 62 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  cb7....query I r
13100 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13110 4c 4c 20 2d 20 38 37 20 2a 20 63 6f 6c 31 20 2b  LL - 87 * col1 +
13120 20 2d 20 37 20 41 53 20 63 6f 6c 32 20 46 52 4f   - 7 AS col2 FRO
13130 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
13140 2d 2d 2d 2d 0d 0a 2d 37 34 38 39 0d 0a 2d 37 39  ----..-7489..-79
13150 32 34 0d 0a 2d 38 34 34 36 0d 0a 0d 0a 71 75 65  24..-8446....que
13160 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13170 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
13180 28 20 63 6f 6c 31 20 29 20 2d 20 63 6f 6c 32 20  ( col1 ) - col2 
13190 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  * col2 AS col0 F
131a0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
131b0 2d 2d 2d 0d 0a 2d 32 39 34 32 0d 0a 2d 33 32 35  ---..-2942..-325
131c0 39 0d 0a 2d 39 32 32 39 0d 0a 0d 0a 71 75 65 72  9..-9229....quer
131d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
131e0 45 43 54 20 2d 20 34 30 20 46 52 4f 4d 20 74 61  ECT - 40 FROM ta
131f0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
13200 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
13210 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
13220 68 61 73 68 69 6e 67 20 74 6f 20 30 31 61 61 64  hashing to 01aad
13230 34 35 33 39 31 39 38 61 36 35 30 39 32 34 38 65  4539198a6509248e
13240 30 38 36 38 36 39 66 39 30 61 36 0d 0a 0d 0a 71  086869f90a6....q
13250 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13260 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 37  SELECT ALL - - 7
13270 37 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  7 + col0 FROM ta
13280 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b2 cor0..----..1
13290 35 35 0d 0a 31 35 36 0d 0a 38 34 0d 0a 0d 0a 73  55..156..84....s
132a0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
132b0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
132c0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
132d0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
132e0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
132f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13300 41 4c 4c 20 2d 20 2b 20 35 35 20 2a 20 2b 20 63  ALL - + 55 * + c
13310 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46 52  or0.col2 col0 FR
13320 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
13330 2d 2d 0d 0a 2d 32 39 37 30 0d 0a 2d 33 31 33 35  --..-2970..-3135
13340 0d 0a 2d 35 32 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-5280....onlyi
13350 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
13360 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
13370 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
13380 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13390 20 6c 61 62 65 6c 2d 35 33 34 0d 0a 53 45 4c 45   label-534..SELE
133a0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
133b0 63 6f 72 30 2e 63 6f 6c 31 20 29 20 44 49 56 20  cor0.col1 ) DIV 
133c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
133d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
133e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
133f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
13400 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
13410 72 74 20 6c 61 62 65 6c 2d 35 33 34 0d 0a 53 45  rt label-534..SE
13420 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
13430 28 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 2f 20  ( cor0.col1 ) / 
13440 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
13450 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
13460 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13470 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  ort..SELECT + ( 
13480 35 34 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  54 ) AS col2 FRO
13490 4d 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72  M tab1, tab1 cor
134a0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
134b0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 32 33  s hashing to d23
134c0 36 34 63 34 66 66 63 30 39 61 63 32 63 66 31 66  64c4ffc09ac2cf1f
134d0 36 66 61 34 64 37 36 37 64 38 62 30 39 0d 0a 0d  6fa4d767d8b09...
134e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
134f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
13500 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 63  T + col0 * - ( c
13510 6f 6c 32 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f  ol2 + col2 ) FRO
13520 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
13530 34 35 39 36 0d 0a 2d 31 35 38 34 0d 0a 2d 37 30  4596..-1584..-70
13540 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
13550 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
13560 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
13570 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
13580 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
13590 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 33 37  owsort label-537
135a0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e  ..SELECT + tab2.
135b0 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 4e  col1 + - CAST( N
135c0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
135d0 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
135e0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
135f0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
13600 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
13610 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
13620 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
13630 65 6c 2d 35 33 37 0d 0a 53 45 4c 45 43 54 20 2b  el-537..SELECT +
13640 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2d 20 43   tab2.col1 + - C
13650 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
13660 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 31  TEGER ) * + col1
13670 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
13680 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
13690 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
136a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
136b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
136c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
136d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
136e0 6c 2d 35 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f  l-538..SELECT co
136f0 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d 20  l1 DIV + col0 - 
13700 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  - ( col2 ) FROM 
13710 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a  tab2..----..26..
13720 33 31 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66  31..38....skipif
13730 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
13740 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
13750 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13760 33 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  38..SELECT col1 
13770 2f 20 2b 20 63 6f 6c 30 20 2d 20 2d 20 28 20 63  / + col0 - - ( c
13780 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  ol2 ) FROM tab2.
13790 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33 31 0d 0a 33  .----..26..31..3
137a0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
137b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
137c0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63  TINCT + col1 * c
137d0 6f 6c 30 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c  ol0 + + tab2.col
137e0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
137f0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d  ab2..----..1381.
13800 0a 32 34 34 0d 0a 34 36 32 38 0d 0a 0d 0a 71 75  .244..4628....qu
13810 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13820 45 4c 45 43 54 20 41 4c 4c 20 31 38 20 2a 20 2d  ELECT ALL 18 * -
13830 20 28 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f   ( col0 ) + - co
13840 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
13850 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 39 31 0d 0a  0..----..-1691..
13860 2d 34 35 36 0d 0a 2d 36 36 35 0d 0a 0d 0a 71 75  -456..-665....qu
13870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13880 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
13890 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31  r0.col0 - - col1
138a0 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   * cor0.col1 FRO
138b0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
138c0 2d 2d 2d 2d 0d 0a 37 33 37 32 0d 0a 38 31 39 32  ----..7372..8192
138d0 0d 0a 39 33 37 34 0d 0a 0d 0a 71 75 65 72 79 20  ..9374....query 
138e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
138f0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
13900 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  1 * - col1 + + c
13910 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
13920 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
13930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 37 32 0d  r0..----..-7372.
13940 0a 2d 38 31 39 32 0d 0a 2d 39 33 37 34 0d 0a 0d  .-8192..-9374...
13950 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13960 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
13970 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  or0.col2 + + col
13980 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  0 * - col1 FROM 
13990 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
139a0 0a 2d 31 33 38 31 0d 0a 2d 32 34 34 0d 0a 2d 34  .-1381..-244..-4
139b0 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  628....query I r
139c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
139d0 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 28 20  LL + - col0 + ( 
139e0 2b 20 63 6f 6c 30 20 29 20 2a 20 2d 20 31 36 20  + col0 ) * - 16 
139f0 2d 20 36 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 63 AS col1 FRO
13a00 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
13a10 2d 0d 0a 2d 31 31 34 0d 0a 2d 31 31 35 31 0d 0a  -..-114..-1151..
13a20 2d 31 34 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  -1423....query I
13a30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13a40 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20   - + col2 + - ( 
13a50 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  - col2 ) FROM ta
13a60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13a70 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
13a80 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
13a90 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
13aa0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
13ab0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
13ac0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
13ad0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
13ae0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
13af0 2b 20 34 36 20 2a 20 2b 20 63 6f 6c 31 20 63 6f  + 46 * + col1 co
13b00 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
13b10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 37 30  cor0..----..3870
13b20 0d 0a 34 30 39 35 0d 0a 34 33 36 35 0d 0a 0d 0a  ..4095..4365....
13b30 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
13b40 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
13b50 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
13b60 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
13b70 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
13b80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13b90 20 2d 20 32 20 2b 20 2d 20 63 6f 6c 32 20 63 6f   - 2 + - col2 co
13ba0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
13bb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d  cor0..----..-56.
13bc0 0a 2d 35 39 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65  .-59..-98....que
13bd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13be0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
13bf0 2b 20 39 38 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 98 AS col2 FRO
13c00 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
13c10 2d 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b 69 70 69 66  -..-98....skipif
13c20 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
13c30 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
13c40 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
13c50 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
13c60 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
13c70 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
13c80 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( - col1 ) * co
13c90 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
13ca0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  2 cor0..----..13
13cb0 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d  43..217..4602...
13cc0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
13cd0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
13ce0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13cf0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13d00 20 2d 20 2d 20 32 39 20 2a 20 63 6f 72 30 2e 63   - - 29 * cor0.c
13d10 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ol1 + - col1 * +
13d20 20 35 38 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c   58 + ( cor0.col
13d30 32 20 29 20 2a 20 43 41 53 54 20 28 20 63 6f 6c  2 ) * CAST ( col
13d40 31 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d  1 AS REAL ) FROM
13d50 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
13d60 2d 2d 2d 0d 0a 2d 32 37 31 36 0d 0a 33 34 34 0d  ---..-2716..344.
13d70 0a 34 38 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .4823....query I
13d80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13d90 20 41 4c 4c 20 2d 20 32 36 20 2d 20 63 6f 6c 30   ALL - 26 - col0
13da0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
13db0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 0d 0a  r0..----..-106..
13dc0 2d 32 39 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72  -29..-90....quer
13dd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13de0 45 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  ECT col2 * col0 
13df0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
13e00 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
13e10 32 30 38 37 0d 0a 32 32 30 0d 0a 33 30 31 39 0d  2087..220..3019.
13e20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13e30 72 74 0d 0a 53 45 4c 45 43 54 20 35 38 20 2a 20  rt..SELECT 58 * 
13e40 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col1 + col2 FROM
13e50 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 32   tab0..----..502
13e60 31 0d 0a 35 33 36 30 0d 0a 35 36 32 37 0d 0a 0d  1..5360..5627...
13e70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13e80 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
13e90 54 20 2b 20 28 20 2d 20 33 36 20 29 20 2a 20 63  T + ( - 36 ) * c
13ea0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 * - col2 AS 
13eb0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
13ec0 2d 2d 2d 2d 0d 0a 31 33 31 33 32 38 0d 0a 32 37  ----..131328..27
13ed0 36 34 38 30 0d 0a 35 38 33 32 0d 0a 0d 0a 71 75  6480..5832....qu
13ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13ef0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
13f00 6f 6c 31 20 2a 20 28 20 63 6f 6c 30 20 29 20 2a  ol1 * ( col0 ) *
13f10 20 33 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   34 AS col2 FROM
13f20 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36   tab2..----..156
13f30 34 36 38 0d 0a 34 35 36 36 32 0d 0a 37 33 37 38  468..45662..7378
13f40 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
13f50 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
13f60 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
13f70 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
13f80 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13f90 35 35 36 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  556..SELECT - ta
13fa0 62 32 2e 63 6f 6c 32 20 2a 20 2d 20 34 30 20 2b  b2.col2 * - 40 +
13fb0 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31   col1 DIV - col1
13fc0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
13fd0 0d 0a 31 30 33 39 0d 0a 31 30 37 39 0d 0a 31 35  ..1039..1079..15
13fe0 31 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  19....skipif mys
13ff0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
14000 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
14010 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 36 0d 0a  sort label-556..
14020 53 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f  SELECT - tab2.co
14030 6c 32 20 2a 20 2d 20 34 30 20 2b 20 63 6f 6c 31  l2 * - 40 + col1
14040 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   / - col1 FROM t
14050 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 39 0d  ab2..----..1039.
14060 0a 31 30 37 39 0d 0a 31 35 31 39 0d 0a 0d 0a 71  .1079..1519....q
14070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14080 53 45 4c 45 43 54 20 2d 20 38 34 20 2a 20 63 6f  SELECT - 84 * co
14090 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 * col0 FROM t
140a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
140b0 2d 0d 0a 2d 35 33 37 36 30 0d 0a 2d 36 35 35 32  -..-53760..-6552
140c0 0d 0a 2d 38 37 33 36 30 0d 0a 0d 0a 71 75 65 72  ..-87360....quer
140d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
140e0 45 43 54 20 32 37 20 41 53 20 63 6f 6c 32 20 46  ECT 27 AS col2 F
140f0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
14100 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
14110 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
14120 6f 20 37 30 31 62 66 31 32 64 38 36 33 39 32 63  o 701bf12d86392c
14130 62 31 35 38 35 64 39 65 34 66 33 63 37 32 65 39  b1585d9e4f3c72e9
14140 61 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  a8....query I ro
14150 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
14160 39 35 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 32 20  95 * + ( + col2 
14170 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
14180 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
14190 2d 0d 0a 33 31 33 35 0d 0a 37 37 39 30 0d 0a 39  -..3135..7790..9
141a0 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
141b0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
141c0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
141d0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
141e0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
141f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14200 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a  ELECT + + col2 *
14210 20 39 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   95 col1 FROM ta
14220 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
14230 0d 0a 32 34 37 30 0d 0a 32 35 36 35 0d 0a 33 36  ..2470..2565..36
14240 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
14250 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
14260 4c 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b  L + - ( col0 ) +
14270 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
14280 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
14290 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
142a0 2d 2d 2d 0d 0a 31 34 35 36 0d 0a 35 36 37 0d 0a  ---..1456..567..
142b0 38 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  830....query I r
142c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
142d0 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  or0.col1 * - col
142e0 30 20 2b 20 36 36 20 2d 20 63 6f 6c 30 20 41 53  0 + 66 - col0 AS
142f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
14300 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14310 32 30 32 32 0d 0a 2d 33 33 36 34 0d 0a 2d 38 31  2022..-3364..-81
14320 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
14330 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
14340 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2d  r0.col2 + col2 -
14350 20 39 35 20 2a 20 2b 20 37 20 41 53 20 63 6f 6c   95 * + 7 AS col
14360 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
14370 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 39 0d  or0..----..-589.
14380 0a 2d 36 31 31 0d 0a 2d 36 31 33 0d 0a 0d 0a 71  .-611..-613....q
14390 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
143a0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
143b0 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  * - col0 + col2 
143c0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
143d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
143e0 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a  .36..7380..825..
143f0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
14400 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
14410 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
14420 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
14430 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
14440 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14450 43 54 20 2d 20 2b 20 39 32 20 2a 20 63 6f 6c 30  CT - + 92 * col0
14460 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
14470 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14480 36 34 34 0d 0a 2d 37 31 37 36 0d 0a 2d 37 32 36  644..-7176..-726
14490 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
144a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
144b0 20 37 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   77 AS col2 FROM
144c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
144d0 2d 2d 2d 0d 0a 2d 37 37 0d 0a 2d 37 37 0d 0a 2d  ---..-77..-77..-
144e0 37 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  77....skipif pos
144f0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
14500 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
14510 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
14520 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
14530 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14540 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 72 30 2e  SELECT - ( cor0.
14550 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20 63 6f  col1 ) + col0 co
14560 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
14570 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor0..----..-2..
14580 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72  -62..-62....quer
14590 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
145a0 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30  ECT ALL + - col0
145b0 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 39 31 20 41   * col2 * - 91 A
145c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
145d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
145e0 31 37 31 39 39 0d 0a 31 38 34 35 34 38 0d 0a 32  17199..184548..2
145f0 37 33 31 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  73182....query I
14600 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14610 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
14620 6c 32 20 2b 20 2d 20 28 20 32 31 20 29 20 41 53  l2 + - ( 21 ) AS
14630 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
14640 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14650 34 37 0d 0a 2d 34 38 0d 0a 2d 35 39 0d 0a 0d 0a  47..-48..-59....
14660 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
14670 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
14680 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
14690 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
146a0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 30 0d  wsort label-570.
146b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
146c0 20 63 6f 6c 32 20 44 49 56 20 2b 20 28 20 63 6f   col2 DIV + ( co
146d0 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
146e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
146f0 2d 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d  ----..2..5..7...
14700 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
14710 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
14720 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
14730 6c 61 62 65 6c 2d 35 37 30 0d 0a 53 45 4c 45 43  label-570..SELEC
14740 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
14750 2f 20 2b 20 28 20 63 6f 6c 31 20 29 20 41 53 20  / + ( col1 ) AS 
14760 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
14770 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
14780 0a 35 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .5..7....query I
14790 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
147a0 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 39 34   ALL - col1 * 94
147b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
147c0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
147d0 31 32 32 32 0d 0a 2d 32 34 34 34 0d 0a 2d 39 34  1222..-2444..-94
147e0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
147f0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
14800 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
14810 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
14820 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
14830 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
14840 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
14850 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32  r0.col1 * - col2
14860 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
14870 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14880 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37  1534..-646..-837
14890 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
148a0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
148b0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
148c0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
148d0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
148e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 33  owsort label-573
148f0 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28  ..SELECT - CAST(
14900 20 2b 20 37 36 20 41 53 20 53 49 47 4e 45 44 20   + 76 AS SIGNED 
14910 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
14920 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
14930 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
14940 73 20 68 61 73 68 69 6e 67 20 74 6f 20 66 38 62  s hashing to f8b
14950 36 35 38 39 62 63 37 35 30 33 66 63 37 32 30 63  6589bc7503fc720c
14960 61 35 34 33 30 65 33 35 36 39 33 31 37 0d 0a 0d  a5430e3569317...
14970 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
14980 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
14990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
149a0 6c 61 62 65 6c 2d 35 37 33 0d 0a 53 45 4c 45 43  label-573..SELEC
149b0 54 20 2d 20 43 41 53 54 20 28 20 2b 20 37 36 20  T - CAST ( + 76 
149c0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
149d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
149e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
149f0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
14a00 68 69 6e 67 20 74 6f 20 66 38 62 36 35 38 39 62  hing to f8b6589b
14a10 63 37 35 30 33 66 63 37 32 30 63 61 35 34 33 30  c7503fc720ca5430
14a20 65 33 35 36 39 33 31 37 0d 0a 0d 0a 73 6b 69 70  e3569317....skip
14a30 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
14a40 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
14a50 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
14a60 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
14a70 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
14a80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
14a90 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 63   col0 * + col0 c
14aa0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
14ab0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
14ac0 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a  5..576..7921....
14ad0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
14ae0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
14af0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
14b00 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
14b10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 35 0d  wsort label-575.
14b20 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
14b30 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 44  l2 + cor0.col2 D
14b40 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV - col0 FROM t
14b50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
14b60 2d 0d 0a 2d 32 36 0d 0a 2d 33 30 0d 0a 2d 33 38  -..-26..-30..-38
14b70 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
14b80 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
14b90 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
14ba0 72 74 20 6c 61 62 65 6c 2d 35 37 35 0d 0a 53 45  rt label-575..SE
14bb0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
14bc0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2d 20  + cor0.col2 / - 
14bd0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
14be0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
14bf0 36 0d 0a 2d 33 30 0d 0a 2d 33 38 0d 0a 0d 0a 71  6..-30..-38....q
14c00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14c10 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
14c20 6f 6c 32 20 2b 20 2d 20 37 36 20 2a 20 2d 20 63  ol2 + - 76 * - c
14c30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
14c40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31 35   cor0..----..415
14c50 38 0d 0a 34 33 38 39 0d 0a 37 33 39 32 0d 0a 0d  8..4389..7392...
14c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14c70 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
14c80 32 20 2a 20 2b 20 34 36 20 46 52 4f 4d 20 74 61  2 * + 46 FROM ta
14c90 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
14ca0 0d 0a 2d 32 34 38 34 0d 0a 2d 32 36 32 32 0d 0a  ..-2484..-2622..
14cb0 2d 34 34 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -4416....query I
14cc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14cd0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
14ce0 20 2b 20 31 32 20 2a 20 63 6f 6c 30 20 46 52 4f   + 12 * col0 FRO
14cf0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
14d00 2d 2d 2d 2d 0d 0a 31 30 31 34 0d 0a 31 30 32 37  ----..1014..1027
14d10 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..91....query I 
14d20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14d30 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ALL + col2 * col
14d40 32 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72  2 - + col1 * cor
14d50 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  0.col0 * + col0 
14d60 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
14d70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 38 32 34  0..----..-118824
14d80 0d 0a 2d 34 38 34 34 37 0d 0a 2d 37 31 34 30 38  ..-48447..-71408
14d90 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
14da0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
14db0 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   - + col2 + col2
14dc0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
14dd0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
14de0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
14df0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
14e00 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
14e10 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
14e20 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
14e30 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
14e40 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
14e50 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  0.col0 * - col0 
14e60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
14e70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
14e80 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37 39 32 31  225..-576..-7921
14e90 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
14ea0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
14eb0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
14ec0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
14ed0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
14ee0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 32  owsort label-582
14ef0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14f00 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53  T + col1 * - CAS
14f10 54 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47  T( - col2 AS SIG
14f20 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
14f30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
14f40 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a  248..1404..570..
14f50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
14f60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
14f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14f80 20 6c 61 62 65 6c 2d 35 38 32 0d 0a 53 45 4c 45   label-582..SELE
14f90 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
14fa0 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20 2d 20  l1 * - CAST ( - 
14fb0 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
14fc0 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
14fd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d  or0..----..1248.
14fe0 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75  .1404..570....qu
14ff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15000 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
15010 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20   * + ( - col0 ) 
15020 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
15030 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
15040 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
15050 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
15060 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
15070 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
15080 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
15090 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
150a0 35 38 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  584..SELECT + - 
150b0 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 31 20  col0 DIV + col1 
150c0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
150d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
150e0 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b  24..35..89....sk
150f0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
15100 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
15110 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
15120 65 6c 2d 35 38 34 0d 0a 53 45 4c 45 43 54 20 2b  el-584..SELECT +
15130 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 31   - col0 / + col1
15140 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
15150 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
15160 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 6f  .24..35..89....o
15170 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
15180 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
15190 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
151a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
151b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
151c0 74 20 6c 61 62 65 6c 2d 35 38 35 0d 0a 53 45 4c  t label-585..SEL
151d0 45 43 54 20 2d 20 2b 20 43 41 53 54 28 20 38 20  ECT - + CAST( 8 
151e0 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
151f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
15200 2d 2d 2d 0d 0a 2d 38 0d 0a 2d 38 0d 0a 2d 38 0d  ---..-8..-8..-8.
15210 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
15220 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
15230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15240 74 20 6c 61 62 65 6c 2d 35 38 35 0d 0a 53 45 4c  t label-585..SEL
15250 45 43 54 20 2d 20 2b 20 43 41 53 54 20 28 20 38  ECT - + CAST ( 8
15260 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52   AS INTEGER ) FR
15270 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
15280 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 2d 38 0d 0a 2d  .----..-8..-8..-
15290 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
152a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34  sort..SELECT - 4
152b0 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  2 FROM tab2, tab
152c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
152d0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
152e0 67 20 74 6f 20 39 38 39 34 30 39 33 66 32 39 63  g to 9894093f29c
152f0 30 64 65 66 61 65 39 31 33 34 37 39 33 34 66 30  0defae91347934f0
15300 36 30 33 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  60329....query I
15310 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15320 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2b 20 35 33   + col0 * ( + 53
15330 20 2b 20 63 6f 6c 31 20 2a 20 32 30 20 29 20 41   + col1 * 20 ) A
15340 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
15350 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15360 31 36 31 39 32 0d 0a 31 37 31 39 0d 0a 32 35 30  16192..1719..250
15370 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  40....query I ro
15380 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
15390 63 6f 6c 31 20 2a 20 33 20 2a 20 63 6f 6c 31 20  col1 * 3 * col1 
153a0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
153b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
153c0 0a 2d 32 32 31 38 38 0d 0a 2d 32 34 38 34 33 0d  .-22188..-24843.
153d0 0a 2d 32 38 32 32 37 0d 0a 0d 0a 71 75 65 72 79  .-28227....query
153e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
153f0 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b 20  CT - - col0 + + 
15400 37 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  73 AS col1 FROM 
15410 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
15420 2d 2d 0d 0a 31 30 38 0d 0a 31 36 32 0d 0a 39 37  --..108..162..97
15430 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
15440 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
15450 20 2a 20 2d 20 39 38 20 41 53 20 63 6f 6c 31 20   * - 98 AS col1 
15460 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15470 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 34 0d 0a 2d  0..----..-294..-
15480 36 32 37 32 0d 0a 2d 37 38 34 30 0d 0a 0d 0a 71  6272..-7840....q
15490 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
154a0 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
154b0 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l0 FROM tab1, ta
154c0 62 32 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  b2, tab0 cor0..-
154d0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
154e0 61 73 68 69 6e 67 20 74 6f 20 63 33 65 62 66 31  ashing to c3ebf1
154f0 36 39 35 63 61 37 34 35 36 37 62 64 63 31 37 33  695ca74567bdc173
15500 64 62 65 31 35 31 38 36 61 38 0d 0a 0d 0a 6f 6e  dbe15186a8....on
15510 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
15520 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
15530 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
15540 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
15550 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15560 20 6c 61 62 65 6c 2d 35 39 32 0d 0a 53 45 4c 45   label-592..SELE
15570 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT - CAST( NULL 
15580 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20  AS SIGNED ) + + 
15590 38 38 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  88 col2 FROM tab
155a0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  0, tab1 AS cor0.
155b0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
155c0 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
155d0 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
155e0 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73  ff0d216fe0b....s
155f0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
15600 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
15610 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
15620 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
15630 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
15640 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
15650 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
15660 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 32  owsort label-592
15670 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
15680 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
15690 52 20 29 20 2b 20 2b 20 38 38 20 63 6f 6c 32 20  R ) + + 88 col2 
156a0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
156b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
156c0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
156d0 74 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31  to cd7a7901e47c1
156e0 35 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66  5155404aff0d216f
156f0 65 30 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  e0b....query I r
15700 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
15710 49 53 54 49 4e 43 54 20 2b 20 34 34 20 46 52 4f  ISTINCT + 44 FRO
15720 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63 6f 72  M tab2, tab0 cor
15730 30 0d 0a 2d 2d 2d 2d 0d 0a 34 34 0d 0a 0d 0a 71  0..----..44....q
15740 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15750 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 37 33 20  SELECT ALL + 73 
15760 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20  * + tab2.col0 * 
15770 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
15780 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
15790 31 33 37 39 37 0d 0a 31 34 38 30 34 34 0d 0a 32  13797..148044..2
157a0 31 39 31 34 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  19146....skipif 
157b0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
157c0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
157d0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
157e0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
157f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15800 74 0d 0a 53 45 4c 45 43 54 20 38 20 2b 20 2d 20  t..SELECT 8 + - 
15810 28 20 2d 20 63 6f 6c 31 20 29 20 63 6f 6c 30 20  ( - col1 ) col0 
15820 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
15830 0a 31 30 35 0d 0a 39 34 0d 0a 39 39 0d 0a 0d 0a  .105..94..99....
15840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15850 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30  .SELECT - + col0
15860 20 2b 20 37 39 20 2a 20 2b 20 63 6f 6c 30 20 41   + 79 * + col0 A
15870 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
15880 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15890 32 33 34 0d 0a 34 39 39 32 0d 0a 36 32 34 30 0d  234..4992..6240.
158a0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
158b0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
158c0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
158d0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
158e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
158f0 39 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  97..SELECT DISTI
15900 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 44 49 56  NCT - - col0 DIV
15910 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
15920 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
15930 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35 0d  .----..0..1..35.
15940 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
15950 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
15960 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15970 74 20 6c 61 62 65 6c 2d 35 39 37 0d 0a 53 45 4c  t label-597..SEL
15980 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
15990 20 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 41 53 20   col0 / col2 AS 
159a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
159b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
159c0 0a 31 0d 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20  .1..35....query 
159d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
159e0 54 20 32 38 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  T 28 * col1 + co
159f0 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46  l2 + cor0.col1 F
15a00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
15a10 0d 0a 2d 2d 2d 2d 0d 0a 31 37 33 37 0d 0a 35 33  ..----..1737..53
15a20 31 0d 0a 39 32 36 0d 0a 0d 0a 73 6b 69 70 69 66  1..926....skipif
15a30 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
15a40 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
15a50 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
15a60 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
15a70 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
15a80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
15a90 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   + cor0.col2 * +
15aa0 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20   col1 col2 FROM 
15ab0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15ac0 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a  --..1248..1404..
15ad0 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  570....query I r
15ae0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
15af0 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2b  ISTINCT col0 * +
15b00 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20 63   tab1.col0 * + c
15b10 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
15b20 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34   tab1..----..234
15b30 0d 0a 34 30 39 36 30 0d 0a 38 33 32 30 30 0d 0a  ..40960..83200..
15b40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15b50 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 38 20 2a  t..SELECT + 38 *
15b60 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
15b70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
15b80 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 38 0d 0a 32  0..----..1178..2
15b90 32 34 32 0d 0a 36 34 36 0d 0a 0d 0a 6f 6e 6c 79  242..646....only
15ba0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15bb0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15bc0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15bd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15be0 74 20 6c 61 62 65 6c 2d 36 30 32 0d 0a 53 45 4c  t label-602..SEL
15bf0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 38  ECT DISTINCT - 8
15c00 35 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  5 + col2 DIV col
15c10 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
15c20 2d 0d 0a 2d 38 34 0d 0a 2d 38 35 0d 0a 0d 0a 73  -..-84..-85....s
15c30 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
15c40 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
15c50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
15c60 62 65 6c 2d 36 30 32 0d 0a 53 45 4c 45 43 54 20  bel-602..SELECT 
15c70 44 49 53 54 49 4e 43 54 20 2d 20 38 35 20 2b 20  DISTINCT - 85 + 
15c80 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 46 52 4f 4d  col2 / col0 FROM
15c90 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34   tab0..----..-84
15ca0 0d 0a 2d 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-85....onlyif 
15cb0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
15cc0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
15cd0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
15ce0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
15cf0 61 62 65 6c 2d 36 30 33 0d 0a 53 45 4c 45 43 54  abel-603..SELECT
15d00 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30   - col1 * - cor0
15d10 2e 63 6f 6c 32 20 2b 20 36 38 20 2a 20 2d 20 63  .col2 + 68 * - c
15d20 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ol0 + + col0 * c
15d30 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 41  ol2 DIV + col0 A
15d40 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
15d50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15d60 2d 33 37 32 35 0d 0a 2d 34 30 39 36 0d 0a 31 32  -3725..-4096..12
15d70 35 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  54....skipif mys
15d80 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
15d90 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
15da0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 33 0d 0a  sort label-603..
15db0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
15dc0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 36 38  - cor0.col2 + 68
15dd0 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   * - col0 + + co
15de0 6c 30 20 2a 20 63 6f 6c 32 20 2f 20 2b 20 63 6f  l0 * col2 / + co
15df0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
15e00 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15e10 2d 2d 0d 0a 2d 33 37 32 35 0d 0a 2d 34 30 39 36  --..-3725..-4096
15e20 0d 0a 31 32 35 34 0d 0a 0d 0a 71 75 65 72 79 20  ..1254....query 
15e30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15e40 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  T - + col0 * + c
15e50 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c  ol2 * col0 + col
15e60 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
15e70 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
15e80 2d 0d 0a 2d 31 32 39 36 0d 0a 2d 31 35 38 31 35  -..-1296..-15815
15e90 38 0d 0a 2d 32 33 37 31 32 30 0d 0a 0d 0a 71 75  8..-237120....qu
15ea0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15eb0 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63  ELECT col1 * - c
15ec0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 + + col2 FRO
15ed0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
15ee0 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a 2d 31 39  ----..-1305..-19
15ef0 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 6f 6e 6c 79  0..-4576....only
15f00 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15f10 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15f20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15f30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15f40 74 20 6c 61 62 65 6c 2d 36 30 36 0d 0a 53 45 4c  t label-606..SEL
15f50 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 30 20  ECT DISTINCT 90 
15f60 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  DIV cor0.col0 - 
15f70 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
15f80 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
15f90 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  1 cor0..----..-2
15fa0 34 0d 0a 2d 35 36 0d 0a 2d 39 35 0d 0a 0d 0a 73  4..-56..-95....s
15fb0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
15fc0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
15fd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
15fe0 62 65 6c 2d 36 30 36 0d 0a 53 45 4c 45 43 54 20  bel-606..SELECT 
15ff0 44 49 53 54 49 4e 43 54 20 39 30 20 2f 20 63 6f  DISTINCT 90 / co
16000 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63  r0.col0 - cor0.c
16010 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
16020 20 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30   tab1, tab1 cor0
16030 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35 36  ..----..-24..-56
16040 0d 0a 2d 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-95....onlyif 
16050 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
16060 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
16070 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
16080 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16090 61 62 65 6c 2d 36 30 37 0d 0a 53 45 4c 45 43 54  abel-607..SELECT
160a0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56   - cor0.col0 DIV
160b0 20 2b 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   + ( col2 + col1
160c0 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
160d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
160e0 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
160f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
16100 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
16110 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 30 37  owsort label-607
16120 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
16130 63 6f 6c 30 20 2f 20 2b 20 28 20 63 6f 6c 32 20  col0 / + ( col2 
16140 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  + col1 ) FROM ta
16150 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
16160 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  ..-1..0..0....qu
16170 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16180 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c 30 20  ELECT cor1.col0 
16190 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
161a0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  0, tab2 AS cor0,
161b0 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab0 cor1..----
161c0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
161d0 69 6e 67 20 74 6f 20 39 66 63 31 64 63 64 37 36  ing to 9fc1dcd76
161e0 66 65 61 66 34 33 65 35 63 35 64 63 30 36 30 61  feaf43e5c5dc060a
161f0 30 32 30 31 34 63 64 0d 0a 0d 0a 71 75 65 72 79  02014cd....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 2b 20 2b 20 63 6f 6c 31 20 2a 20 33 30  CT + + col1 * 30
16220 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
16230 0a 2d 2d 2d 2d 0d 0a 33 30 30 0d 0a 33 39 30 0d  .----..300..390.
16240 0a 37 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .780....query I 
16250 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16260 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  + + cor0.col0 + 
16270 32 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  26 FROM tab0 AS 
16280 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d  cor0..----..115.
16290 0a 35 30 0d 0a 36 31 0d 0a 0d 0a 71 75 65 72 79  .50..61....query
162a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
162b0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 33 30  CT ALL col0 * 30
162c0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
162d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
162e0 0d 0a 32 31 30 0d 0a 32 33 34 30 0d 0a 32 33 37  ..210..2340..237
162f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
16300 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
16310 20 63 6f 6c 32 20 2b 20 28 20 35 31 20 2b 20 2d   col2 + ( 51 + -
16320 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
16330 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
16340 0a 31 38 0d 0a 34 37 0d 0a 37 32 0d 0a 0d 0a 71  .18..47..72....q
16350 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
16360 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
16370 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col2 * col0 * - 
16380 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col1 + col1 FROM
16390 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
163a0 0d 0a 2d 33 32 39 38 0d 0a 2d 36 36 34 30 32 37  ..-3298..-664027
163b0 0d 0a 2d 36 38 30 32 36 0d 0a 0d 0a 6f 6e 6c 79  ..-68026....only
163c0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
163d0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
163e0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
163f0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
16400 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
16410 61 62 65 6c 2d 36 31 34 0d 0a 53 45 4c 45 43 54  abel-614..SELECT
16420 20 43 41 53 54 28 20 2b 20 35 31 20 41 53 20 53   CAST( + 51 AS S
16430 49 47 4e 45 44 20 29 20 2d 20 63 6f 6c 31 20 41  IGNED ) - col1 A
16440 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
16450 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
16460 32 35 0d 0a 33 38 0d 0a 34 31 0d 0a 0d 0a 73 6b  25..38..41....sk
16470 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
16480 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
16490 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
164a0 65 6c 2d 36 31 34 0d 0a 53 45 4c 45 43 54 20 43  el-614..SELECT C
164b0 41 53 54 20 28 20 2b 20 35 31 20 41 53 20 49 4e  AST ( + 51 AS IN
164c0 54 45 47 45 52 20 29 20 2d 20 63 6f 6c 31 20 41  TEGER ) - col1 A
164d0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
164e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
164f0 32 35 0d 0a 33 38 0d 0a 34 31 0d 0a 0d 0a 71 75  25..38..41....qu
16500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16510 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 31 20  ELECT tab1.col1 
16520 2b 20 37 39 20 46 52 4f 4d 20 74 61 62 31 0d 0a  + 79 FROM tab1..
16530 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 38 39 0d 0a 39  ----..105..89..9
16540 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
16550 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
16560 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f   - col1 ) + + co
16570 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
16580 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
16590 0a 31 31 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a  .118..34..62....
165a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
165b0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35 39  .SELECT ALL - 59
165c0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
165d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
165e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
165f0 20 74 6f 20 31 65 36 35 33 37 63 39 32 32 66 61   to 1e6537c922fa
16600 39 35 33 65 30 66 64 32 66 35 39 34 33 30 38 30  953e0fd2f5943080
16610 33 37 30 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3703....onlyif m
16620 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
16630 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
16640 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
16650 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
16660 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16670 2d 36 31 38 0d 0a 53 45 4c 45 43 54 20 44 49 53  -618..SELECT DIS
16680 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a  TINCT + - col1 *
16690 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 28 20   col2 + + CAST( 
166a0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
166b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
166c0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b1 cor0..----..N
166d0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
166e0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
166f0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
16700 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 38 0d  wsort label-618.
16710 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
16720 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   + - col1 * col2
16730 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   + + CAST ( NULL
16740 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
16750 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
16760 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
16770 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
16780 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
16790 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
167a0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
167b0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
167c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
167d0 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c  LECT ALL - + col
167e0 31 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 33 36 20  1 + col2 * + 36 
167f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
16800 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
16810 35 31 0d 0a 38 37 37 0d 0a 39 34 31 0d 0a 0d 0a  51..877..941....
16820 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16830 0a 53 45 4c 45 43 54 20 2d 20 2d 20 31 35 20 2a  .SELECT - - 15 *
16840 20 63 6f 6c 30 20 2a 20 2b 20 37 33 20 2b 20 2b   col0 * + 73 + +
16850 20 31 34 20 46 52 4f 4d 20 74 61 62 31 20 41 53   14 FROM tab1 AS
16860 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 39   cor0..----..329
16870 39 0d 0a 37 30 30 39 34 0d 0a 38 37 36 31 34 0d  9..70094..87614.
16880 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16890 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 39 20  rt..SELECT - 59 
168a0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
168b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
168c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
168d0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
168e0 69 6e 67 20 74 6f 20 62 63 37 33 38 33 66 33 31  ing to bc7383f31
168f0 62 34 32 34 35 37 31 61 34 65 62 34 36 30 39 62  b424571a4eb4609b
16900 66 65 38 34 38 36 30 0d 0a 0d 0a 71 75 65 72 79  fe84860....query
16910 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16920 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
16930 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32  r0.col1 + - col2
16940 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
16950 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
16960 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 6f  ..53..9..96....o
16970 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
16980 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
16990 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
169a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
169b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
169c0 74 20 6c 61 62 65 6c 2d 36 32 33 0d 0a 53 45 4c  t label-623..SEL
169d0 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  ECT - col2 * + c
169e0 6f 6c 30 20 2b 20 31 39 20 2a 20 2b 20 38 38 20  ol0 + 19 * + 88 
169f0 2b 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 28  + + col2 * CAST(
16a00 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
16a10 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
16a20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
16a30 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
16a40 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
16a50 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
16a60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
16a70 62 65 6c 2d 36 32 33 0d 0a 53 45 4c 45 43 54 20  bel-623..SELECT 
16a80 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  - col2 * + col0 
16a90 2b 20 31 39 20 2a 20 2b 20 38 38 20 2b 20 2b 20  + 19 * + 88 + + 
16aa0 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 4e 55  col2 * CAST ( NU
16ab0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
16ac0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16ad0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
16ae0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
16af0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16b00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
16b10 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 28  - ( + col2 ) * (
16b20 20 37 37 20 29 20 41 53 20 63 6f 6c 30 20 46 52   77 ) AS col0 FR
16b30 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
16b40 2d 2d 0d 0a 2d 32 30 30 32 0d 0a 2d 32 30 37 39  --..-2002..-2079
16b50 0d 0a 2d 32 39 32 36 0d 0a 0d 0a 71 75 65 72 79  ..-2926....query
16b60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16b70 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20  CT DISTINCT ( - 
16b80 63 6f 6c 30 20 29 20 2d 20 2b 20 63 6f 6c 30 20  col0 ) - + col0 
16b90 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  * col0 FROM tab0
16ba0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 30 0d 0a 2d  ..----..-1260..-
16bb0 36 30 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a 6f 6e  600..-8010....on
16bc0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
16bd0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
16be0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
16bf0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
16c00 6f 72 74 20 6c 61 62 65 6c 2d 36 32 36 0d 0a 53  ort label-626..S
16c10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
16c20 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 2a 20 2b   col1 - col1 * +
16c30 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56 20 2b   tab0.col1 DIV +
16c40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
16c50 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .----..0....skip
16c60 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
16c70 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16c80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16c90 2d 36 32 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  -626..SELECT DIS
16ca0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2d 20 63  TINCT + col1 - c
16cb0 6f 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c  ol1 * + tab0.col
16cc0 31 20 2f 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  1 / + col1 FROM 
16cd0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  tab0..----..0...
16ce0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16cf0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 34  ..SELECT - ( - 4
16d00 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  2 ) FROM tab2..-
16d10 2d 2d 2d 0d 0a 34 32 0d 0a 34 32 0d 0a 34 32 0d  ---..42..42..42.
16d20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
16d30 72 74 0d 0a 53 45 4c 45 43 54 20 35 39 20 2a 20  rt..SELECT 59 * 
16d40 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col2 * col0 FROM
16d50 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35   tab1..----..215
16d60 32 33 32 0d 0a 34 35 33 31 32 30 0d 0a 39 35 35  232..453120..955
16d70 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
16d80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
16d90 20 2d 20 63 6f 6c 31 20 2b 20 39 20 46 52 4f 4d   - col1 + 9 FROM
16da0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16db0 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 35 30 0d 0a 2d  ---..-22..-50..-
16dc0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
16dd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
16de0 31 2e 63 6f 6c 31 20 2b 20 32 35 20 2b 20 63 6f  1.col1 + 25 + co
16df0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
16e00 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d  tab1..----..105.
16e10 0a 31 33 34 0d 0a 39 32 0d 0a 0d 0a 71 75 65 72  .134..92....quer
16e20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16e30 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c  ECT ALL tab2.col
16e40 30 20 2a 20 28 20 74 61 62 32 2e 63 6f 6c 31 20  0 * ( tab2.col1 
16e50 29 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20  ) * tab2.col2 + 
16e60 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
16e70 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   tab2..----..124
16e80 32 35 34 0d 0a 35 32 33 37 37 0d 0a 36 30 37 36  254..52377..6076
16e90 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16ea0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
16eb0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
16ec0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
16ed0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
16ee0 36 33 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  632..SELECT DIST
16ef0 49 4e 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20  INCT - col1 DIV 
16f00 2d 20 36 35 20 2b 20 36 31 20 2a 20 63 6f 72 30  - 65 + 61 * cor0
16f10 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
16f20 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
16f30 0a 2d 2d 2d 2d 0d 0a 31 35 38 36 0d 0a 36 31 30  .----..1586..610
16f40 0d 0a 37 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..793....skipif 
16f50 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
16f60 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
16f70 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33  rowsort label-63
16f80 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
16f90 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 36 35  CT - col1 / - 65
16fa0 20 2b 20 36 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   + 61 * cor0.col
16fb0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
16fc0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
16fd0 2d 0d 0a 31 35 38 36 0d 0a 36 31 30 0d 0a 37 39  -..1586..610..79
16fe0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
16ff0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
17000 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63  TINCT + col0 * c
17010 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 - - col1 FRO
17020 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
17030 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38 39 0d  ----..132..7389.
17040 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .878....query II
17050 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f  IIIIIIIIIIIII ro
17060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17070 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  L * FROM tab1, t
17080 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
17090 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62 32 2c  2 AS cor1, tab2,
170a0 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d   tab1 AS cor2..-
170b0 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73  ---..3645 values
170c0 20 68 61 73 68 69 6e 67 20 74 6f 20 61 38 64 32   hashing to a8d2
170d0 62 61 38 62 38 65 62 35 36 38 62 30 61 39 61 31  ba8b8eb568b0a9a1
170e0 37 37 31 63 63 62 30 61 38 66 32 33 0d 0a 0d 0a  771ccb0a8f23....
170f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
17100 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
17110 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
17120 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
17130 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 35 0d  wsort label-635.
17140 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
17150 20 63 6f 6c 31 20 2a 20 2b 20 31 32 20 2d 20 33   col1 * + 12 - 3
17160 34 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20  4 DIV - col1 AS 
17170 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
17180 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
17190 33 32 0d 0a 31 30 39 32 0d 0a 31 31 36 34 0d 0a  32..1092..1164..
171a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
171b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
171c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
171d0 20 6c 61 62 65 6c 2d 36 33 35 0d 0a 53 45 4c 45   label-635..SELE
171e0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
171f0 20 2a 20 2b 20 31 32 20 2d 20 33 34 20 2f 20 2d   * + 12 - 34 / -
17200 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
17210 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
17220 0a 2d 2d 2d 2d 0d 0a 31 30 33 32 0d 0a 31 30 39  .----..1032..109
17230 32 0d 0a 31 31 36 34 0d 0a 0d 0a 71 75 65 72 79  2..1164....query
17240 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17250 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
17260 63 6f 6c 31 20 2a 20 39 35 20 41 53 20 63 6f 6c  col1 * 95 AS col
17270 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
17280 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 35 0d  or0..----..1235.
17290 0a 32 34 37 30 0d 0a 39 35 30 0d 0a 0d 0a 6f 6e  .2470..950....on
172a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
172b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
172c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
172d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
172e0 6f 72 74 20 6c 61 62 65 6c 2d 36 33 37 0d 0a 53  ort label-637..S
172f0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b  ELECT ALL col1 +
17300 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30   col0 DIV + col0
17310 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
17320 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17330 0d 0a 31 38 0d 0a 33 32 0d 0a 36 30 0d 0a 0d 0a  ..18..32..60....
17340 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17350 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17370 61 62 65 6c 2d 36 33 37 0d 0a 53 45 4c 45 43 54  abel-637..SELECT
17380 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   ALL col1 + col0
17390 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   / + col0 AS col
173a0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
173b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 33  or0..----..18..3
173c0 32 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  2..60....query I
173d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
173e0 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   - ( - cor0.col0
173f0 20 29 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   ) * col2 + - co
17400 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r0.col0 AS col2 
17410 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
17420 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39  0..----..182..19
17430 35 30 0d 0a 32 39 32 33 0d 0a 0d 0a 71 75 65 72  50..2923....quer
17440 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17450 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 31  ECT DISTINCT + 1
17460 36 20 2a 20 2b 20 37 38 20 41 53 20 63 6f 6c 30  6 * + 78 AS col0
17470 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
17480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  r0..----..1248..
17490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
174a0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
174b0 20 2a 20 2d 20 34 37 20 2b 20 63 6f 6c 30 20 2d   * - 47 + col0 -
174c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
174d0 0a 2d 2d 2d 2d 0d 0a 2d 31 39 32 0d 0a 2d 33 30  .----..-192..-30
174e0 30 31 0d 0a 2d 33 37 37 36 0d 0a 0d 0a 71 75 65  01..-3776....que
174f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17500 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 30  LECT + tab0.col0
17510 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   + + col2 + + co
17520 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
17530 2d 2d 0d 0a 32 36 30 0d 0a 37 31 0d 0a 38 31 0d  --..260..71..81.
17540 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
17550 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
17560 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
17570 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
17580 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
17590 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 32 0d  wsort label-642.
175a0 0a 53 45 4c 45 43 54 20 28 20 2b 20 31 35 20 29  .SELECT ( + 15 )
175b0 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 43   * cor0.col2 + C
175c0 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53 49 47  AST( col2 AS SIG
175d0 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 46 52 4f  NED ) * col0 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 34 35 30 33 0d 0a 39 31 32 30  ----..4503..9120
17600 0d 0a 39 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..972....skipif 
17610 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
17620 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
17630 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34  rowsort label-64
17640 32 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 31 35  2..SELECT ( + 15
17650 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2b   ) * cor0.col2 +
17660 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20   CAST ( col2 AS 
17670 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 30  INTEGER ) * col0
17680 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
17690 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 30 33 0d 0a  r0..----..4503..
176a0 39 31 32 30 0d 0a 39 37 32 0d 0a 0d 0a 71 75 65  9120..972....que
176b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
176c0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20  LECT DISTINCT ( 
176d0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20  - cor0.col0 ) + 
176e0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
176f0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
17700 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d  -..-19..-62..24.
17710 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17720 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
17730 4e 43 54 20 2b 20 38 20 2a 20 2b 20 63 6f 6c 31  NCT + 8 * + col1
17740 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
17750 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 32  r0..----..104..2
17760 30 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20  08..80....query 
17770 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17780 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63  T DISTINCT - + c
17790 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol0 + col0 * + c
177a0 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 * col1 FROM 
177b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
177c0 2d 2d 0d 0a 31 37 37 34 38 30 0d 0a 33 32 39 32  --..177480..3292
177d0 38 30 0d 0a 37 33 36 39 32 30 0d 0a 0d 0a 71 75  80..736920....qu
177e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
177f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
17800 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63   cor0.col0 * - c
17810 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 28  ol1 + - col0 + (
17820 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2a   - cor0.col2 ) *
17830 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
17840 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
17850 2d 2d 0d 0a 2d 34 31 33 0d 0a 2d 34 34 32 34 0d  --..-413..-4424.
17860 0a 2d 36 37 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-6708....onlyif
17870 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
17880 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
17890 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
178a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
178b0 6c 61 62 65 6c 2d 36 34 37 0d 0a 53 45 4c 45 43  label-647..SELEC
178c0 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 44  T ALL - - col2 D
178d0 49 56 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31  IV col1 + + col1
178e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
178f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  r0..----..86..91
17900 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..97....skipif m
17910 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
17920 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
17930 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 37  owsort label-647
17940 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
17950 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 2b 20 2b   col2 / col1 + +
17960 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
17970 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
17980 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65  6..91..97....que
17990 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
179a0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
179b0 2b 20 36 30 20 2a 20 28 20 63 6f 6c 32 20 2a 20  + 60 * ( col2 * 
179c0 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30  col2 ) FROM tab0
179d0 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 34 30 33 33  ..----..25..4033
179e0 35 31 0d 0a 36 35 33 31 36 0d 0a 0d 0a 71 75 65  51..65316....que
179f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17a00 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 34 31  LECT col2 + - 41
17a10 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
17a20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
17a30 0a 2d 32 31 36 30 0d 0a 2d 32 32 38 30 0d 0a 2d  .-2160..-2280..-
17a40 33 38 34 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3840....onlyif m
17a50 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
17a60 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
17a70 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
17a80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17a90 62 65 6c 2d 36 35 30 0d 0a 53 45 4c 45 43 54 20  bel-650..SELECT 
17aa0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  col1 * col2 + co
17ab0 6c 30 20 44 49 56 20 63 6f 6c 32 20 2b 20 63 6f  l0 DIV col2 + co
17ac0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
17ad0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39 0d  cor0..----..229.
17ae0 0a 32 39 32 34 0d 0a 37 35 35 34 0d 0a 0d 0a 73  .2924..7554....s
17af0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
17b00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
17b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17b20 62 65 6c 2d 36 35 30 0d 0a 53 45 4c 45 43 54 20  bel-650..SELECT 
17b30 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  col1 * col2 + co
17b40 6c 30 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  l0 / col2 + col1
17b50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
17b60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39 0d 0a 32  r0..----..229..2
17b70 39 32 34 0d 0a 37 35 35 34 0d 0a 0d 0a 71 75 65  924..7554....que
17b80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17b90 4c 45 43 54 20 28 20 2d 20 63 6f 6c 31 20 29 20  LECT ( - col1 ) 
17ba0 2a 20 32 35 20 46 52 4f 4d 20 74 61 62 30 20 41  * 25 FROM tab0 A
17bb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
17bc0 31 35 30 0d 0a 2d 32 32 37 35 0d 0a 2d 32 34 32  150..-2275..-242
17bd0 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
17be0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
17bf0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
17c00 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
17c10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
17c20 2d 36 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  -652..SELECT DIS
17c30 54 49 4e 43 54 20 63 6f 6c 31 20 44 49 56 20 2d  TINCT col1 DIV -
17c40 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
17c50 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
17c60 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..0....skipif 
17c70 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
17c80 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
17c90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
17ca0 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
17cb0 43 54 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32  CT col1 / - col2
17cc0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
17cd0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
17ce0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
17cf0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
17d00 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
17d10 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
17d20 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
17d30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17d40 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
17d50 6c 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46  l0 + col2 col2 F
17d60 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
17d70 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d  ..----..171..36.
17d80 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .57....skipif po
17d90 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
17da0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
17db0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
17dc0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
17dd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17de0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
17df0 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   - - col0 + + co
17e00 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
17e10 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
17e20 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a  .110..132..180..
17e30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17e40 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17e50 43 54 20 2b 20 2b 20 32 33 20 2a 20 2d 20 63 6f  CT + + 23 * - co
17e60 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l0 + col2 AS col
17e70 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
17e80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 0d  or0..----..-134.
17e90 0a 2d 31 37 36 38 0d 0a 2d 31 37 37 39 0d 0a 0d  .-1768..-1779...
17ea0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17eb0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
17ec0 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  T - col1 * + col
17ed0 32 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  2 + - col2 + - c
17ee0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
17ef0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
17f00 0d 0a 2d 32 39 30 34 0d 0a 2d 37 36 32 36 0d 0a  ..-2904..-7626..
17f10 2d 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -99....query I r
17f20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
17f30 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b  LL cor0.col0 + +
17f40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
17f50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d  cor0..----..128.
17f60 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79  .160..6....query
17f70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17f80 43 54 20 2d 20 36 32 20 2b 20 2d 20 63 6f 6c 30  CT - 62 + - col0
17f90 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
17fa0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 34 0d 0a 2d  1..----..-224..-
17fb0 33 37 31 30 0d 0a 2d 37 37 34 32 0d 0a 0d 0a 6f  3710..-7742....o
17fc0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
17fd0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
17fe0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
17ff0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
18000 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 39 0d 0a  sort label-659..
18010 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 30 20  SELECT ALL - 70 
18020 44 49 56 20 2b 20 39 33 20 2b 20 63 6f 6c 32 20  DIV + 93 + col2 
18030 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18040 32 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d  2..----..26..27.
18050 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .38....skipif my
18060 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
18070 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
18080 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 39 0d  wsort label-659.
18090 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 30  .SELECT ALL - 70
180a0 20 2f 20 2b 20 39 33 20 2b 20 63 6f 6c 32 20 41   / + 93 + col2 A
180b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
180c0 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a  ..----..26..27..
180d0 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
180e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
180f0 6c 30 20 2b 20 2b 20 39 37 20 46 52 4f 4d 20 74  l0 + + 97 FROM t
18100 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a  ab0..----..121..
18110 31 33 32 0d 0a 31 38 36 0d 0a 0d 0a 71 75 65 72  132..186....quer
18120 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18130 45 43 54 20 2b 20 36 35 20 2a 20 63 6f 6c 31 20  ECT + 65 * col1 
18140 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
18150 0a 35 35 39 30 0d 0a 35 39 31 35 0d 0a 36 33 30  .5590..5915..630
18160 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
18170 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 39 20  sort..SELECT 29 
18180 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
18190 0d 0a 2d 2d 2d 2d 0d 0a 34 36 0d 0a 36 30 0d 0a  ..----..46..60..
181a0 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  88....onlyif mys
181b0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
181c0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
181d0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
181e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
181f0 6c 2d 36 36 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-663..SELECT DI
18200 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 44 49  STINCT + col2 DI
18210 56 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c  V ( col1 ) + col
18220 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
18230 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 33  or0..----..19..3
18240 31 0d 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..59....skipif 
18250 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
18260 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
18270 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36  rowsort label-66
18280 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
18290 43 54 20 2b 20 63 6f 6c 32 20 2f 20 28 20 63 6f  CT + col2 / ( co
182a0 6c 31 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l1 ) + col1 FROM
182b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
182c0 2d 2d 2d 0d 0a 31 39 0d 0a 33 31 0d 0a 35 39 0d  ---..19..31..59.
182d0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
182e0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
182f0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
18300 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
18310 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
18320 36 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  64..SELECT ALL -
18330 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b   cor0.col0 DIV +
18340 20 38 37 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   87 col0 FROM ta
18350 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
18360 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
18370 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
18380 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
18390 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
183a0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
183b0 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
183c0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
183d0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
183e0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 34 0d 0a  sort label-664..
183f0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
18400 30 2e 63 6f 6c 30 20 2f 20 2b 20 38 37 20 63 6f  0.col0 / + 87 co
18410 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
18420 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
18430 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
18440 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
18450 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
18460 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
18470 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
18480 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18490 36 36 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  665..SELECT DIST
184a0 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  INCT - col0 * - 
184b0 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45  CAST( NULL AS DE
184c0 43 49 4d 41 4c 20 29 20 2a 20 2d 20 31 33 20 63  CIMAL ) * - 13 c
184d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
184e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
184f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
18500 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
18510 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
18520 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
18530 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
18540 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
18550 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
18560 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18570 65 6c 2d 36 36 35 0d 0a 53 45 4c 45 43 54 20 44  el-665..SELECT D
18580 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
18590 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
185a0 53 20 52 45 41 4c 20 29 20 2a 20 2d 20 31 33 20  S REAL ) * - 13 
185b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
185c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
185d0 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
185e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
185f0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20  STINCT col0 * + 
18600 35 31 20 2b 20 32 37 20 2a 20 2b 20 63 6f 6c 30  51 + 27 * + col0
18610 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
18620 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
18630 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 30 32  or0..----..-1602
18640 39 30 0d 0a 2d 31 36 34 34 37 38 0d 0a 2d 39 36  90..-164478..-96
18650 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
18660 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
18670 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 36 37 20 41   + col2 - - 67 A
18680 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
18690 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
186a0 31 30 35 0d 0a 39 33 0d 0a 39 34 0d 0a 0d 0a 71  105..93..94....q
186b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
186c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
186d0 2d 20 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c  - col0 * ( - col
186e0 32 20 29 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  2 ) * + col2 AS 
186f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
18700 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 30 37  or0..----..11407
18710 36 0d 0a 35 31 30 33 0d 0a 35 32 37 32 38 0d 0a  6..5103..52728..
18720 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18730 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
18740 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 32 30  l0 + + col2 * 20
18750 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
18760 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
18770 0d 0a 34 34 32 0d 0a 35 33 33 0d 0a 36 38 31 0d  ..442..533..681.
18780 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18790 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
187a0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20   - col1 * - ( - 
187b0 37 39 20 29 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  79 ) - cor0.col2
187c0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
187d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
187e0 0d 0a 36 37 36 31 0d 0a 37 31 30 37 0d 0a 37 36  ..6761..7107..76
187f0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
18800 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
18810 63 6f 6c 32 20 2a 20 2b 20 36 38 20 41 53 20 63  col2 * + 68 AS c
18820 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
18830 2d 2d 2d 0d 0a 31 37 36 38 0d 0a 31 38 33 36 0d  ---..1768..1836.
18840 0a 32 35 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .2584....onlyif 
18850 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
18860 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
18870 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
18880 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
18890 61 62 65 6c 2d 36 37 32 0d 0a 53 45 4c 45 43 54  abel-672..SELECT
188a0 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20 63 6f   DISTINCT ( + co
188b0 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  l2 ) + - col0 + 
188c0 28 20 28 20 63 6f 6c 30 20 29 20 29 20 44 49 56  ( ( col0 ) ) DIV
188d0 20 36 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   61 FROM tab0..-
188e0 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 36 0d 0a 39 0d  ---..-34..-6..9.
188f0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
18900 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
18910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18920 74 20 6c 61 62 65 6c 2d 36 37 32 0d 0a 53 45 4c  t label-672..SEL
18930 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b  ECT DISTINCT ( +
18940 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 30   col2 ) + - col0
18950 20 2b 20 28 20 28 20 63 6f 6c 30 20 29 20 29 20   + ( ( col0 ) ) 
18960 2f 20 36 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  / 61 FROM tab0..
18970 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 36 0d 0a 39  ----..-34..-6..9
18980 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
18990 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
189a0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
189b0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
189c0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
189d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 33  owsort label-673
189e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
189f0 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
18a00 49 47 4e 45 44 20 29 20 2a 20 2d 20 32 32 20 41  IGNED ) * - 22 A
18a10 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
18a20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18a30 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
18a40 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
18a50 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
18a60 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
18a70 72 74 20 6c 61 62 65 6c 2d 36 37 33 0d 0a 53 45  rt label-673..SE
18a80 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53  LECT ALL - - CAS
18a90 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
18aa0 47 45 52 20 29 20 2a 20 2d 20 32 32 20 41 53 20  GER ) * - 22 AS 
18ab0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
18ac0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
18ad0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
18ae0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18af0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
18b00 43 54 20 28 20 2b 20 31 34 20 29 20 2a 20 2b 20  CT ( + 14 ) * + 
18b10 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
18b20 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
18b30 2d 2d 2d 2d 0d 0a 31 34 30 0d 0a 31 38 32 0d 0a  ----..140..182..
18b40 33 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  364....onlyif my
18b50 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
18b60 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
18b70 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
18b80 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18b90 65 6c 2d 36 37 35 0d 0a 53 45 4c 45 43 54 20 63  el-675..SELECT c
18ba0 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol2 DIV cor0.col
18bb0 32 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 - - col0 AS co
18bc0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
18bd0 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a 36 35 0d 0a  0..----..4..65..
18be0 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  81....skipif mys
18bf0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18c00 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18c10 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 35 0d 0a  sort label-675..
18c20 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f  SELECT col2 / co
18c30 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30  r0.col2 - - col0
18c40 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
18c50 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  b1 cor0..----..4
18c60 0d 0a 36 35 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72  ..65..81....quer
18c70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18c80 45 43 54 20 2b 20 28 20 35 32 20 29 20 2b 20 2b  ECT + ( 52 ) + +
18c90 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f   col0 * - ( + co
18ca0 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 63  l1 ) FROM tab1 c
18cb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a  or0..----..-26..
18cc0 2d 35 38 38 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75  -588..-988....qu
18cd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18ce0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
18cf0 20 63 6f 6c 30 20 2b 20 32 35 20 46 52 4f 4d 20   col0 + 25 FROM 
18d00 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
18d10 2d 2d 0d 0a 31 30 35 0d 0a 32 38 0d 0a 38 39 0d  --..105..28..89.
18d20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18d30 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
18d40 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  ol2 + col1 + - c
18d50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
18d60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
18d70 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  33..82....query 
18d80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18d90 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a  T ALL - - col0 *
18da0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41   col2 * - col2 A
18db0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
18dc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18dd0 2d 32 30 37 39 33 36 0d 0a 2d 37 33 37 32 38 30  -207936..-737280
18de0 0d 0a 2d 38 37 34 38 0d 0a 0d 0a 71 75 65 72 79  ..-8748....query
18df0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18e00 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
18e10 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l2 * + col2 AS c
18e20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
18e30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
18e40 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a  44..-676..-729..
18e50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18e60 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 20 2b 20  t..SELECT - 3 + 
18e70 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  - col1 * + col0 
18e80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
18e90 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
18ea0 30 34 33 0d 0a 2d 36 34 33 0d 0a 2d 38 31 0d 0a  043..-643..-81..
18eb0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
18ec0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
18ed0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
18ee0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
18ef0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
18f00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18f10 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
18f20 33 31 20 2a 20 34 37 20 2a 20 2d 20 63 6f 6c 31  31 * 47 * - col1
18f30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
18f40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 33  cor0..----..1253
18f50 30 32 0d 0a 31 33 32 35 38 37 0d 0a 31 34 31 33  02..132587..1413
18f60 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
18f70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 36  wsort..SELECT 76
18f80 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
18f90 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  1 cor0..----..22
18fa0 38 0d 0a 34 38 36 34 0d 0a 36 30 38 30 0d 0a 0d  8..4864..6080...
18fb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18fc0 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
18fd0 6c 30 20 2b 20 2b 20 38 39 20 46 52 4f 4d 20 74  l0 + + 89 FROM t
18fe0 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
18ff0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
19000 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 38 33  s hashing to 683
19010 62 34 34 35 31 62 33 63 37 35 62 64 30 33 62 32  b4451b3c75bd03b2
19020 37 38 33 30 38 66 33 38 62 65 61 65 34 0d 0a 0d  78308f38beae4...
19030 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19040 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
19050 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 28  ol2 * - col1 + (
19060 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29   ( + cor0.col2 )
19070 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46   + cor0.col2 ) F
19080 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
19090 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 30 0d 0a 31 35  ..----..1440..15
190a0 31 32 0d 0a 36 38 34 0d 0a 0d 0a 71 75 65 72 79  12..684....query
190b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
190c0 43 54 20 35 39 20 2a 20 2d 20 63 6f 6c 30 20 2b  CT 59 * - col0 +
190d0 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63   ( + col0 ) AS c
190e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
190f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
19100 39 32 0d 0a 2d 32 30 33 30 0d 0a 2d 35 31 36 32  92..-2030..-5162
19110 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19120 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 30 20 2a  ort..SELECT 20 *
19130 20 2d 20 31 34 20 46 52 4f 4d 20 74 61 62 32 20   - 14 FROM tab2 
19140 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
19150 32 38 30 0d 0a 2d 32 38 30 0d 0a 2d 32 38 30 0d  280..-280..-280.
19160 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19170 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
19180 6f 6c 30 20 2b 20 2d 20 38 30 20 2a 20 2d 20 63  ol0 + - 80 * - c
19190 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
191a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
191b0 2d 2d 2d 0d 0a 32 33 37 0d 0a 35 30 35 36 0d 0a  ---..237..5056..
191c0 36 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6320....query I 
191d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
191e0 2b 20 2d 20 34 33 20 41 53 20 63 6f 6c 31 20 46  + - 43 AS col1 F
191f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
19200 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 34 33  ..----..-43..-43
19210 0d 0a 2d 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-43....query I
19220 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19230 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31   - col2 + - col1
19240 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
19250 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
19260 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 37 0d 0a 2d  0..----..-327..-
19270 33 35 30 37 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75  3507..-988....qu
19280 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19290 45 4c 45 43 54 20 2b 20 32 33 20 46 52 4f 4d 20  ELECT + 23 FROM 
192a0 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
192b0 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
192c0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
192d0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 34 36  s hashing to 546
192e0 64 34 39 61 61 34 33 33 34 30 36 64 64 38 33 65  d49aa433406dd83e
192f0 61 31 39 38 38 35 35 38 38 65 36 35 38 0d 0a 0d  a19885588e658...
19300 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19310 0d 0a 53 45 4c 45 43 54 20 2d 20 37 30 20 2b 20  ..SELECT - 70 + 
19320 2d 20 32 37 20 46 52 4f 4d 20 74 61 62 30 20 41  - 27 FROM tab0 A
19330 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  S cor0..----..-9
19340 37 0d 0a 2d 39 37 0d 0a 2d 39 37 0d 0a 0d 0a 71  7..-97..-97....q
19350 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19360 53 45 4c 45 43 54 20 28 20 36 39 20 29 20 2b 20  SELECT ( 69 ) + 
19370 2d 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f 6c  - col0 * ( + col
19380 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
19390 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
193a0 2d 2d 2d 0d 0a 2d 35 37 31 0d 0a 2d 39 0d 0a 2d  ---..-571..-9..-
193b0 39 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  971....query I r
193c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
193d0 4c 4c 20 33 32 20 46 52 4f 4d 20 74 61 62 30 2c  LL 32 FROM tab0,
193e0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
193f0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
19400 73 68 69 6e 67 20 74 6f 20 64 33 30 61 32 61 63  shing to d30a2ac
19410 62 66 33 33 63 38 38 32 37 34 34 37 34 33 30 36  bf33c88274474306
19420 39 33 36 64 33 32 32 37 62 0d 0a 0d 0a 71 75 65  936d3227b....que
19430 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19440 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
19450 63 6f 6c 31 20 2a 20 32 32 20 41 53 20 63 6f 6c  col1 * 22 AS col
19460 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
19470 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 37 0d  or0..----..1357.
19480 0a 33 39 31 0d 0a 37 31 33 0d 0a 0d 0a 6f 6e 6c  .391..713....onl
19490 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
194a0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
194b0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
194c0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
194d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
194e0 6c 61 62 65 6c 2d 36 39 36 0d 0a 53 45 4c 45 43  label-696..SELEC
194f0 54 20 2d 20 43 41 53 54 28 20 2d 20 34 32 20 2a  T - CAST( - 42 *
19500 20 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45   + col1 AS SIGNE
19510 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  D ) AS col1 FROM
19520 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   tab1..----..109
19530 32 0d 0a 34 32 30 0d 0a 35 34 36 0d 0a 0d 0a 73  2..420..546....s
19540 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
19550 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
19560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
19570 62 65 6c 2d 36 39 36 0d 0a 53 45 4c 45 43 54 20  bel-696..SELECT 
19580 2d 20 43 41 53 54 20 28 20 2d 20 34 32 20 2a 20  - CAST ( - 42 * 
19590 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  + col1 AS INTEGE
195a0 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
195b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   tab1..----..109
195c0 32 0d 0a 34 32 30 0d 0a 35 34 36 0d 0a 0d 0a 71  2..420..546....q
195d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
195e0 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
195f0 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f  l2 * + col2 - co
19600 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 * - cor0.col0
19610 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
19620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 30 0d 0a  r0..----..-680..
19630 34 37 39 37 0d 0a 35 34 30 38 0d 0a 0d 0a 6f 6e  4797..5408....on
19640 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
19650 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
19660 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
19670 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
19680 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19690 20 6c 61 62 65 6c 2d 36 39 38 0d 0a 53 45 4c 45   label-698..SELE
196a0 43 54 20 43 41 53 54 28 20 33 33 20 41 53 20 53  CT CAST( 33 AS S
196b0 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32 20  IGNED ) AS col2 
196c0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20 43  FROM tab1 cor0 C
196d0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 63  ROSS JOIN tab2 c
196e0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or1..----..9 val
196f0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
19700 32 30 64 33 38 34 32 38 36 65 38 32 64 31 63 36  20d384286e82d1c6
19710 63 38 62 31 62 32 62 31 30 39 61 37 64 61 35 0d  c8b1b2b109a7da5.
19720 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
19730 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
19740 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19750 74 20 6c 61 62 65 6c 2d 36 39 38 0d 0a 53 45 4c  t label-698..SEL
19760 45 43 54 20 43 41 53 54 20 28 20 33 33 20 41 53  ECT CAST ( 33 AS
19770 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
19780 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
19790 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
197a0 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  2 cor1..----..9 
197b0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
197c0 6f 20 36 32 30 64 33 38 34 32 38 36 65 38 32 64  o 620d384286e82d
197d0 31 63 36 63 38 62 31 62 32 62 31 30 39 61 37 64  1c6c8b1b2b109a7d
197e0 61 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  a5....skipif pos
197f0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
19800 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
19810 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
19820 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
19830 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19840 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
19850 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  0.col1 col0 FROM
19860 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
19870 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19880 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
19890 6e 67 20 74 6f 20 64 36 37 31 61 30 36 34 65 32  ng to d671a064e2
198a0 64 61 37 30 39 63 61 34 63 64 66 65 61 33 31 37  da709ca4cdfea317
198b0 62 38 65 38 39 32 0d 0a 0d 0a 71 75 65 72 79 20  b8e892....query 
198c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
198d0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
198e0 32 20 2a 20 2d 20 28 20 63 6f 6c 30 20 2b 20 2d  2 * - ( col0 + -
198f0 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
19900 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
19910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19920 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
19930 20 28 20 34 30 20 29 20 41 53 20 63 6f 6c 30 20   ( 40 ) AS col0 
19940 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20  FROM tab1, tab2 
19950 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
19960 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
19970 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
19980 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20 38  TINCT col1 * + 8
19990 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
199a0 2d 0d 0a 31 30 36 36 0d 0a 32 31 33 32 0d 0a 38  -..1066..2132..8
199b0 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
199c0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
199d0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
199e0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
199f0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
19a00 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
19a10 30 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  03..SELECT DISTI
19a20 4e 43 54 20 63 6f 6c 30 20 2a 20 43 41 53 54 28  NCT col0 * CAST(
19a30 20 32 38 20 41 53 20 53 49 47 4e 45 44 20 29 20   28 AS SIGNED ) 
19a40 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  - + col2 * + col
19a50 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
19a60 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
19a70 2d 0d 0a 2d 34 31 37 0d 0a 2d 34 32 33 32 0d 0a  -..-417..-4232..
19a80 39 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  979....skipif my
19a90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
19aa0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
19ab0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 33 0d  wsort label-703.
19ac0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19ad0 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 32   col0 * CAST ( 2
19ae0 38 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d  8 AS INTEGER ) -
19af0 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
19b00 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
19b10 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
19b20 0d 0a 2d 34 31 37 0d 0a 2d 34 32 33 32 0d 0a 39  ..-417..-4232..9
19b30 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  79....onlyif mys
19b40 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
19b50 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
19b60 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
19b70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19b80 6c 2d 37 30 34 0d 0a 53 45 4c 45 43 54 20 2d 20  l-704..SELECT - 
19b90 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f  cor0.col2 DIV co
19ba0 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l1 + col0 AS col
19bb0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
19bc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 37  or0..----..7..77
19bd0 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..78....skipif m
19be0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
19bf0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
19c00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 34  owsort label-704
19c10 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
19c20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 2b 20 63 6f  col2 / col1 + co
19c30 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
19c40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
19c50 2d 2d 0d 0a 37 0d 0a 37 37 0d 0a 37 38 0d 0a 0d  --..7..77..78...
19c60 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
19c70 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
19c80 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
19c90 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
19ca0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
19cb0 6f 72 74 20 6c 61 62 65 6c 2d 37 30 35 0d 0a 53  ort label-705..S
19cc0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
19cd0 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 28 20   col0 + + CAST( 
19ce0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
19cf0 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
19d00 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
19d10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
19d20 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
19d30 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
19d40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19d50 74 20 6c 61 62 65 6c 2d 37 30 35 0d 0a 53 45 4c  t label-705..SEL
19d60 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
19d70 6f 6c 30 20 2b 20 2b 20 43 41 53 54 20 28 20 4e  ol0 + + CAST ( N
19d80 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
19d90 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
19da0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
19db0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
19dc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19dd0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
19de0 6f 6c 30 20 2a 20 2b 20 37 33 20 2a 20 2b 20 63  ol0 * + 73 * + c
19df0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
19e00 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 35 37   tab2..----..357
19e10 37 0d 0a 34 34 34 31 33 32 0d 0a 34 35 35 35 39  7..444132..45559
19e20 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
19e30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
19e40 20 63 6f 6c 30 20 2a 20 2b 20 32 31 20 2b 20 2b   col0 * + 21 + +
19e50 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
19e60 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
19e70 2d 2d 0d 0a 2d 31 32 38 30 0d 0a 2d 31 36 30 30  --..-1280..-1600
19e80 0d 0a 2d 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-60....onlyif 
19e90 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
19ea0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
19eb0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
19ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
19ed0 61 62 65 6c 2d 37 30 38 0d 0a 53 45 4c 45 43 54  abel-708..SELECT
19ee0 20 41 4c 4c 20 63 6f 6c 31 20 44 49 56 20 63 6f   ALL col1 DIV co
19ef0 6c 32 20 2d 20 2d 20 38 38 20 46 52 4f 4d 20 74  l2 - - 88 FROM t
19f00 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 35 0d 0a  ab0..----..185..
19f10 38 39 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  89..90....skipif
19f20 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
19f30 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
19f40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
19f50 30 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  08..SELECT ALL c
19f60 6f 6c 31 20 2f 20 63 6f 6c 32 20 2d 20 2d 20 38  ol1 / col2 - - 8
19f70 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  8 FROM tab0..---
19f80 2d 0d 0a 31 38 35 0d 0a 38 39 0d 0a 39 30 0d 0a  -..185..89..90..
19f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19fa0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
19fb0 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l2 + - col2 * co
19fc0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
19fd0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
19fe0 2d 2d 0d 0a 2d 31 34 38 32 0d 0a 2d 37 30 32 0d  --..-1482..-702.
19ff0 0a 2d 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .-756....query I
1a000 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a010 20 2d 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 30   - - ( cor0.col0
1a020 20 29 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   ) + col1 * col0
1a030 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1a040 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1a050 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38 31  ..2088..3430..81
1a060 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  88....onlyif mys
1a070 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1a080 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1a090 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1a0a0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1a0b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a0c0 31 31 0d 0a 53 45 4c 45 43 54 20 37 38 20 2a 20  11..SELECT 78 * 
1a0d0 2b 20 33 36 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  + 36 + - col2 * 
1a0e0 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  + CAST( NULL AS 
1a0f0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
1a100 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1a110 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1a120 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1a130 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1a140 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1a150 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1a160 6c 2d 37 31 31 0d 0a 53 45 4c 45 43 54 20 37 38  l-711..SELECT 78
1a170 20 2a 20 2b 20 33 36 20 2b 20 2d 20 63 6f 6c 32   * + 36 + - col2
1a180 20 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   * + CAST ( NULL
1a190 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
1a1a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1a1b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
1a1c0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1a1d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a1e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1a1f0 43 54 20 2d 20 63 6f 6c 31 20 2b 20 39 34 20 2a  CT - col1 + 94 *
1a200 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
1a210 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1a220 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 30 35 30  cor0..----..5050
1a230 0d 0a 35 33 34 38 0d 0a 39 30 31 31 0d 0a 0d 0a  ..5348..9011....
1a240 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a250 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2d  .SELECT col0 - -
1a260 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f   tab0.col1 AS co
1a270 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
1a280 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38  --..110..132..18
1a290 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1a2a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1a2b0 54 49 4e 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c  TINCT + tab0.col
1a2c0 31 20 2a 20 2d 20 33 37 20 41 53 20 63 6f 6c 30  1 * - 37 AS col0
1a2d0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30   FROM tab0, tab0
1a2e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a2f0 2d 33 31 38 32 0d 0a 2d 33 33 36 37 0d 0a 2d 33  -3182..-3367..-3
1a300 35 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  589....query I r
1a310 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1a320 4c 4c 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20  LL cor0.col1 AS 
1a330 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
1a340 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
1a350 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
1a360 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
1a370 69 6e 67 20 74 6f 20 37 35 39 39 62 34 38 30 31  ing to 7599b4801
1a380 32 35 64 65 35 32 31 65 66 65 64 37 31 62 35 62  25de521efed71b5b
1a390 32 34 31 33 63 37 64 0d 0a 0d 0a 71 75 65 72 79  2413c7d....query
1a3a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a3b0 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  CT + - col1 + co
1a3c0 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l1 * col2 AS col
1a3d0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1a3e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 37  or0..----..0..27
1a3f0 35 32 0d 0a 37 33 37 31 0d 0a 0d 0a 6f 6e 6c 79  52..7371....only
1a400 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1a410 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1a420 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1a430 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a440 74 20 6c 61 62 65 6c 2d 37 31 37 0d 0a 53 45 4c  t label-717..SEL
1a450 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 28  ECT + col0 DIV (
1a460 20 63 6f 6c 30 20 29 20 2d 20 2d 20 63 6f 6c 30   col0 ) - - col0
1a470 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74   DIV col0 FROM t
1a480 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1a490 2d 0d 0a 32 0d 0a 32 0d 0a 32 0d 0a 0d 0a 73 6b  -..2..2..2....sk
1a4a0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1a4b0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1a4c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a4d0 65 6c 2d 37 31 37 0d 0a 53 45 4c 45 43 54 20 2b  el-717..SELECT +
1a4e0 20 63 6f 6c 30 20 2f 20 28 20 63 6f 6c 30 20 29   col0 / ( col0 )
1a4f0 20 2d 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30   - - col0 / col0
1a500 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1a510 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 32 0d 0a  r0..----..2..2..
1a520 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
1a530 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1a540 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1a550 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1a560 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1a570 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a580 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b  ELECT + col0 * +
1a590 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 63 6f 6c   col0 + col0 col
1a5a0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
1a5b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 34  or0..----..12..4
1a5c0 31 36 30 0d 0a 36 34 38 30 0d 0a 0d 0a 6f 6e 6c  160..6480....onl
1a5d0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1a5e0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1a5f0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1a600 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1a610 72 74 20 6c 61 62 65 6c 2d 37 31 39 0d 0a 53 45  rt label-719..SE
1a620 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  LECT + col2 + - 
1a630 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 41 53  col0 DIV col0 AS
1a640 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1a650 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1a660 0d 0a 33 32 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70  ..32..81....skip
1a670 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1a680 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1a690 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a6a0 2d 37 31 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -719..SELECT + c
1a6b0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 63  ol2 + - col0 / c
1a6c0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
1a6d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1a6e0 2d 2d 2d 0d 0a 30 0d 0a 33 32 0d 0a 38 31 0d 0a  ---..0..32..81..
1a6f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a700 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
1a710 20 31 37 20 2d 20 2d 20 30 20 41 53 20 63 6f 6c   17 - - 0 AS col
1a720 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
1a730 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 33 32  ..----..119..132
1a740 36 0d 0a 31 33 34 33 0d 0a 0d 0a 71 75 65 72 79  6..1343....query
1a750 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a760 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 36 38  CT - col2 + - 68
1a770 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1a780 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 0d 0a  r0..----..-101..
1a790 2d 31 35 30 0d 0a 2d 36 39 0d 0a 0d 0a 6f 6e 6c  -150..-69....onl
1a7a0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1a7b0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1a7c0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1a7d0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1a7e0 72 74 20 6c 61 62 65 6c 2d 37 32 32 0d 0a 53 45  rt label-722..SE
1a7f0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 43 41  LECT - col0 * CA
1a800 53 54 28 20 31 37 20 41 53 20 53 49 47 4e 45 44  ST( 17 AS SIGNED
1a810 20 29 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53   ) DIV - col0 AS
1a820 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1a830 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a  cor0..----..17..
1a840 31 37 0d 0a 31 37 0d 0a 0d 0a 73 6b 69 70 69 66  17..17....skipif
1a850 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1a860 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1a870 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1a880 32 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  22..SELECT - col
1a890 30 20 2a 20 43 41 53 54 20 28 20 31 37 20 41 53  0 * CAST ( 17 AS
1a8a0 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2d 20 63   INTEGER ) / - c
1a8b0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
1a8c0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1a8d0 0d 0a 31 37 0d 0a 31 37 0d 0a 31 37 0d 0a 0d 0a  ..17..17..17....
1a8e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a8f0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30  .SELECT - + cor0
1a900 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20  .col0 + col2 AS 
1a910 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1a920 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
1a930 31 0d 0a 2d 35 32 0d 0a 32 30 0d 0a 0d 0a 71 75  1..-52..20....qu
1a940 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a950 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b  ELECT - - col2 +
1a960 20 2d 20 36 39 20 2a 20 63 6f 72 30 2e 63 6f 6c   - 69 * cor0.col
1a970 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
1a980 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1a990 2d 0d 0a 2d 31 31 33 35 0d 0a 2d 32 31 31 32 0d  -..-1135..-2112.
1a9a0 0a 2d 34 30 34 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-4045....onlyif
1a9b0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1a9c0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1a9d0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1a9e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1a9f0 6c 61 62 65 6c 2d 37 32 35 0d 0a 53 45 4c 45 43  label-725..SELEC
1aa00 54 20 41 4c 4c 20 2d 20 34 35 20 44 49 56 20 2b  T ALL - 45 DIV +
1aa10 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab2.col1 FROM 
1aa20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  tab2..----..-1..
1aa30 2d 32 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2..0....skipif 
1aa40 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1aa50 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1aa60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32  rowsort label-72
1aa70 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  5..SELECT ALL - 
1aa80 34 35 20 2f 20 2b 20 74 61 62 32 2e 63 6f 6c 31  45 / + tab2.col1
1aa90 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1aaa0 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d 0a 71  ..-1..-2..0....q
1aab0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1aac0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1aad0 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  - - col1 + - col
1aae0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1aaf0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
1ab00 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a  -54..-67..23....
1ab10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ab20 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1ab30 20 2b 20 63 6f 6c 32 20 2a 20 38 31 20 2b 20 2d   + col2 * 81 + -
1ab40 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
1ab50 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1ab60 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
1ab70 33 30 0d 0a 31 34 35 38 0d 0a 31 36 33 34 0d 0a  30..1458..1634..
1ab80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ab90 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
1aba0 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  l2 * cor0.col0 +
1abb0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   - cor0.col0 AS 
1abc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
1abd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
1abe0 32 0d 0a 31 39 35 30 0d 0a 32 39 32 33 0d 0a 0d  2..1950..2923...
1abf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ac00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1ac10 31 20 2b 20 2b 20 34 38 20 2a 20 2d 20 63 6f 6c  1 + + 48 * - col
1ac20 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * - cor0.col2 
1ac30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1ac40 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 35 30 37 0d 0a  0..----..32507..
1ac50 33 35 30 32 33 0d 0a 36 39 33 32 39 0d 0a 0d 0a  35023..69329....
1ac60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ac70 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
1ac80 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
1ac90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1aca0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1acb0 0d 0a 31 32 32 35 0d 0a 31 39 30 30 38 0d 0a 36  ..1225..19008..6
1acc0 34 39 35 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  49522....onlyif 
1acd0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1ace0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1acf0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1ad00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ad10 61 62 65 6c 2d 37 33 31 0d 0a 53 45 4c 45 43 54  abel-731..SELECT
1ad20 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20 2d 20   ALL col2 DIV - 
1ad30 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1ad40 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
1ad50 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ..-1..-1....skip
1ad60 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1ad70 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1ad80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ad90 2d 37 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -731..SELECT ALL
1ada0 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32 20 41   col2 / - col2 A
1adb0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
1adc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a  ..----..-1..-1..
1add0 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -1....skipif mys
1ade0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1adf0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1ae00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1ae10 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 38  TINCT - CAST ( 8
1ae20 33 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2d 20  3 AS REAL ) * - 
1ae30 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
1ae40 2d 2d 2d 2d 0d 0a 32 34 39 0d 0a 35 33 31 32 0d  ----..249..5312.
1ae50 0a 36 36 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6640....skipif 
1ae60 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1ae70 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1ae80 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1ae90 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1aea0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1aeb0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1aec0 28 20 2d 20 28 20 63 6f 6c 30 20 29 20 29 20 63  ( - ( col0 ) ) c
1aed0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
1aee0 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37  ---..-7..-78..-7
1aef0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1af00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1af10 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63   cor0.col1 * - c
1af20 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
1af30 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b0 AS cor0 CROSS
1af40 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f   JOIN tab2 AS co
1af50 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
1af60 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 62  es hashing to 9b
1af70 65 30 64 61 62 39 32 64 64 35 30 66 61 66 33 37  e0dab92dd50faf37
1af80 65 65 39 39 61 63 38 64 62 37 63 35 37 64 0d 0a  ee99ac8db7c57d..
1af90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1afa0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
1afb0 20 2b 20 2d 20 28 20 63 6f 6c 32 20 2a 20 32 36   + - ( col2 * 26
1afc0 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
1afd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 35  cor0..----..-145
1afe0 38 0d 0a 2d 31 35 33 39 0d 0a 2d 32 35 39 32 0d  8..-1539..-2592.
1aff0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b000 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1b010 6f 6c 30 20 2b 20 33 36 20 41 53 20 63 6f 6c 32  ol0 + 36 AS col2
1b020 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1b030 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 0d 0a 36  r0..----..125..6
1b040 30 0d 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49  0..71....query I
1b050 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b060 20 28 20 38 36 20 29 20 2b 20 2d 20 63 6f 6c 32   ( 86 ) + - col2
1b070 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
1b080 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1b090 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31 34 0d  or0..----..2114.
1b0a0 0a 32 37 35 0d 0a 33 30 38 38 0d 0a 0d 0a 71 75  .275..3088....qu
1b0b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b0c0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1b0d0 20 2d 20 36 32 20 2a 20 35 38 20 46 52 4f 4d 20   - 62 * 58 FROM 
1b0e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1b0f0 2d 2d 0d 0a 33 35 39 36 0d 0a 0d 0a 73 6b 69 70  --..3596....skip
1b100 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1b110 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1b120 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1b130 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1b140 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1b150 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1b160 20 2b 20 34 39 20 63 6f 6c 30 20 46 52 4f 4d 20   + 49 col0 FROM 
1b170 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1b180 2d 2d 0d 0a 34 39 0d 0a 34 39 0d 0a 34 39 0d 0a  --..49..49..49..
1b190 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b1a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1b1b0 2d 20 28 20 2b 20 34 39 20 29 20 41 53 20 63 6f  - ( + 49 ) AS co
1b1c0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
1b1d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 34  0..----..-49..-4
1b1e0 39 0d 0a 2d 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  9..-49....onlyif
1b1f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1b200 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1b210 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1b220 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1b230 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1b240 65 6c 2d 37 34 31 0d 0a 53 45 4c 45 43 54 20 43  el-741..SELECT C
1b250 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
1b260 4e 45 44 20 29 20 2a 20 33 31 20 46 52 4f 4d 20  NED ) * 31 FROM 
1b270 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1b280 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1b290 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
1b2a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1b2b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1b2c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 31  owsort label-741
1b2d0 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
1b2e0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
1b2f0 29 20 2a 20 33 31 20 46 52 4f 4d 20 74 61 62 30  ) * 31 FROM tab0
1b300 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b310 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
1b320 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b330 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
1b340 74 61 62 32 2e 63 6f 6c 30 20 29 20 2a 20 2d 20  tab2.col0 ) * - 
1b350 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f 6c 30  col1 * tab2.col0
1b360 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1b370 0d 0a 31 30 36 30 39 37 0d 0a 31 35 31 39 0d 0a  ..106097..1519..
1b380 33 35 38 39 35 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  358956....onlyif
1b390 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1b3a0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1b3b0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1b3c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1b3d0 6c 61 62 65 6c 2d 37 34 33 0d 0a 53 45 4c 45 43  label-743..SELEC
1b3e0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 32  T DISTINCT - + 2
1b3f0 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c   DIV col0 AS col
1b400 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1b410 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
1b420 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1b430 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1b440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b450 61 62 65 6c 2d 37 34 33 0d 0a 53 45 4c 45 43 54  abel-743..SELECT
1b460 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 32 20   DISTINCT - + 2 
1b470 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  / col0 AS col2 F
1b480 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1b490 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
1b4a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b4b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1b4c0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d 20  col1 * col1 * - 
1b4d0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1b4e0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1b4f0 2d 0d 0a 32 34 34 30 36 38 0d 0a 36 37 39 30 34  -..244068..67904
1b500 32 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  2..9409....query
1b510 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b520 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d  CT cor0.col0 + -
1b530 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20   col1 * col0 AS 
1b540 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1b550 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
1b560 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d 0a 0d  76..-75..-960...
1b570 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1b580 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1b590 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1b5a0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1b5b0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1b5c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b5d0 54 20 41 4c 4c 20 2b 20 38 31 20 63 6f 6c 31 20  T ALL + 81 col1 
1b5e0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1b5f0 0a 38 31 0d 0a 38 31 0d 0a 38 31 0d 0a 0d 0a 71  .81..81..81....q
1b600 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b610 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1b620 2d 20 63 6f 6c 31 20 2b 20 28 20 2d 20 63 6f 6c  - col1 + ( - col
1b630 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  1 ) AS col1 FROM
1b640 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   tab1..----..-20
1b650 0d 0a 2d 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 6f 6e  ..-26..-52....on
1b660 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1b670 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1b680 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1b690 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1b6a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b6b0 20 6c 61 62 65 6c 2d 37 34 38 0d 0a 53 45 4c 45   label-748..SELE
1b6c0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1b6d0 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54  r0.col2 + - CAST
1b6e0 28 20 2b 20 31 32 20 41 53 20 53 49 47 4e 45 44  ( + 12 AS SIGNED
1b6f0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
1b700 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1b710 2d 2d 0d 0a 31 34 0d 0a 31 35 0d 0a 32 36 0d 0a  --..14..15..26..
1b720 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1b730 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1b740 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b750 20 6c 61 62 65 6c 2d 37 34 38 0d 0a 53 45 4c 45   label-748..SELE
1b760 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1b770 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54  r0.col2 + - CAST
1b780 20 28 20 2b 20 31 32 20 41 53 20 49 4e 54 45 47   ( + 12 AS INTEG
1b790 45 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ER ) AS col2 FRO
1b7a0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1b7b0 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 0d 0a 32 36  ----..14..15..26
1b7c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b7d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b7e0 2d 20 63 6f 6c 30 20 2b 20 38 32 20 2b 20 2d 20  - col0 + 82 + - 
1b7f0 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab2.col2 FROM t
1b800 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a  ab2..----..-22..
1b810 2d 33 35 0d 0a 34 38 0d 0a 0d 0a 73 6b 69 70 69  -35..48....skipi
1b820 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1b830 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1b840 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1b850 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1b860 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1b870 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
1b880 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 32 36   + + col0 * + 26
1b890 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
1b8a0 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 31 37 32 31  .----..132..1721
1b8b0 0d 0a 32 31 37 36 0d 0a 0d 0a 71 75 65 72 79 20  ..2176....query 
1b8c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b8d0 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63  T ALL col2 + - c
1b8e0 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 + col0 AS co
1b8f0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
1b900 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
1b910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b920 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
1b930 2e 63 6f 6c 32 20 2a 20 32 34 20 2b 20 38 34 20  .col2 * 24 + 84 
1b940 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  + - col0 * + col
1b950 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1b960 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 31 37  or0..----..-1117
1b970 0d 0a 2d 35 38 36 39 0d 0a 33 30 30 0d 0a 0d 0a  ..-5869..300....
1b980 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b990 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1b9a0 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 28 20 28 20   - + col1 * ( ( 
1b9b0 63 6f 6c 31 20 29 20 29 20 2b 20 2d 20 28 20 2b  col1 ) ) + - ( +
1b9c0 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f   cor0.col2 ) FRO
1b9d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1b9e0 2d 2d 2d 2d 0d 0a 2d 33 32 37 0d 0a 2d 33 35 30  ----..-327..-350
1b9f0 37 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75 65 72 79  7..-988....query
1ba00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1ba10 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1ba20 6c 32 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31 20  l2 + + ( + col1 
1ba30 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  ) FROM tab1 cor0
1ba40 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d  ..----..109..67.
1ba50 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
1ba60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1ba70 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 39 38 20  ol0 - col0 * 98 
1ba80 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1ba90 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1baa0 0a 2d 36 37 39 0d 0a 2d 37 35 36 36 0d 0a 2d 37  .-679..-7566..-7
1bab0 36 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  663....onlyif my
1bac0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1bad0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1bae0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1baf0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1bb00 65 6c 2d 37 35 36 0d 0a 53 45 4c 45 43 54 20 2b  el-756..SELECT +
1bb10 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30   col0 DIV + col0
1bb20 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
1bb30 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1bb40 0a 37 39 0d 0a 38 0d 0a 38 30 0d 0a 0d 0a 73 6b  .79..8..80....sk
1bb50 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1bb60 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1bb70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1bb80 65 6c 2d 37 35 36 0d 0a 53 45 4c 45 43 54 20 2b  el-756..SELECT +
1bb90 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 2b   col0 / + col0 +
1bba0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1bbb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
1bbc0 39 0d 0a 38 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72  9..8..80....quer
1bbd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1bbe0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
1bbf0 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 38   col0 * col2 + 8
1bc00 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  7 AS col1 FROM t
1bc10 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1bc20 2d 0d 0a 2d 33 35 36 31 0d 0a 2d 37 35 0d 0a 2d  -..-3561..-75..-
1bc30 37 35 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7593....onlyif m
1bc40 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1bc50 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1bc60 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1bc70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1bc80 62 65 6c 2d 37 35 38 0d 0a 53 45 4c 45 43 54 20  bel-758..SELECT 
1bc90 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72  DISTINCT + - cor
1bca0 30 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  0.col0 + - col0 
1bcb0 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  DIV + cor0.col1 
1bcc0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  + cor0.col1 FROM
1bcd0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1bce0 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 36 36 0d 0a 32  ---..-20..-66..2
1bcf0 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
1bd00 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1bd10 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1bd20 6f 72 74 20 6c 61 62 65 6c 2d 37 35 38 0d 0a 53  ort label-758..S
1bd30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1bd40 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d   - cor0.col0 + -
1bd50 20 63 6f 6c 30 20 2f 20 2b 20 63 6f 72 30 2e 63   col0 / + cor0.c
1bd60 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 + cor0.col1 
1bd70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1bd80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 36  0..----..-20..-6
1bd90 36 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49  6..24....query I
1bda0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bdb0 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 38 34 20 2b   - col0 * + 84 +
1bdc0 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74   ( col0 ) FROM t
1bdd0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1bde0 2d 0d 0a 2d 31 39 39 32 0d 0a 2d 32 39 30 35 0d  -..-1992..-2905.
1bdf0 0a 2d 37 33 38 37 0d 0a 0d 0a 71 75 65 72 79 20  .-7387....query 
1be00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1be10 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
1be20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b  + - ( col2 ) * +
1be30 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
1be40 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1be50 2d 2d 0d 0a 2d 31 30 36 35 0d 0a 2d 36 36 33 35  --..-1065..-6635
1be60 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..34....query I 
1be70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1be80 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 37  ALL - col0 * - 7
1be90 34 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  4 + col0 FROM ta
1bea0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1beb0 0d 0a 32 32 35 0d 0a 34 38 30 30 0d 0a 36 30 30  ..225..4800..600
1bec0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1bed0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1bee0 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  TINCT - - cor0.c
1bef0 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63  ol1 * col1 * - c
1bf00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
1bf10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 37 35 30  r0..----..-17750
1bf20 34 0d 0a 2d 33 32 39 33 31 35 0d 0a 2d 37 33 37  4..-329315..-737
1bf30 30 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  009....query I r
1bf40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1bf50 4c 4c 20 63 6f 6c 30 20 2a 20 31 32 20 2b 20 63  LL col0 * 12 + c
1bf60 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 + cor0.col1 
1bf70 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  * col2 * + col2 
1bf80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1bf90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1bfa0 0a 31 32 30 38 36 34 0d 0a 33 33 33 31 35 0d 0a  .120864..33315..
1bfb0 37 35 39 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  75906....onlyif 
1bfc0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1bfd0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1bfe0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1bff0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1c000 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c010 6c 2d 37 36 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-764..SELECT DI
1c020 53 54 49 4e 43 54 20 43 41 53 54 28 20 2b 20 32  STINCT CAST( + 2
1c030 34 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  4 AS SIGNED ) * 
1c040 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
1c050 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c060 2d 31 34 31 36 0d 0a 2d 34 30 38 0d 0a 2d 37 34  -1416..-408..-74
1c070 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
1c080 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1c090 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1c0a0 6f 72 74 20 6c 61 62 65 6c 2d 37 36 34 0d 0a 53  ort label-764..S
1c0b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
1c0c0 41 53 54 20 28 20 2b 20 32 34 20 41 53 20 49 4e  AST ( + 24 AS IN
1c0d0 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 31  TEGER ) * - col1
1c0e0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1c0f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 36 0d  r0..----..-1416.
1c100 0a 2d 34 30 38 0d 0a 2d 37 34 34 0d 0a 0d 0a 71  .-408..-744....q
1c110 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c120 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
1c130 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  * - col2 * col0 
1c140 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1c150 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 33 36 0d  0..----..207936.
1c160 0a 37 33 37 32 38 30 0d 0a 38 37 34 38 0d 0a 0d  .737280..8748...
1c170 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c180 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1c190 54 20 2b 20 31 20 2a 20 2d 20 33 20 41 53 20 63  T + 1 * - 3 AS c
1c1a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1c1b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
1c1c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c1d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1c1e0 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20   - ( - col1 ) * 
1c1f0 63 6f 6c 31 20 2a 20 2b 20 39 30 20 41 53 20 63  col1 * + 90 AS c
1c200 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
1c210 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 32 31 30  r0..----..-15210
1c220 0d 0a 2d 36 30 38 34 30 0d 0a 2d 39 30 30 30 0d  ..-60840..-9000.
1c230 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c240 72 74 0d 0a 53 45 4c 45 43 54 20 35 37 20 2b 20  rt..SELECT 57 + 
1c250 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1c260 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
1c270 33 0d 0a 31 34 38 0d 0a 31 35 34 0d 0a 0d 0a 71  3..148..154....q
1c280 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c290 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c2a0 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f 72  ( - col2 ) * cor
1c2b0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
1c2c0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1c2d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30 38  ..----..-1..-108
1c2e0 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 71 75 65 72  9..-6724....quer
1c2f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c300 45 43 54 20 2b 20 39 39 20 46 52 4f 4d 20 74 61  ECT + 99 FROM ta
1c310 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
1c320 39 0d 0a 39 39 0d 0a 39 39 0d 0a 0d 0a 6f 6e 6c  9..99..99....onl
1c330 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1c340 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1c350 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1c360 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1c370 72 74 20 6c 61 62 65 6c 2d 37 37 31 0d 0a 53 45  rt label-771..SE
1c380 4c 45 43 54 20 41 4c 4c 20 28 20 39 20 29 20 44  LECT ALL ( 9 ) D
1c390 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f  IV cor0.col2 FRO
1c3a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1c3b0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 39 0d 0a 0d  ----..0..0..9...
1c3c0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1c3d0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1c3e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1c3f0 6c 61 62 65 6c 2d 37 37 31 0d 0a 53 45 4c 45 43  label-771..SELEC
1c400 54 20 41 4c 4c 20 28 20 39 20 29 20 2f 20 63 6f  T ALL ( 9 ) / co
1c410 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
1c420 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1c430 0a 30 0d 0a 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72  .0..0..9....quer
1c440 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c450 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
1c460 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
1c470 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
1c480 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1c490 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
1c4a0 6e 67 20 74 6f 20 32 64 36 64 33 30 33 31 64 66  ng to 2d6d3031df
1c4b0 65 39 30 65 30 63 30 32 64 62 31 33 61 61 36 33  e90e0c02db13aa63
1c4c0 39 39 33 62 66 64 0d 0a 0d 0a 73 6b 69 70 69 66  993bfd....skipif
1c4d0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1c4e0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1c4f0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1c500 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
1c510 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
1c520 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1c530 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c  ol1 + + col2 col
1c540 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
1c550 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d  -..119..173..98.
1c560 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c570 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
1c580 30 2e 63 6f 6c 32 20 2a 20 37 34 20 46 52 4f 4d  0.col2 * 74 FROM
1c590 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
1c5a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
1c5b0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32  ues hashing to 2
1c5c0 31 37 66 33 34 32 36 39 64 63 30 36 37 33 35 31  17f34269dc067351
1c5d0 61 64 30 31 64 63 34 33 34 34 39 66 35 31 34 0d  ad01dc43449f514.
1c5e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c5f0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1c600 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 36  NCT - col2 + - 6
1c610 33 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  3 FROM tab2..---
1c620 2d 0d 0a 2d 31 30 31 0d 0a 2d 38 39 0d 0a 2d 39  -..-101..-89..-9
1c630 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1c640 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1c650 32 20 2d 20 2b 20 37 32 20 46 52 4f 4d 20 74 61  2 - + 72 FROM ta
1c660 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d  b1..----..-15..-
1c670 31 38 0d 0a 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  18..24....onlyif
1c680 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1c690 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1c6a0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1c6b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1c6c0 6c 61 62 65 6c 2d 37 37 37 0d 0a 53 45 4c 45 43  label-777..SELEC
1c6d0 54 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20  T col2 DIV col2 
1c6e0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52  + col1 * col0 FR
1c6f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1c700 0a 2d 2d 2d 2d 0d 0a 31 30 34 31 0d 0a 36 34 31  .----..1041..641
1c710 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..79....skipif m
1c720 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1c730 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1c740 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 37  owsort label-777
1c750 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20  ..SELECT col2 / 
1c760 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  col2 + col1 * co
1c770 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1c780 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 31  cor0..----..1041
1c790 0d 0a 36 34 31 0d 0a 37 39 0d 0a 0d 0a 71 75 65  ..641..79....que
1c7a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c7b0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20  LECT + - col0 + 
1c7c0 28 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  ( cor0.col2 + co
1c7d0 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
1c7e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1c7f0 2d 2d 2d 2d 0d 0a 36 33 0d 0a 38 34 0d 0a 39 35  ----..63..84..95
1c800 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1c810 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1c820 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1c830 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1c840 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c850 37 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  779..SELECT DIST
1c860 49 4e 43 54 20 31 37 20 2b 20 2b 20 63 6f 6c 30  INCT 17 + + col0
1c870 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f   + col2 DIV - co
1c880 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1c890 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
1c8a0 39 34 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70 69 66  94..95....skipif
1c8b0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1c8c0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1c8d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1c8e0 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  79..SELECT DISTI
1c8f0 4e 43 54 20 31 37 20 2b 20 2b 20 63 6f 6c 30 20  NCT 17 + + col0 
1c900 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20  + col2 / - col1 
1c910 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1c920 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 39 34 0d  0..----..24..94.
1c930 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .95....query I r
1c940 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
1c950 20 28 20 2b 20 63 6f 6c 32 20 29 20 29 20 2a 20   ( + col2 ) ) * 
1c960 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
1c970 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1c980 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d  ----..162..3648.
1c990 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7680....query I
1c9a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c9b0 20 2b 20 39 38 20 41 53 20 63 6f 6c 32 20 46 52   + 98 AS col2 FR
1c9c0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
1c9d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1c9e0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1c9f0 20 66 39 64 65 65 38 63 32 31 31 31 36 66 31 61   f9dee8c21116f1a
1ca00 65 64 36 34 61 63 35 31 36 30 65 31 39 30 38 30  ed64ac5160e19080
1ca10 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1ca20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1ca30 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 31 20  TINCT tab0.col1 
1ca40 2b 20 39 33 20 2a 20 33 36 20 46 52 4f 4d 20 74  + 93 * 36 FROM t
1ca50 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 33 34 0d  ab0..----..3434.
1ca60 0a 33 34 33 39 0d 0a 33 34 34 35 0d 0a 0d 0a 71  .3439..3445....q
1ca70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ca80 53 45 4c 45 43 54 20 2d 20 2b 20 33 37 20 2b 20  SELECT - + 37 + 
1ca90 39 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  95 AS col0 FROM 
1caa0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1cab0 2d 2d 0d 0a 35 38 0d 0a 35 38 0d 0a 35 38 0d 0a  --..58..58..58..
1cac0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cad0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33 31  t..SELECT + - 31
1cae0 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
1caf0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1cb00 2d 0d 0a 2d 32 31 37 0d 0a 2d 32 34 31 38 0d 0a  -..-217..-2418..
1cb10 2d 32 34 34 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  -2449....skipif 
1cb20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1cb30 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1cb40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cb50 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20  DISTINCT CAST ( 
1cb60 63 6f 6c 31 20 41 53 20 52 45 41 4c 20 29 20 2a  col1 AS REAL ) *
1cb70 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
1cb80 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
1cb90 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
1cba0 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
1cbb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1cbc0 37 33 20 2a 20 28 20 63 6f 6c 32 20 2a 20 63 6f  73 * ( col2 * co
1cbd0 6c 32 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a  l2 + tab1.col0 *
1cbe0 20 2b 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   + col2 ) AS col
1cbf0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1cc00 2d 0d 0a 2d 31 32 33 33 34 30 38 0d 0a 2d 32 32  -..-1233408..-22
1cc10 34 36 39 34 0d 0a 2d 35 30 33 34 38 31 0d 0a 0d  4694..-503481...
1cc20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cc30 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
1cc40 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  0 * + col0 + col
1cc50 30 20 2a 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  0 * col2 ) AS co
1cc60 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
1cc70 2d 2d 0d 0a 2d 31 32 36 30 0d 0a 2d 31 33 36 38  --..-1260..-1368
1cc80 0d 0a 2d 31 35 32 31 39 0d 0a 0d 0a 71 75 65 72  ..-15219....quer
1cc90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cca0 45 43 54 20 2d 20 32 35 20 2a 20 33 35 20 46 52  ECT - 25 * 35 FR
1ccb0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1ccc0 38 37 35 0d 0a 2d 38 37 35 0d 0a 2d 38 37 35 0d  875..-875..-875.
1ccd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1cce0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74  rt..SELECT ALL t
1ccf0 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  ab0.col0 AS col0
1cd00 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
1cd10 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
1cd20 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1cd30 68 61 73 68 69 6e 67 20 74 6f 20 39 66 63 31 64  hashing to 9fc1d
1cd40 63 64 37 36 66 65 61 66 34 33 65 35 63 35 64 63  cd76feaf43e5c5dc
1cd50 30 36 30 61 30 32 30 31 34 63 64 0d 0a 0d 0a 6f  060a02014cd....o
1cd60 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1cd70 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1cd80 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1cd90 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1cda0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cdb0 74 20 6c 61 62 65 6c 2d 37 39 30 0d 0a 53 45 4c  t label-790..SEL
1cdc0 45 43 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  ECT - CAST( NULL
1cdd0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
1cde0 20 38 33 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   83 FROM tab1..-
1cdf0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
1ce00 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
1ce10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1ce20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1ce30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39  rowsort label-79
1ce40 30 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  0..SELECT - CAST
1ce50 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
1ce60 45 52 20 29 20 2a 20 2d 20 38 33 20 46 52 4f 4d  ER ) * - 83 FROM
1ce70 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab1..----..NUL
1ce80 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1ce90 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1cea0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1ceb0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1cec0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1ced0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1cee0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1cef0 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  T col0 + + col1 
1cf00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
1cf10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a  or0..----..110..
1cf20 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72  132..180....quer
1cf30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cf40 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT - - cor0.col
1cf50 32 20 2d 20 2d 20 31 33 20 46 52 4f 4d 20 74 61  2 - - 13 FROM ta
1cf60 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1cf70 0d 0a 31 30 39 0d 0a 36 37 0d 0a 37 30 0d 0a 0d  ..109..67..70...
1cf80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cf90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1cfa0 6f 6c 31 20 2a 20 2b 20 28 20 31 37 20 29 20 2b  ol1 * + ( 17 ) +
1cfb0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1cfc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1cfd0 31 34 32 39 0d 0a 2d 31 34 36 35 0d 0a 2d 31 36  1429..-1465..-16
1cfe0 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
1cff0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1d000 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  + cor0.col2 + + 
1d010 33 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  30 AS col0 FROM 
1d020 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1d030 2d 2d 0d 0a 31 31 32 0d 0a 33 31 0d 0a 36 33 0d  --..112..31..63.
1d040 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1d050 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
1d060 31 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  1 - col1 * - col
1d070 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1d080 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 0d 0a  or0..----..156..
1d090 36 35 30 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79  650..90....query
1d0a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d0b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 32 20  CT DISTINCT + 2 
1d0c0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1d0d0 32 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 0d 0a 71 75  2..----..2....qu
1d0e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d0f0 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c  ELECT + tab0.col
1d100 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 + - col1 * col
1d110 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
1d120 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d  -..-2752..-7371.
1d130 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1d140 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1d150 4c 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  L col0 + - col0 
1d160 2d 20 39 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 90 AS col0 FRO
1d170 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  M tab1..----..-9
1d180 30 0d 0a 2d 39 30 0d 0a 2d 39 30 0d 0a 0d 0a 73  0..-90..-90....s
1d190 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1d1a0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1d1b0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1d1c0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1d1d0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1d1e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d1f0 2d 20 63 6f 6c 31 20 2a 20 2d 20 33 39 20 63 6f  - col1 * - 39 co
1d200 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
1d210 2d 2d 0d 0a 31 32 30 39 0d 0a 32 33 30 31 0d 0a  --..1209..2301..
1d220 36 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  663....query I r
1d230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1d240 20 63 6f 6c 31 20 2a 20 39 20 46 52 4f 4d 20 74   col1 * 9 FROM t
1d250 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 0d  ab1..----..-117.
1d260 0a 2d 32 33 34 0d 0a 2d 39 30 0d 0a 0d 0a 71 75  .-234..-90....qu
1d270 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d280 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1d290 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2b   col0 + col0 * +
1d2a0 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f   tab2.col0 AS co
1d2b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
1d2c0 2d 2d 0d 0a 34 32 0d 0a 36 30 30 36 0d 0a 36 31  --..42..6006..61
1d2d0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
1d2e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1d2f0 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 28 20 2d  L + + col1 + ( -
1d300 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
1d310 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1d320 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33  0..----..-21..33
1d330 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..4....query I r
1d340 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1d350 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 32  ISTINCT - - col2
1d360 20 2a 20 38 30 20 41 53 20 63 6f 6c 30 20 46 52   * 80 AS col0 FR
1d370 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1d380 0a 2d 2d 2d 2d 0d 0a 32 36 34 30 0d 0a 36 35 36  .----..2640..656
1d390 30 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  0..80....onlyif 
1d3a0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1d3b0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1d3c0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1d3d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1d3e0 61 62 65 6c 2d 38 30 34 0d 0a 53 45 4c 45 43 54  abel-804..SELECT
1d3f0 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f   ALL + col2 + co
1d400 6c 32 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d  l2 DIV col1 FROM
1d410 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1d420 2d 2d 2d 0d 0a 31 30 33 0d 0a 35 36 0d 0a 36 32  ---..103..56..62
1d430 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1d440 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1d450 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1d460 72 74 20 6c 61 62 65 6c 2d 38 30 34 0d 0a 53 45  rt label-804..SE
1d470 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20  LECT ALL + col2 
1d480 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52  + col2 / col1 FR
1d490 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d4a0 0a 2d 2d 2d 2d 0d 0a 31 30 33 0d 0a 35 36 0d 0a  .----..103..56..
1d4b0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  62....query IIII
1d4c0 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73  IIIIIIIIIII rows
1d4d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
1d4e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
1d4f0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c  CROSS JOIN tab0,
1d500 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74   tab1 AS cor1, t
1d510 61 62 32 2c 20 74 61 62 32 20 63 6f 72 32 0d 0a  ab2, tab2 cor2..
1d520 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65  ----..3645 value
1d530 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 36 32  s hashing to b62
1d540 63 31 65 62 63 36 38 31 61 63 61 37 32 64 31 33  c1ebc681aca72d13
1d550 66 65 61 64 62 38 38 38 62 33 62 65 37 0d 0a 0d  feadb888b3be7...
1d560 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1d570 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1d580 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1d590 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1d5a0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1d5b0 6f 72 74 20 6c 61 62 65 6c 2d 38 30 36 0d 0a 53  ort label-806..S
1d5c0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 43  ELECT + col1 + C
1d5d0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
1d5e0 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2d  NED ) * - col1 -
1d5f0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   + col1 AS col2 
1d600 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1d610 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1d620 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1d630 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1d640 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1d650 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1d660 6c 2d 38 30 36 0d 0a 53 45 4c 45 43 54 20 2b 20  l-806..SELECT + 
1d670 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20 4e 55  col1 + CAST ( NU
1d680 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1d690 2a 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c  * - col1 - + col
1d6a0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
1d6b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1d6c0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1d6d0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
1d6e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1d6f0 20 36 32 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 28   62 * - col1 * (
1d700 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 29 20 41   col1 + col1 ) A
1d710 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1d720 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 30 30 0d 0a  ..----..-12400..
1d730 2d 32 30 39 35 36 0d 0a 2d 38 33 38 32 34 0d 0a  -20956..-83824..
1d740 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d750 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1d760 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  CT + col1 * col0
1d770 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
1d780 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36  ab2..----..-1196
1d790 35 32 0d 0a 2d 35 31 30 33 34 0d 0a 2d 35 38 35  52..-51034..-585
1d7a0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1d7b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1d7c0 54 49 4e 43 54 20 2b 20 35 33 20 2a 20 63 6f 6c  TINCT + 53 * col
1d7d0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
1d7e0 2d 0d 0a 31 35 39 0d 0a 33 33 39 32 0d 0a 34 32  -..159..3392..42
1d7f0 34 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  40....skipif pos
1d800 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
1d810 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
1d820 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
1d830 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
1d840 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d850 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1d860 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 28 20  col0 * col2 * ( 
1d870 2b 20 33 36 20 2a 20 2b 20 74 61 62 31 2e 63 6f  + 36 * + tab1.co
1d880 6c 32 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l2 ) col0 FROM t
1d890 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 36 35 34 32  ab1..----..26542
1d8a0 30 38 30 0d 0a 33 31 34 39 32 38 0d 0a 37 34 38  080..314928..748
1d8b0 35 36 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  5696....skipif p
1d8c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1d8d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1d8e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1d8f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1d900 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d910 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
1d920 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20 74 61 62  ab1.col0 * + tab
1d930 31 2e 63 6f 6c 32 20 2b 20 31 39 20 63 6f 6c 30  1.col2 + 19 col0
1d940 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
1d950 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
1d960 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1d970 68 69 6e 67 20 74 6f 20 32 39 63 34 33 39 35 64  hing to 29c4395d
1d980 62 64 62 36 37 66 62 36 38 37 32 63 62 62 65 36  bdb67fb6872cbbe6
1d990 31 63 64 38 36 34 35 31 0d 0a 0d 0a 6f 6e 6c 79  1cd86451....only
1d9a0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1d9b0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1d9c0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1d9d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d9e0 74 20 6c 61 62 65 6c 2d 38 31 32 0d 0a 53 45 4c  t label-812..SEL
1d9f0 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 44 49 56  ECT - - col0 DIV
1da00 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a   col1 + - col1 *
1da10 20 2d 20 32 38 20 41 53 20 63 6f 6c 30 20 46 52   - 28 AS col0 FR
1da20 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1da30 0a 2d 2d 2d 2d 0d 0a 32 38 36 0d 0a 33 37 30 0d  .----..286..370.
1da40 0a 37 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .728....skipif m
1da50 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1da60 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1da70 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 32  owsort label-812
1da80 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
1da90 30 20 2f 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  0 / col1 + - col
1daa0 31 20 2a 20 2d 20 32 38 20 41 53 20 63 6f 6c 30  1 * - 28 AS col0
1dab0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1dac0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36 0d 0a 33  r0..----..286..3
1dad0 37 30 0d 0a 37 32 38 0d 0a 0d 0a 71 75 65 72 79  70..728....query
1dae0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1daf0 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  CT - col2 + col0
1db00 20 2a 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20   * + ( - col1 ) 
1db10 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1db20 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1db30 0a 2d 31 33 38 31 0d 0a 2d 32 34 34 0d 0a 2d 34  .-1381..-244..-4
1db40 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  628....query I r
1db50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1db60 20 31 36 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20   16 + + col0 AS 
1db70 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1db80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
1db90 35 0d 0a 34 30 0d 0a 35 31 0d 0a 0d 0a 71 75 65  5..40..51....que
1dba0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1dbb0 4c 45 43 54 20 41 4c 4c 20 32 33 20 2b 20 2b 20  LECT ALL 23 + + 
1dbc0 74 61 62 30 2e 63 6f 6c 32 20 2d 20 2d 20 63 6f  tab0.col2 - - co
1dbd0 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63  l2 * + col2 AS c
1dbe0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
1dbf0 2d 2d 2d 0d 0a 31 31 34 35 0d 0a 32 35 0d 0a 36  ---..1145..25..6
1dc00 38 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  829....query I r
1dc10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1dc20 49 53 54 49 4e 43 54 20 2b 20 35 32 20 2d 20 2b  ISTINCT + 52 - +
1dc30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
1dc40 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 32 38 0d  .----..-12..-28.
1dc50 0a 34 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .49....skipif po
1dc60 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1dc70 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1dc80 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1dc90 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1dca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1dcb0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30  .SELECT - - cor0
1dcc0 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20  .col1 col2 FROM 
1dcd0 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61 62 32  tab1, tab2, tab2
1dce0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1dcf0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
1dd00 67 20 74 6f 20 37 35 39 39 62 34 38 30 31 32 35  g to 7599b480125
1dd10 64 65 35 32 31 65 66 65 64 37 31 62 35 62 32 34  de521efed71b5b24
1dd20 31 33 63 37 64 0d 0a 0d 0a 71 75 65 72 79 20 49  13c7d....query I
1dd30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1dd40 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20 2d 20   ALL - col0 - - 
1dd50 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col2 * - col1 FR
1dd60 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1dd70 31 33 32 38 0d 0a 2d 31 34 30 37 0d 0a 2d 36 33  1328..-1407..-63
1dd80 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1dd90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
1dda0 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
1ddb0 6f 6c 32 20 2b 20 38 31 20 46 52 4f 4d 20 74 61  ol2 + 81 FROM ta
1ddc0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1ddd0 0d 0a 2d 31 36 0d 0a 2d 32 37 35 37 0d 0a 2d 37  ..-16..-2757..-7
1dde0 33 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  381....query I r
1ddf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1de00 49 53 54 49 4e 43 54 20 33 33 20 2a 20 2d 20 63  ISTINCT 33 * - c
1de10 6f 6c 31 20 2a 20 2d 20 33 20 46 52 4f 4d 20 74  ol1 * - 3 FROM t
1de20 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 33 0d  ab2..----..1683.
1de30 0a 33 30 36 39 0d 0a 35 38 34 31 0d 0a 0d 0a 71  .3069..5841....q
1de40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1de50 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f  SELECT col1 + co
1de60 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l2 + + cor0.col0
1de70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1de80 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1de90 0d 0a 31 33 33 0d 0a 31 34 33 0d 0a 32 36 32 0d  ..133..143..262.
1dea0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1deb0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1dec0 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 36 34 20  NCT - col2 * 64 
1ded0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1dee0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1def0 0a 2d 32 31 31 32 0d 0a 2d 35 32 34 38 0d 0a 2d  .-2112..-5248..-
1df00 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
1df10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1df20 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f  STINCT col0 * co
1df30 6c 30 20 2a 20 2b 20 34 31 20 2b 20 2d 20 63 6f  l0 * + 41 + - co
1df40 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 * - col1 AS c
1df50 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1df60 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 30   cor0..----..310
1df70 31 32 0d 0a 33 33 33 30 34 32 0d 0a 35 39 36 33  12..333042..5963
1df80 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1df90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1dfa0 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 31  ol2 + col1 * - 1
1dfb0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
1dfc0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1dfd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
1dfe0 30 0d 0a 33 0d 0a 34 35 0d 0a 0d 0a 6f 6e 6c 79  0..3..45....only
1dff0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1e000 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1e010 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1e020 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1e030 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1e040 61 62 65 6c 2d 38 32 35 0d 0a 53 45 4c 45 43 54  abel-825..SELECT
1e050 20 2b 20 63 6f 6c 30 20 2a 20 43 41 53 54 28 20   + col0 * CAST( 
1e060 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
1e070 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   + cor0.col0 * -
1e080 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 28   cor0.col2 * + (
1e090 20 2b 20 38 34 20 29 20 41 53 20 63 6f 6c 32 20   + 84 ) AS col2 
1e0a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1e0b0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1e0c0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1e0d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1e0e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1e0f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1e100 6c 2d 38 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20  l-825..SELECT + 
1e110 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55  col0 * CAST ( NU
1e120 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
1e130 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  + cor0.col0 * - 
1e140 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 28 20  cor0.col2 * + ( 
1e150 2b 20 38 34 20 29 20 41 53 20 63 6f 6c 32 20 46  + 84 ) AS col2 F
1e160 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1e170 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1e180 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
1e190 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e1a0 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 28  ECT ALL col1 * (
1e1b0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 29 20 46   col0 + col1 ) F
1e1c0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
1e1d0 2d 2d 2d 0d 0a 31 32 38 30 34 0d 0a 31 36 33 38  ---..12804..1638
1e1e0 30 0d 0a 39 34 36 30 0d 0a 0d 0a 71 75 65 72 79  0..9460....query
1e1f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e200 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  CT - + col1 * + 
1e210 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  col0 + col2 + co
1e220 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1e230 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34  cor0..----..-194
1e240 35 0d 0a 2d 33 32 39 37 0d 0a 2d 37 39 32 36 0d  5..-3297..-7926.
1e250 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e260 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 36 20  rt..SELECT + 36 
1e270 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
1e280 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e290 34 36 0d 0a 34 39 0d 0a 36 32 0d 0a 0d 0a 6f 6e  46..49..62....on
1e2a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1e2b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1e2c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1e2d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1e2e0 6f 72 74 20 6c 61 62 65 6c 2d 38 32 39 0d 0a 53  ort label-829..S
1e2f0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 44 49 56  ELECT - col2 DIV
1e300 20 2d 20 33 37 20 46 52 4f 4d 20 74 61 62 30 20   - 37 FROM tab0 
1e310 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1e320 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..2....skipif
1e330 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1e340 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1e350 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1e360 32 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  29..SELECT - col
1e370 32 20 2f 20 2d 20 33 37 20 46 52 4f 4d 20 74 61  2 / - 37 FROM ta
1e380 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1e390 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a 0d 0a 71 75 65  ..0..0..2....que
1e3a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e3b0 4c 45 43 54 20 2d 20 32 34 20 2b 20 2b 20 33 35  LECT - 24 + + 35
1e3c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1e3d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1e3e0 0d 0a 31 31 0d 0a 31 31 0d 0a 31 31 0d 0a 0d 0a  ..11..11..11....
1e3f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e400 0a 53 45 4c 45 43 54 20 33 34 20 2a 20 2d 20 28  .SELECT 34 * - (
1e410 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   + col0 ) AS col
1e420 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1e430 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 30  or0..----..-1190
1e440 0d 0a 2d 33 30 32 36 0d 0a 2d 38 31 36 0d 0a 0d  ..-3026..-816...
1e450 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e460 0d 0a 53 45 4c 45 43 54 20 34 33 20 2a 20 63 6f  ..SELECT 43 * co
1e470 72 30 2e 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 30  r0.col0 * ( col0
1e480 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
1e490 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 31  cor0..----..1761
1e4a0 32 38 0d 0a 32 37 35 32 30 30 0d 0a 33 38 37 0d  28..275200..387.
1e4b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1e4c0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
1e4d0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
1e4e0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
1e4f0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
1e500 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 33 0d  wsort label-833.
1e510 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e520 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
1e530 6f 6c 30 20 2a 20 43 41 53 54 28 20 2b 20 63 6f  ol0 * CAST( + co
1e540 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l1 AS SIGNED ) A
1e550 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1e560 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e570 2d 32 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38  -2040..-3360..-8
1e580 30 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  010....skipif my
1e590 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1e5a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1e5b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 33 33 0d  wsort label-833.
1e5c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e5d0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
1e5e0 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 2b 20 63  ol0 * CAST ( + c
1e5f0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
1e600 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1e610 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1e620 0d 0a 2d 32 30 34 30 0d 0a 2d 33 33 36 30 0d 0a  ..-2040..-3360..
1e630 2d 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -8010....query I
1e640 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e650 20 30 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20   0 + ( + col1 ) 
1e660 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1e670 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73  .86..91..97....s
1e680 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1e690 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1e6a0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1e6b0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1e6c0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1e6d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e6e0 2d 20 35 37 20 2a 20 63 6f 6c 31 20 63 6f 6c 30  - 57 * col1 col0
1e6f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1e700 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 36 37 0d  r0..----..-1767.
1e710 0a 2d 33 33 36 33 0d 0a 2d 39 36 39 0d 0a 0d 0a  .-3363..-969....
1e720 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1e730 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1e740 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1e750 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1e760 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1e770 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e780 20 35 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   53 col2 FROM ta
1e790 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
1e7a0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
1e7b0 20 68 61 73 68 69 6e 67 20 74 6f 20 66 65 64 65   hashing to fede
1e7c0 36 30 33 33 64 65 65 33 34 36 64 62 64 32 37 32  6033dee346dbd272
1e7d0 30 38 35 63 30 35 37 32 34 66 64 61 0d 0a 0d 0a  085c05724fda....
1e7e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e7f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1e800 6c 31 20 2a 20 39 34 20 46 52 4f 4d 20 74 61 62  l1 * 94 FROM tab
1e810 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 38 0d 0a  2..----..-1598..
1e820 2d 32 39 31 34 0d 0a 2d 35 35 34 36 0d 0a 0d 0a  -2914..-5546....
1e830 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e840 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2b  .SELECT col0 * +
1e850 20 63 6f 6c 32 20 2b 20 2d 20 33 35 20 46 52 4f   col2 + - 35 FRO
1e860 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e870 2d 2d 2d 2d 0d 0a 31 35 34 0d 0a 31 39 39 33 0d  ----..154..1993.
1e880 0a 32 39 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .2967....query I
1e890 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e8a0 20 44 49 53 54 49 4e 43 54 20 36 37 20 2b 20 2b   DISTINCT 67 + +
1e8b0 20 63 6f 6c 31 20 2b 20 28 20 63 6f 72 30 2e 63   col1 + ( cor0.c
1e8c0 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol0 ) FROM tab1 
1e8d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 0d  cor0..----..141.
1e8e0 0a 31 36 30 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72  .160..96....quer
1e8f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e900 45 43 54 20 44 49 53 54 49 4e 43 54 20 32 30 20  ECT DISTINCT 20 
1e910 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * - col1 AS col1
1e920 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1e930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 30 0d 0a  r0..----..-200..
1e940 2d 32 36 30 0d 0a 2d 35 32 30 0d 0a 0d 0a 71 75  -260..-520....qu
1e950 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e960 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2d  ELECT - - col1 -
1e970 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1e980 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1e990 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75  .53..9..96....qu
1e9a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e9b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1e9c0 20 36 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f   60 + - col0 FRO
1e9d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e9e0 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 31 39 0d 0a  ----..-18..-19..
1e9f0 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
1ea00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 31  wsort..SELECT 21
1ea10 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
1ea20 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1ea30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a  or0..----..117..
1ea40 37 35 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  75..78....query 
1ea50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ea60 54 20 41 4c 4c 20 2b 20 38 31 20 41 53 20 63 6f  T ALL + 81 AS co
1ea70 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
1ea80 2d 2d 0d 0a 38 31 0d 0a 38 31 0d 0a 38 31 0d 0a  --..81..81..81..
1ea90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1eaa0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
1eab0 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  col2 + col1 + - 
1eac0 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61  ( col0 ) FROM ta
1ead0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1eae0 0d 0a 2d 31 30 30 0d 0a 2d 33 0d 0a 2d 34 35 0d  ..-100..-3..-45.
1eaf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1eb00 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 35 20  rt..SELECT - 15 
1eb10 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
1eb20 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
1eb30 2d 2d 2d 0d 0a 2d 38 0d 0a 36 33 0d 0a 36 34 0d  ---..-8..63..64.
1eb40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1eb50 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1eb60 4e 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  NCT - col0 + - c
1eb70 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 32 20 29  ol0 * - ( col2 )
1eb80 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1eb90 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1eba0 0d 0a 31 35 39 0d 0a 33 35 38 34 0d 0a 37 36 30  ..159..3584..760
1ebb0 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
1ebc0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1ebd0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1ebe0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1ebf0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ec00 2d 38 34 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -848..SELECT ALL
1ec10 20 28 20 2d 20 63 6f 6c 30 20 29 20 44 49 56 20   ( - col0 ) DIV 
1ec20 32 34 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63  24 - - col1 AS c
1ec30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
1ec40 2d 2d 2d 0d 0a 31 34 0d 0a 33 31 0d 0a 35 36 0d  ---..14..31..56.
1ec50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1ec60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1ec70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ec80 74 20 6c 61 62 65 6c 2d 38 34 38 0d 0a 53 45 4c  t label-848..SEL
1ec90 45 43 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 30  ECT ALL ( - col0
1eca0 20 29 20 2f 20 32 34 20 2d 20 2d 20 63 6f 6c 31   ) / 24 - - col1
1ecb0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1ecc0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 33 31  b2..----..14..31
1ecd0 0d 0a 35 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..56....onlyif m
1ece0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
1ecf0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
1ed00 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
1ed10 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
1ed20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1ed30 2d 38 34 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -849..SELECT ALL
1ed40 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b   + cor0.col0 * +
1ed50 20 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 2b 20   CAST( - col2 + 
1ed60 2d 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  - col2 AS SIGNED
1ed70 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
1ed80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 38  cor0..----..-378
1ed90 0d 0a 2d 34 30 35 36 0d 0a 2d 36 30 30 34 0d 0a  ..-4056..-6004..
1eda0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1edb0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1edc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1edd0 20 6c 61 62 65 6c 2d 38 34 39 0d 0a 53 45 4c 45   label-849..SELE
1ede0 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
1edf0 6c 30 20 2a 20 2b 20 43 41 53 54 20 28 20 2d 20  l0 * + CAST ( - 
1ee00 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53  col2 + - col2 AS
1ee10 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
1ee20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1ee30 2d 2d 0d 0a 2d 33 37 38 0d 0a 2d 34 30 35 36 0d  --..-378..-4056.
1ee40 0a 2d 36 30 30 34 0d 0a 0d 0a 71 75 65 72 79 20  .-6004....query 
1ee50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ee60 54 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c  T + col0 - + col
1ee70 32 20 2a 20 28 20 63 6f 6c 31 20 2b 20 2b 20 63  2 * ( col1 + + c
1ee80 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol1 ) FROM tab2 
1ee90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31  cor0..----..-121
1eea0 33 0d 0a 2d 31 36 36 37 0d 0a 2d 32 39 39 30 0d  3..-1667..-2990.
1eeb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1eec0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1eed0 4e 43 54 20 2b 20 34 32 20 46 52 4f 4d 20 74 61  NCT + 42 FROM ta
1eee0 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
1eef0 20 4a 4f 49 4e 20 74 61 62 32 20 63 6f 72 31 0d   JOIN tab2 cor1.
1ef00 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 0d 0a 71 75 65  .----..42....que
1ef10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ef20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1ef30 6c 32 20 2a 20 2b 20 35 32 20 41 53 20 63 6f 6c  l2 * + 52 AS col
1ef40 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
1ef50 2d 0d 0a 31 33 35 32 0d 0a 31 34 30 34 0d 0a 31  -..1352..1404..1
1ef60 39 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  976....query I r
1ef70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1ef80 49 53 54 49 4e 43 54 20 2b 20 33 37 20 46 52 4f  ISTINCT + 37 FRO
1ef90 4d 20 74 61 62 32 2c 20 74 61 62 31 20 63 6f 72  M tab2, tab1 cor
1efa0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a 0d 0a 71  0..----..37....q
1efb0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1efc0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20  SELECT + col0 * 
1efd0 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e  - col1 + - cor0.
1efe0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1eff0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
1f000 30 39 37 0d 0a 2d 33 33 39 36 0d 0a 2d 38 31 38  097..-3396..-818
1f010 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1f020 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1f030 54 49 4e 43 54 20 35 31 20 41 53 20 63 6f 6c 30  TINCT 51 AS col0
1f040 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
1f050 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f060 35 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  51....onlyif mys
1f070 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
1f080 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
1f090 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
1f0a0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
1f0b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1f0c0 35 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  56..SELECT col1 
1f0d0 2f 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  / CAST( NULL AS 
1f0e0 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20  SIGNED ) + col0 
1f0f0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1f100 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
1f110 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
1f120 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1f130 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1f140 6f 72 74 20 6c 61 62 65 6c 2d 38 35 36 0d 0a 53  ort label-856..S
1f150 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 43 41 53  ELECT col1 / CAS
1f160 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
1f170 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f  GER ) + col0 FRO
1f180 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
1f190 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
1f1a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f1b0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1f1c0 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 39 30  CT + col0 + + 90
1f1d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1f1e0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 0d 0a 31  b2..----..168..1
1f1f0 36 39 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  69..97....query 
1f200 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f210 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d  T ALL + col1 * -
1f220 20 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63   ( - col2 ) AS c
1f230 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
1f240 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d  ---..1248..1404.
1f250 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .570....query I 
1f260 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f270 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
1f280 32 20 2a 20 39 34 20 2b 20 63 6f 6c 30 20 41 53  2 * 94 + col0 AS
1f290 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1f2a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1f2b0 35 32 32 0d 0a 32 35 34 35 0d 0a 33 36 35 31 0d  522..2545..3651.
1f2c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f2d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1f2e0 20 63 6f 6c 32 20 2b 20 35 39 20 46 52 4f 4d 20   col2 + 59 FROM 
1f2f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1f300 2d 2d 0d 0a 2d 32 33 0d 0a 32 36 0d 0a 35 38 0d  --..-23..26..58.
1f310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f320 72 74 0d 0a 53 45 4c 45 43 54 20 37 20 2b 20 2b  rt..SELECT 7 + +
1f330 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52 4f   col1 * col1 FRO
1f340 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1f350 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 31 37 36 0d 0a  ----..107..176..
1f360 36 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  683....query I r
1f370 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1f380 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  LL - - cor0.col0
1f390 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
1f3a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1f3b0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1f3c0 20 39 35 62 39 36 63 61 31 64 62 65 32 65 33 39   95b96ca1dbe2e39
1f3d0 61 30 66 61 37 38 66 35 30 64 33 37 34 66 35 31  a0fa78f50d374f51
1f3e0 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  a....query I row
1f3f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1f400 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
1f410 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
1f420 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
1f430 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a  88..3658..7693..
1f440 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f450 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20  t..SELECT + ( + 
1f460 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32 20  col2 ) * - col2 
1f470 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1f480 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1f490 0a 2d 31 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32  .-1..-1089..-672
1f4a0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
1f4b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1f4c0 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or1.col0 FROM ta
1f4d0 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
1f4e0 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
1f4f0 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1f500 68 61 73 68 69 6e 67 20 74 6f 20 31 65 31 66 31  hashing to 1e1f1
1f510 30 39 35 33 65 62 38 65 66 66 65 39 62 32 30 65  0953eb8effe9b20e
1f520 37 34 36 66 38 61 37 66 64 38 33 0d 0a 0d 0a 71  746f8a7fd83....q
1f530 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f540 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1f550 32 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  2 * tab1.col0 + 
1f560 36 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  66 AS col2 FROM 
1f570 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 38  tab1..----..-358
1f580 32 0d 0a 2d 37 36 31 34 0d 0a 2d 39 36 0d 0a 0d  2..-7614..-96...
1f590 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1f5a0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1f5b0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1f5c0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1f5d0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1f5e0 6f 72 74 20 6c 61 62 65 6c 2d 38 36 37 0d 0a 53  ort label-867..S
1f5f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1f600 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b   col2 * col0 + +
1f610 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 43   col0 + col2 * C
1f620 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
1f630 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  NED ) FROM tab1.
1f640 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
1f650 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1f660 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1f670 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1f680 62 65 6c 2d 38 36 37 0d 0a 53 45 4c 45 43 54 20  bel-867..SELECT 
1f690 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
1f6a0 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  * col0 + + col0 
1f6b0 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20  + col2 * CAST ( 
1f6c0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
1f6d0 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
1f6e0 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
1f6f0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1f700 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1f710 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1f720 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1f730 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1f740 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 28 20  ort..SELECT ( ( 
1f750 63 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 6c 32 20  col0 ) * - col2 
1f760 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  ) col2 FROM tab0
1f770 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32  ..----..-35..-72
1f780 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72  98..-792....quer
1f790 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1f7a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
1f7b0 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  2 * + col0 * col
1f7c0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
1f7d0 2d 0d 0a 33 33 39 35 0d 0a 36 36 34 31 31 38 0d  -..3395..664118.
1f7e0 0a 36 38 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20  .68112....query 
1f7f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f800 54 20 2d 20 63 6f 6c 31 20 2a 20 35 32 20 2b 20  T - col1 * 52 + 
1f810 2b 20 63 6f 6c 31 20 2a 20 33 31 20 46 52 4f 4d  + col1 * 31 FROM
1f820 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   tab0..----..-18
1f830 30 36 0d 0a 2d 31 39 31 31 0d 0a 2d 32 30 33 37  06..-1911..-2037
1f840 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f850 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
1f860 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20  - col1 ) + col2 
1f870 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
1f880 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d  .119..173..98...
1f890 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1f8a0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
1f8b0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
1f8c0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
1f8d0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
1f8e0 6f 72 74 20 6c 61 62 65 6c 2d 38 37 32 0d 0a 53  ort label-872..S
1f8f0 45 4c 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c  ELECT CAST( NULL
1f900 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2a 20   AS DECIMAL ) * 
1f910 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
1f920 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f930 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
1f940 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1f950 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1f960 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1f970 72 74 20 6c 61 62 65 6c 2d 38 37 32 0d 0a 53 45  rt label-872..SE
1f980 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  LECT CAST ( NULL
1f990 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2d 20 63   AS REAL ) * - c
1f9a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1f9b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1f9c0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1f9d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f9e0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
1f9f0 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 * - col0 AS co
1fa00 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
1fa10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
1fa20 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 6f 6e 6c  298..-792....onl
1fa30 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1fa40 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1fa50 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1fa60 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1fa70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1fa80 6c 61 62 65 6c 2d 38 37 34 0d 0a 53 45 4c 45 43  label-874..SELEC
1fa90 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 2d 20  T ALL + CAST( - 
1faa0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 53 49 47  cor0.col2 AS SIG
1fab0 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 2a 20 63  NED ) + col2 * c
1fac0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1fad0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30   cor0..----..280
1fae0 35 0d 0a 37 33 38 30 0d 0a 39 36 0d 0a 0d 0a 73  5..7380..96....s
1faf0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1fb00 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1fb10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1fb20 62 65 6c 2d 38 37 34 0d 0a 53 45 4c 45 43 54 20  bel-874..SELECT 
1fb30 41 4c 4c 20 2b 20 43 41 53 54 20 28 20 2d 20 63  ALL + CAST ( - c
1fb40 6f 72 30 2e 63 6f 6c 32 20 41 53 20 49 4e 54 45  or0.col2 AS INTE
1fb50 47 45 52 20 29 20 2b 20 63 6f 6c 32 20 2a 20 63  GER ) + col2 * c
1fb60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
1fb70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30   cor0..----..280
1fb80 35 0d 0a 37 33 38 30 0d 0a 39 36 0d 0a 0d 0a 6f  5..7380..96....o
1fb90 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1fba0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1fbb0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1fbc0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1fbd0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 37 35 0d 0a  sort label-875..
1fbe0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1fbf0 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  - - cor0.col1 * 
1fc00 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 72 30 2e  + col2 - - cor0.
1fc10 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 46 52  col2 DIV col1 FR
1fc20 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1fc30 0a 2d 2d 2d 2d 0d 0a 31 32 35 35 0d 0a 31 34 30  .----..1255..140
1fc40 36 0d 0a 35 37 35 0d 0a 0d 0a 73 6b 69 70 69 66  6..575....skipif
1fc50 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1fc60 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1fc70 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1fc80 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  75..SELECT DISTI
1fc90 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  NCT - - cor0.col
1fca0 31 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63  1 * + col2 - - c
1fcb0 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 31 20  or0.col2 / col1 
1fcc0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1fcd0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35 35 0d 0a 31  0..----..1255..1
1fce0 34 30 36 0d 0a 35 37 35 0d 0a 0d 0a 73 6b 69 70  406..575....skip
1fcf0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1fd00 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1fd10 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1fd20 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1fd30 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1fd40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
1fd50 6f 6c 30 20 29 20 2a 20 2b 20 28 20 2d 20 63 6f  ol0 ) * + ( - co
1fd60 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31 20 63 6f  l2 ) + - col1 co
1fd70 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
1fd80 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35 38 0d  --..-188..-3658.
1fd90 0a 2d 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20  .-7693....query 
1fda0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1fdb0 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d 20 63  T DISTINCT ( - c
1fdc0 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29  ol0 * - ( col1 )
1fdd0 20 29 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 2d 20   ) + + col0 - - 
1fde0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
1fdf0 2d 2d 2d 2d 0d 0a 31 32 31 36 0d 0a 31 33 35 0d  ----..1216..135.
1fe00 0a 37 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .761....query I 
1fe10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1fe20 35 36 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  56 * col1 AS col
1fe30 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
1fe40 2d 0d 0a 34 38 31 36 0d 0a 35 30 39 36 0d 0a 35  -..4816..5096..5
1fe50 34 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  432....query I r
1fe60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1fe70 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2d 20 74  ISTINCT col2 - t
1fe80 61 62 31 2e 63 6f 6c 30 20 2a 20 36 36 20 41 53  ab1.col0 * 66 AS
1fe90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
1fea0 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 0d 0a 2d 34 31  .----..-144..-41
1feb0 36 37 0d 0a 2d 35 31 38 34 0d 0a 0d 0a 71 75 65  67..-5184....que
1fec0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1fed0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  LECT - + col1 * 
1fee0 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  col2 - col0 FROM
1fef0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1ff00 0d 0a 2d 31 33 32 38 0d 0a 2d 31 34 30 37 0d 0a  ..-1328..-1407..
1ff10 2d 36 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -634....query I 
1ff20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ff30 44 49 53 54 49 4e 43 54 20 34 31 20 2a 20 2b 20  DISTINCT 41 * + 
1ff40 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
1ff50 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1ff60 2d 2d 2d 2d 0d 0a 33 35 32 36 0d 0a 33 37 33 31  ----..3526..3731
1ff70 0d 0a 33 39 37 37 0d 0a 0d 0a 71 75 65 72 79 20  ..3977....query 
1ff80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ff90 54 20 41 4c 4c 20 2d 20 39 30 20 2a 20 2b 20 63  T ALL - 90 * + c
1ffa0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1ffb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39   cor0..----..-29
1ffc0 37 30 0d 0a 2d 37 33 38 30 0d 0a 2d 39 30 0d 0a  70..-7380..-90..
1ffd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ffe0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
1fff0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 37 39  col0 * col1 + 79
20000 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
20010 0d 0a 31 34 32 32 0d 0a 32 39 36 0d 0a 34 36 38  ..1422..296..468
20020 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
20030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
20040 6f 6c 30 20 2a 20 2d 20 33 36 20 41 53 20 63 6f  ol0 * - 36 AS co
20050 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
20060 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 32  cor0..----..-252
20070 0d 0a 2d 32 38 30 38 0d 0a 2d 32 38 34 34 0d 0a  ..-2808..-2844..
20080 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20090 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
200a0 63 6f 6c 31 20 2a 20 31 35 20 41 53 20 63 6f 6c  col1 * 15 AS col
200b0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
200c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 39 30  or0..----..-1290
200d0 0d 0a 2d 31 33 36 35 0d 0a 2d 31 34 35 35 0d 0a  ..-1365..-1455..
200e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
200f0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
20100 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 35 38  CT + - col0 + 58
20110 20 2a 20 2b 20 33 36 20 46 52 4f 4d 20 74 61 62   * + 36 FROM tab
20120 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
20130 0a 32 30 30 38 0d 0a 32 30 32 34 0d 0a 32 30 38  .2008..2024..208
20140 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
20150 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
20160 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
20170 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
20180 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20190 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a  ---..-9..34..7..
201a0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
201b0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
201c0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
201d0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
201e0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
201f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20200 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
20210 6c 30 20 2b 20 35 34 20 63 6f 6c 30 20 46 52 4f  l0 + 54 col0 FRO
20220 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
20230 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37 30 32 0d  ----..216..3702.
20240 0a 37 37 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .7734....query I
20250 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20260 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a   DISTINCT col1 *
20270 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
20280 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
20290 2d 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d 0a 39  -..7396..8281..9
202a0 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
202b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
202c0 20 63 6f 6c 31 20 2a 20 33 33 20 2b 20 63 6f 6c   col1 * 33 + col
202d0 32 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 * col2 AS col1
202e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
202f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 30 32 0d 0a  r0..----..3202..
20300 33 39 32 37 0d 0a 39 37 32 37 0d 0a 0d 0a 71 75  3927..9727....qu
20310 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20320 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a  ELECT - - col1 *
20330 20 63 6f 6c 32 20 2d 20 28 20 63 6f 72 30 2e 63   col2 - ( cor0.c
20340 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol2 ) AS col1 FR
20350 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
20360 2d 2d 0d 0a 32 38 30 35 0d 0a 37 33 38 30 0d 0a  --..2805..7380..
20370 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
20380 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 30 20  wsort..SELECT 0 
20390 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
203a0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
203b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
203c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
203d0 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 28 20 63  NCT - col1 + ( c
203e0 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 20  ol1 ) FROM tab0 
203f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
20400 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
20410 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
20420 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
20430 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
20440 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
20450 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20460 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
20470 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20 63 6f 6c  * ( - col0 ) col
20480 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
20490 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30  or0..----..-1040
204a0 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 6f  ..-640..-78....o
204b0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
204c0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
204d0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
204e0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
204f0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 35 0d 0a  sort label-895..
20500 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20  SELECT col2 DIV 
20510 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
20520 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
20530 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
20540 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
20550 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
20560 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
20570 65 6c 2d 38 39 35 0d 0a 53 45 4c 45 43 54 20 63  el-895..SELECT c
20580 6f 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 / cor0.col1 
20590 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
205a0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
205b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
205c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
205d0 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20 36 33  INCT col2 + + 63
205e0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
205f0 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 36 34 0d 0a  .----..145..64..
20600 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
20610 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
20620 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 32 36 20  L + - col1 * 26 
20630 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
20640 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
20650 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 31 32 0d 0a 2d  ..----..-2212..-
20660 32 32 37 37 0d 0a 2d 32 34 38 37 0d 0a 0d 0a 71  2277..-2487....q
20670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20680 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
20690 32 20 2a 20 31 31 20 46 52 4f 4d 20 74 61 62 30  2 * 11 FROM tab0
206a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
206b0 31 31 0d 0a 33 36 33 0d 0a 39 30 32 0d 0a 0d 0a  11..363..902....
206c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
206d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
206e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
206f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
20700 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
20710 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20720 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 38 34 20   tab1.col1 * 84 
20730 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
20740 2d 2d 2d 2d 0d 0a 31 30 39 32 0d 0a 32 31 38 34  ----..1092..2184
20750 0d 0a 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..840....query I
20760 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20770 20 63 6f 6c 30 20 2a 20 2d 20 28 20 36 36 20 2a   col0 * - ( 66 *
20780 20 63 6f 6c 31 20 29 20 2d 20 28 20 63 6f 6c 31   col1 ) - ( col1
20790 20 29 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c   ) * col2 AS col
207a0 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
207b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 31 35 39 0d 0a  ..----..-15159..
207c0 2d 33 30 35 32 36 36 0d 0a 2d 38 39 32 38 34 0d  -305266..-89284.
207d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
207e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
207f0 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
20800 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
20810 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 39 0d  ..----..-53..-9.
20820 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-96....query I 
20830 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20840 41 4c 4c 20 63 6f 6c 31 20 2a 20 36 31 20 2b 20  ALL col1 * 61 + 
20850 2b 20 37 39 20 46 52 4f 4d 20 74 61 62 32 20 41  + 79 FROM tab2 A
20860 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
20870 31 36 0d 0a 31 39 37 30 0d 0a 33 36 37 38 0d 0a  16..1970..3678..
20880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20890 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
208a0 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 36 37  CT - col2 + + 67
208b0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
208c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 34 30  r0..----..29..40
208d0 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..41....query I 
208e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
208f0 2d 20 63 6f 6c 30 20 2b 20 39 36 20 41 53 20 63  - col0 + 96 AS c
20900 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
20910 2d 2d 2d 0d 0a 31 36 0d 0a 33 32 0d 0a 39 33 0d  ---..16..32..93.
20920 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20930 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
20940 32 20 2a 20 2d 20 28 20 34 33 20 29 20 2d 20 63  2 * - ( 43 ) - c
20950 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
20960 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
20970 2d 2d 2d 0d 0a 2d 31 31 34 34 0d 0a 2d 31 31 38  ---..-1144..-118
20980 38 0d 0a 2d 31 36 37 32 0d 0a 0d 0a 71 75 65 72  8..-1672....quer
20990 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
209a0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20  ECT cor0.col1 - 
209b0 2b 20 63 6f 6c 32 20 2a 20 32 33 20 46 52 4f 4d  + col2 * 23 FROM
209c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
209d0 2d 2d 2d 0d 0a 2d 31 32 31 36 0d 0a 2d 31 33 30  ---..-1216..-130
209e0 31 0d 0a 2d 32 31 39 35 0d 0a 0d 0a 71 75 65 72  1..-2195....quer
209f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20a00 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
20a10 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  2 * cor0.col0 - 
20a20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
20a30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
20a40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 0d 0a 2d 33  ..----..-136..-3
20a50 36 33 38 0d 0a 2d 37 36 36 37 0d 0a 0d 0a 71 75  638..-7667....qu
20a60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20a70 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
20a80 32 20 2b 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29  2 + + ( - col1 )
20a90 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
20aa0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
20ab0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 35 0d 0a  0..----..-1305..
20ac0 2d 31 39 30 0d 0a 2d 34 35 37 36 0d 0a 0d 0a 71  -190..-4576....q
20ad0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20ae0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20af0 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2d  - - col1 + - ( -
20b00 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 30   col2 ) * - col0
20b10 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
20b20 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32  .----..-706..-72
20b30 30 37 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20  07..62....query 
20b40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20b50 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
20b60 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  * col0 + + col0 
20b70 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
20b80 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20b90 0a 31 39 36 0d 0a 32 31 30 36 0d 0a 33 30 38 31  .196..2106..3081
20ba0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
20bb0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
20bc0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
20bd0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
20be0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20bf0 39 31 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  911..SELECT + co
20c00 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63 6f  l2 * col0 - + co
20c10 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 32  l1 DIV cor0.col2
20c20 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
20c30 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
20c40 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38  ..162..3648..768
20c50 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
20c60 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
20c70 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
20c80 6f 72 74 20 6c 61 62 65 6c 2d 39 31 31 0d 0a 53  ort label-911..S
20c90 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
20ca0 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 63  ol0 - + col1 / c
20cb0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
20cc0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
20cd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33  r0..----..162..3
20ce0 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65  648..7680....que
20cf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20d00 4c 45 43 54 20 32 38 20 2a 20 2b 20 34 31 20 41  LECT 28 * + 41 A
20d10 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
20d20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20d30 31 31 34 38 0d 0a 31 31 34 38 0d 0a 31 31 34 38  1148..1148..1148
20d40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20d50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
20d60 37 30 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  70 * + col2 FROM
20d70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20d80 2d 2d 2d 0d 0a 2d 32 33 31 30 0d 0a 2d 35 37 34  ---..-2310..-574
20d90 30 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20  0..-70....query 
20da0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
20db0 54 20 28 20 31 33 20 29 20 2d 20 63 6f 6c 31 20  T ( 13 ) - col1 
20dc0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
20dd0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
20de0 0a 2d 31 38 0d 0a 2d 34 0d 0a 2d 34 36 0d 0a 0d  .-18..-4..-46...
20df0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20e00 0d 0a 53 45 4c 45 43 54 20 2b 20 32 39 20 2b 20  ..SELECT + 29 + 
20e10 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20  + col0 * col0 * 
20e20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f  - ( + col2 ) FRO
20e30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
20e40 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 0d 0a 2d 31 38  ----..-1196..-18
20e50 39 37 39 0d 0a 2d 36 34 39 34 39 33 0d 0a 0d 0a  979..-649493....
20e60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20e70 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
20e80 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2d 20   ( + col1 ) + - 
20e90 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
20ea0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
20eb0 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a  ----..-10..-13..
20ec0 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -26....query I r
20ed0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
20ee0 20 2d 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32   - col1 ) + col2
20ef0 20 2a 20 2d 20 31 39 20 2a 20 2d 20 31 39 20 2b   * - 19 * - 19 +
20f00 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
20f10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
20f20 33 37 38 30 0d 0a 39 34 30 35 0d 0a 39 37 32 33  3780..9405..9723
20f30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20f50 63 6f 6c 31 20 2b 20 2b 20 38 34 20 41 53 20 63  col1 + + 84 AS c
20f60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
20f70 2d 2d 2d 0d 0a 31 31 30 0d 0a 39 34 0d 0a 39 37  ---..110..94..97
20f80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
20f90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
20fa0 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  - col0 * col1 + 
20fb0 2b 20 34 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a  + 49 FROM tab2..
20fc0 2d 2d 2d 2d 0d 0a 2d 31 32 39 34 0d 0a 2d 31 36  ----..-1294..-16
20fd0 38 0d 0a 2d 34 35 35 33 0d 0a 0d 0a 71 75 65 72  8..-4553....quer
20fe0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20ff0 45 43 54 20 63 6f 6c 31 20 2a 20 2b 20 32 38 20  ECT col1 * + 28 
21000 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
21010 0a 32 38 30 0d 0a 33 36 34 0d 0a 37 32 38 0d 0a  .280..364..728..
21020 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21030 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 39 20 2b  t..SELECT - 39 +
21040 20 2b 20 32 30 20 2a 20 63 6f 6c 32 20 46 52 4f   + 20 * col2 FRO
21050 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
21060 2d 2d 2d 2d 0d 0a 31 30 34 31 0d 0a 31 31 30 31  ----..1041..1101
21070 0d 0a 31 38 38 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..1881....skipif
21080 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
21090 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
210a0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
210b0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
210c0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
210d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
210e0 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 63 6f  0.col1 * col1 co
210f0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
21100 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36  cor0..----..7396
21110 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a  ..8281..9409....
21120 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
21130 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
21140 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
21150 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
21160 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 32 33 0d  wsort label-923.
21170 0a 53 45 4c 45 43 54 20 2d 20 2b 20 37 36 20 2a  .SELECT - + 76 *
21180 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 63   cor0.col0 DIV c
21190 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 31 20  or0.col0 + col1 
211a0 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  * col1 * + col1 
211b0 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
211c0 2d 2d 2d 2d 0d 0a 32 30 35 33 30 33 0d 0a 32 39  ----..205303..29
211d0 37 31 35 0d 0a 34 38 33 37 0d 0a 0d 0a 73 6b 69  715..4837....ski
211e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
211f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
21200 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
21210 6c 2d 39 32 33 0d 0a 53 45 4c 45 43 54 20 2d 20  l-923..SELECT - 
21220 2b 20 37 36 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  + 76 * cor0.col0
21230 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   / cor0.col0 + c
21240 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63  ol1 * col1 * + c
21250 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
21260 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 33 30 33  r0..----..205303
21270 0d 0a 32 39 37 31 35 0d 0a 34 38 33 37 0d 0a 0d  ..29715..4837...
21280 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
21290 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
212a0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
212b0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
212c0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
212d0 6f 72 74 20 6c 61 62 65 6c 2d 39 32 34 0d 0a 53  ort label-924..S
212e0 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63  ELECT ALL tab2.c
212f0 6f 6c 30 20 2b 20 2b 20 43 41 53 54 28 20 4e 55  ol0 + + CAST( NU
21300 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
21310 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
21320 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
21330 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
21340 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
21350 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
21360 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
21370 2d 39 32 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -924..SELECT ALL
21380 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 2b 20 43   tab2.col0 + + C
21390 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
213a0 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32 20  TEGER ) AS col2 
213b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
213c0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
213d0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
213e0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
213f0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
21400 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
21410 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
21420 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21430 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
21440 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 63   + - cor0.col2 c
21450 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
21460 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37   cor0..----..-17
21470 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 73  1..-36..-57....s
21480 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
21490 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
214a0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
214b0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
214c0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
214d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
214e0 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ALL cor0.col2 * 
214f0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  + cor0.col0 + - 
21500 63 6f 6c 31 20 2a 20 2d 20 35 35 20 63 6f 6c 32  col1 * - 55 col2
21510 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21520 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 32 0d 0a  r0..----..1592..
21530 34 31 39 38 0d 0a 38 33 39 35 0d 0a 0d 0a 71 75  4198..8395....qu
21540 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21550 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
21560 20 37 37 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20   77 - col2 FROM 
21570 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
21580 2d 2d 0d 0a 2d 31 39 0d 0a 32 30 0d 0a 32 33 0d  --..-19..20..23.
21590 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
215a0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
215b0 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 2d  NCT - + col0 * -
215c0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
215d0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
215e0 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d  .----..49..6084.
215f0 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .6241....query I
21600 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21610 20 41 4c 4c 20 2b 20 2b 20 30 20 2b 20 2b 20 63   ALL + + 0 + + c
21620 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 * col1 FROM 
21630 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
21640 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a  --..2838..7462..
21650 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
21660 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
21670 53 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 30 20  STINCT ( - col0 
21680 29 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63  ) + - col0 - - c
21690 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
216a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
216b0 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d 31 34 37 0d  ---..-118..-147.
216c0 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .20....query I r
216d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
216e0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
216f0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
21700 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  1 cor0..----..12
21710 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 73 6b  1..176..57....sk
21720 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
21730 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
21740 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
21750 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
21760 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
21770 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
21780 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30  LL - col0 + cor0
21790 2e 63 6f 6c 30 20 2a 20 37 35 20 63 6f 6c 31 20  .col0 * 75 col1 
217a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
217b0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 32 0d 0a 34 37  0..----..222..47
217c0 33 36 0d 0a 35 39 32 30 0d 0a 0d 0a 71 75 65 72  36..5920....quer
217d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
217e0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
217f0 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63   - col0 - cor0.c
21800 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 * - cor0.col
21810 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
21820 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 36 38  or0..----..-3068
21830 0d 0a 2d 36 39 37 0d 0a 36 32 30 0d 0a 0d 0a 6f  ..-697..620....o
21840 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
21850 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
21860 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
21870 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
21880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21890 74 20 6c 61 62 65 6c 2d 39 33 34 0d 0a 53 45 4c  t label-934..SEL
218a0 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ECT + CAST( NULL
218b0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
218c0 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f   col1 + col0 FRO
218d0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab1..----..NU
218e0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
218f0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
21900 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
21910 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21920 20 6c 61 62 65 6c 2d 39 33 34 0d 0a 53 45 4c 45   label-934..SELE
21930 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  CT + CAST ( NULL
21940 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
21950 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52  - col1 + col0 FR
21960 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
21970 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
21980 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21990 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 35 20  rt..SELECT + 15 
219a0 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  * col0 FROM tab0
219b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
219c0 31 33 33 35 0d 0a 33 36 30 0d 0a 35 32 35 0d 0a  1335..360..525..
219d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
219e0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
219f0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
21a00 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
21a10 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
21a20 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 36 0d 0a  sort label-936..
21a30 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
21a40 2b 20 31 35 20 2a 20 63 6f 6c 31 20 2b 20 2d 20  + 15 * col1 + - 
21a50 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
21a60 47 4e 45 44 20 29 20 2a 20 33 32 20 46 52 4f 4d  GNED ) * 32 FROM
21a70 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
21a80 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
21a90 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
21aa0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
21ab0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
21ac0 33 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  36..SELECT DISTI
21ad0 4e 43 54 20 2b 20 31 35 20 2a 20 63 6f 6c 31 20  NCT + 15 * col1 
21ae0 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
21af0 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 33  AS INTEGER ) * 3
21b00 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  2 FROM tab1 cor0
21b10 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
21b20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21b30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
21b40 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l0 + + col2 AS c
21b50 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
21b60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31  r0..----..121..1
21b70 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  76..57....query 
21b80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21b90 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
21ba0 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  + + col1 * + cor
21bb0 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  0.col2 AS col0 F
21bc0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
21bd0 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32  ..----..194..292
21be0 34 0d 0a 37 35 35 33 0d 0a 0d 0a 71 75 65 72 79  4..7553....query
21bf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21c00 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20  CT ALL + col1 * 
21c10 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  - col2 + + col0 
21c20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  * - col2 + + col
21c30 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 * col0 FROM ta
21c40 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36 36 0d  b0..----..-1566.
21c50 0a 2d 36 36 36 31 0d 0a 33 32 36 33 0d 0a 0d 0a  .-6661..3263....
21c60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21c70 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
21c80 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
21c90 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
21ca0 0d 0a 2d 33 34 0d 0a 2d 37 32 31 36 0d 0a 2d 37  ..-34..-7216..-7
21cb0 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  59....query III 
21cc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21cd0 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
21ce0 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 2d  tab0 WHERE NOT -
21cf0 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 3c 20 28   col1 - col1 < (
21d00 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20 2b   col0 / col0 + +
21d10 20 63 6f 6c 32 20 29 20 41 4e 44 20 63 6f 6c 31   col2 ) AND col1
21d20 20 2a 20 2b 20 63 6f 6c 31 20 3c 3e 20 4e 55 4c   * + col1 <> NUL
21d30 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  L..----....query
21d40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21d50 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2a  CT + tab0.col2 *
21d60 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30   - col0 * + tab0
21d70 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
21d80 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
21d90 31 32 32 35 0d 0a 2d 31 39 30 30 38 0d 0a 2d 36  1225..-19008..-6
21da0 34 39 35 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49  49522....query I
21db0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21dc0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b   DISTINCT col0 +
21dd0 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 46   col0 - - col1 F
21de0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
21df0 31 33 38 0d 0a 31 37 33 0d 0a 33 32 0d 0a 0d 0a  138..173..32....
21e00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21e10 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63  .SELECT col0 + c
21e20 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  ol0 - col0 * - c
21e30 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
21e40 2d 2d 2d 0d 0a 31 32 39 35 0d 0a 36 32 34 0d 0a  ---..1295..624..
21e50 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
21e60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21e70 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20  col1 * - col1 + 
21e80 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
21e90 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
21ea0 2d 2d 2d 2d 0d 0a 2d 37 33 36 33 0d 0a 2d 38 31  ----..-7363..-81
21eb0 39 39 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 73 6b 69  99..-9408....ski
21ec0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
21ed0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
21ee0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
21ef0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
21f00 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
21f10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
21f20 6c 31 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 30  l1 * - tab1.col0
21f30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
21f40 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36  .----..-1040..-6
21f50 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79  40..-78....query
21f60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21f70 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  CT - + col1 + + 
21f80 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col2 * - cor0.co
21f90 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
21fa0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 33 0d 0a  0..----..-1593..
21fb0 2d 36 36 33 0d 0a 2d 38 36 38 0d 0a 0d 0a 71 75  -663..-868....qu
21fc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21fd0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  ELECT + - cor0.c
21fe0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol2 * + col2 + -
21ff0 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
22000 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 * col0 FROM ta
22010 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22020 0d 0a 2d 32 33 36 37 32 31 0d 0a 2d 33 34 30 32  ..-236721..-3402
22030 0d 0a 2d 36 32 33 36 31 36 0d 0a 0d 0a 73 6b 69  ..-623616....ski
22040 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
22050 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
22060 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
22070 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
22080 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
22090 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
220a0 28 20 2d 20 63 6f 6c 32 20 29 20 63 6f 6c 31 20  ( - col2 ) col1 
220b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
220c0 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a  .-26..-27..-38..
220d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
220e0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
220f0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
22100 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
22110 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35  rowsort label-95
22120 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  0..SELECT - - co
22130 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53  l2 DIV - col0 AS
22140 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
22150 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22160 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  1..0..0....skipi
22170 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
22180 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
22190 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
221a0 39 35 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  950..SELECT - - 
221b0 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 41 53  col2 / - col0 AS
221c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
221d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
221e0 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  1..0..0....query
221f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22200 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT + cor0.col2 +
22210 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a   - col0 * col0 *
22220 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
22230 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
22240 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 30 35 39 0d 0a  .----..-106059..
22250 2d 31 34 39 32 0d 0a 2d 33 35 38 39 33 30 0d 0a  -1492..-358930..
22260 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
22270 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
22280 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
22290 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
222a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35  rowsort label-95
222b0 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  2..SELECT ALL + 
222c0 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  - col2 * + col1 
222d0 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  + + col2 * col2 
222e0 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  DIV + cor0.col0 
222f0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
22300 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
22310 0a 2d 32 37 39 33 0d 0a 2d 37 33 38 37 0d 0a 2d  .-2793..-7387..-
22320 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
22330 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
22340 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
22350 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35 32 0d 0a  sort label-952..
22360 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
22370 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b  ol2 * + col1 + +
22380 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2f 20 2b   col2 * col2 / +
22390 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
223a0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
223b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 39  cor0..----..-279
223c0 33 0d 0a 2d 37 33 38 37 0d 0a 2d 39 37 0d 0a 0d  3..-7387..-97...
223d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
223e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
223f0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  T + cor0.col1 + 
22400 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
22410 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
22420 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
22430 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39  .2150..3492..819
22440 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
22450 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
22460 39 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  9 + col0 FROM ta
22470 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
22480 0d 0a 31 36 37 0d 0a 31 36 38 0d 0a 39 36 0d 0a  ..167..168..96..
22490 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
224a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
224b0 31 36 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  16 + - col2 * co
224c0 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 * col0 AS col
224d0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
224e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 33 34  or0..----..-2334
224f0 35 36 0d 0a 2d 34 37 30 0d 0a 2d 36 31 34 33 38  56..-470..-61438
22500 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
22510 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
22520 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
22530 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
22540 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
22550 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22560 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
22570 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol0 col2 FROM ta
22580 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
22590 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d  ..35..7298..792.
225a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
225b0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
225c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48  ol0 FROM tab1 WH
225d0 45 52 45 20 4e 4f 54 20 2b 20 63 6f 6c 30 20 3e  ERE NOT + col0 >
225e0 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
225f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22600 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
22610 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63  - tab0.col1 AS c
22620 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
22630 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36  ---..-2..-62..-6
22640 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
22650 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
22660 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  TINCT col2 * - c
22670 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f  ol2 + + col2 FRO
22680 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
22690 30 35 36 0d 0a 2d 36 36 34 32 0d 0a 30 0d 0a 0d  056..-6642..0...
226a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
226b0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
226c0 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20  FROM tab0 WHERE 
226d0 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 42 45 54  NOT ( NULL ) BET
226e0 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 63 6f  WEEN NULL AND co
226f0 6c 32 20 2b 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d  l2 + col1..----.
22700 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22710 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
22720 31 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  1 - col1 * col0 
22730 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
22740 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
22750 2d 31 31 38 39 32 32 0d 0a 2d 34 39 36 32 32 0d  -118922..-49622.
22760 0a 2d 37 32 30 39 30 32 0d 0a 0d 0a 71 75 65 72  .-720902....quer
22770 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  y III rowsort..S
22780 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
22790 31 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29  1 WHERE ( NULL )
227a0 20 3e 3d 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a   >= col2..----..
227b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
227c0 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63  t..SELECT tab1.c
227d0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 63  ol1 * - col2 + c
227e0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
227f0 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
22800 2d 20 63 6f 6c 31 20 3d 20 4e 55 4c 4c 0d 0a 2d  - col1 = NULL..-
22810 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
22820 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
22830 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 41 53 20  ISTINCT col1 AS 
22840 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 57  col0 FROM tab0 W
22850 48 45 52 45 20 63 6f 6c 32 20 3c 20 28 20 4e 55  HERE col2 < ( NU
22860 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  LL )..----....qu
22870 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
22880 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c  ELECT col2 + col
22890 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  2 * col0 FROM ta
228a0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33  b1..----..216..3
228b0 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71 75 65  705..7776....que
228c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
228d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
228e0 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col2 + col0 FROM
228f0 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
22900 63 6f 6c 30 20 4e 4f 54 20 49 4e 20 28 20 63 6f  col0 NOT IN ( co
22910 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  l2 )..----....qu
22920 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
22930 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
22940 61 62 32 20 57 48 45 52 45 20 63 6f 6c 30 20 4e  ab2 WHERE col0 N
22950 4f 54 20 49 4e 20 28 20 63 6f 6c 30 20 2b 20 63  OT IN ( col0 + c
22960 6f 6c 30 20 2a 20 63 6f 6c 30 20 29 0d 0a 2d 2d  ol0 * col0 )..--
22970 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
22980 68 69 6e 67 20 74 6f 20 61 64 30 35 62 35 39 34  hing to ad05b594
22990 32 34 30 30 64 35 65 37 61 32 31 62 33 32 33 62  2400d5e7a21b323b
229a0 33 64 61 36 35 61 34 35 0d 0a 0d 0a 71 75 65 72  3da65a45....quer
229b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
229c0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
229d0 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 + col0 AS co
229e0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45  l0 FROM tab2 WHE
229f0 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 20 4e 55  RE NOT NULL < NU
22a00 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70  LL..----....skip
22a10 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
22a20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
22a30 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
22a40 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
22a50 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
22a60 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
22a70 20 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f 6c   col2 * tab2.col
22a80 31 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  1 + tab2.col2 * 
22a90 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
22aa0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 32 0d  ab2..----..1292.
22ab0 0a 31 36 37 34 0d 0a 33 30 36 38 0d 0a 0d 0a 71  .1674..3068....q
22ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22ad0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
22ae0 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  2 + - col1 * + c
22af0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  ol1 * - col2 FRO
22b00 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  M tab0..----..24
22b10 34 31 30 31 0d 0a 36 37 39 31 32 34 0d 0a 39 34  4101..679124..94
22b20 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
22b30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
22b40 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
22b50 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  + col2 * + col0 
22b60 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  + tab1.col0 FROM
22b70 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   tab1..----..-23
22b80 33 34 30 38 0d 0a 2d 34 38 33 0d 0a 2d 36 31 34  3408..-483..-614
22b90 33 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  320....onlyif my
22ba0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
22bb0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
22bc0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
22bd0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
22be0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22bf0 39 37 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  972..SELECT DIST
22c00 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  INCT - cor0.col2
22c10 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54   * col0 + + CAST
22c20 28 20 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20  ( 0 + - col2 AS 
22c30 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 72  SIGNED ) * - cor
22c40 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0.col1 FROM tab2
22c50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22c60 2d 32 33 35 36 0d 0a 2d 34 39 34 0d 0a 36 34 38  -2356..-494..648
22c70 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
22c80 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
22c90 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
22ca0 72 74 20 6c 61 62 65 6c 2d 39 37 32 0d 0a 53 45  rt label-972..SE
22cb0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
22cc0 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30  cor0.col2 * col0
22cd0 20 2b 20 2b 20 43 41 53 54 20 28 20 30 20 2b 20   + + CAST ( 0 + 
22ce0 2d 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  - col2 AS INTEGE
22cf0 52 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  R ) * - cor0.col
22d00 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
22d10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 35 36  or0..----..-2356
22d20 0d 0a 2d 34 39 34 0d 0a 36 34 38 0d 0a 0d 0a 71  ..-494..648....q
22d30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22d40 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22d50 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col2 * + cor0.co
22d60 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63  l1 + - col1 AS c
22d70 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
22d80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37   cor0..----..147
22d90 35 0d 0a 36 32 39 0d 0a 38 30 36 0d 0a 0d 0a 71  5..629..806....q
22da0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22db0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22dc0 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72  - + col2 + + cor
22dd0 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0.col0 FROM tab0
22de0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22df0 2d 39 0d 0a 33 34 0d 0a 37 0d 0a 0d 0a 73 6b 69  -9..34..7....ski
22e00 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
22e10 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
22e20 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
22e30 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
22e40 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
22e50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
22e60 34 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  41 col1 FROM tab
22e70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22e80 0a 2d 34 31 0d 0a 2d 34 31 0d 0a 2d 34 31 0d 0a  .-41..-41..-41..
22e90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22ea0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
22eb0 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 63  - ( - col2 ) + c
22ec0 6f 6c 31 20 2a 20 2b 20 33 30 20 46 52 4f 4d 20  ol1 * + 30 FROM 
22ed0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
22ee0 2d 2d 0d 0a 31 37 39 36 0d 0a 35 34 38 0d 0a 39  --..1796..548..9
22ef0 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  57....query I ro
22f00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
22f10 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72  L - col2 * + cor
22f20 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  0.col2 * + cor0.
22f30 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
22f40 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
22f50 2d 2d 2d 2d 0d 0a 2d 36 31 31 38 38 34 0d 0a 2d  ----..-611884..-
22f60 39 33 36 35 34 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b  93654..-97....sk
22f70 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
22f80 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
22f90 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
22fa0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
22fb0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
22fc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
22fd0 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30  ISTINCT - - cor0
22fe0 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63  .col0 + + cor0.c
22ff0 6f 6c 32 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20  ol2 + col2 col1 
23000 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
23010 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 33 0d 0a 33 37  0..----..253..37
23020 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..90....query I 
23030 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23040 41 4c 4c 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ALL - col0 AS co
23050 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45  l1 FROM tab2 WHE
23060 52 45 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31  RE col0 * - col1
23070 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e   BETWEEN NULL AN
23080 44 20 28 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  D ( col1 * + col
23090 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  1 )..----....que
230a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
230b0 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
230c0 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 * col1 AS col
230d0 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
230e0 2d 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d  -..-2752..-7371.
230f0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
23100 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23110 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  L col2 * col2 * 
23120 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  + col2 + col0 * 
23130 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
23140 0d 0a 2d 2d 2d 2d 0d 0a 31 39 36 30 34 0d 0a 31  ..----..19604..1
23150 39 38 37 32 0d 0a 35 37 38 37 34 0d 0a 0d 0a 71  9872..57874....q
23160 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23170 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f  SELECT col0 * co
23180 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45  l1 FROM tab1 WHE
23190 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 3c 3e 20 4e  RE NOT NULL <> N
231a0 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
231b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
231c0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  LECT + col1 + - 
231d0 74 61 62 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 32  tab0.col2 - col2
231e0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
231f0 0d 0a 2d 37 33 0d 0a 32 30 0d 0a 39 35 0d 0a 0d  ..-73..20..95...
23200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23210 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
23220 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T + col2 * + col
23230 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  0 * col2 AS col0
23240 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
23250 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 33 36  r0..----..207936
23260 0d 0a 37 33 37 32 38 30 0d 0a 38 37 34 38 0d 0a  ..737280..8748..
23270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23280 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
23290 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  l2 + col2 + col2
232a0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
232b0 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 31 37 31 0d  .----..162..171.
232c0 0a 32 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .288....query I 
232d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
232e0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  col1 + col2 * + 
232f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63  col0 FROM tab0 c
23300 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a  or0..----..132..
23310 37 33 38 39 0d 0a 38 37 38 0d 0a 0d 0a 71 75 65  7389..878....que
23320 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
23330 4c 45 43 54 20 2b 20 63 6f 6c 30 20 41 53 20 63  LECT + col0 AS c
23340 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
23350 20 63 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20   cor0 WHERE NOT 
23360 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20 63 6f  NULL NOT IN ( co
23370 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e  l0 )..----....on
23380 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
23390 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
233a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
233b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
233c0 6f 72 74 20 6c 61 62 65 6c 2d 39 38 38 0d 0a 53  ort label-988..S
233d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
233e0 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c  or0.col0 DIV col
233f0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
23400 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35  ..----..0..1..35
23410 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23420 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
23430 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
23440 72 74 20 6c 61 62 65 6c 2d 39 38 38 0d 0a 53 45  rt label-988..SE
23450 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
23460 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 46  r0.col0 / col2 F
23470 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
23480 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35 0d 0a 0d  ---..0..1..35...
23490 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
234a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
234b0 54 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20  T tab1.col0 * + 
234c0 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  tab1.col0 * + co
234d0 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l0 - - col2 FROM
234e0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 36 32   tab1..----..262
234f0 32 30 31 0d 0a 35 31 32 30 39 36 0d 0a 38 31 0d  201..512096..81.
23500 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23510 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
23520 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 74  NCT + col2 + - t
23530 61 62 32 2e 63 6f 6c 30 20 2a 20 2d 20 74 61 62  ab2.col0 * - tab
23540 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  2.col2 AS col1 F
23550 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
23560 32 30 35 34 0d 0a 32 31 36 0d 0a 33 30 34 30 0d  2054..216..3040.
23570 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23580 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
23590 32 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  2 * + col0 + - c
235a0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
235b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   tab1..----..-16
235c0 35 0d 0a 2d 33 37 31 32 0d 0a 2d 37 37 36 30 0d  5..-3712..-7760.
235d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
235e0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
235f0 32 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52  2 FROM tab2 WHER
23600 45 20 28 20 4e 55 4c 4c 20 29 20 49 4e 20 28 20  E ( NULL ) IN ( 
23610 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 29 0d  + col1 * col2 ).
23620 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
23630 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23640 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 74 61   ALL col0 * + ta
23650 62 31 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30  b1.col1 + + col0
23660 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
23670 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
23680 2d 0d 0a 2d 33 34 35 36 0d 0a 2d 35 33 36 30 0d  -..-3456..-5360.
23690 0a 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  .69....query III
236a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
236b0 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45   * FROM tab0 WHE
236c0 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20  RE NOT NULL NOT 
236d0 42 45 54 57 45 45 4e 20 28 20 63 6f 6c 31 20 2b  BETWEEN ( col1 +
236e0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 29   - col0 + col2 )
236f0 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d   AND NULL..----.
23700 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23710 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
23720 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
23730 4f 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 55  OM tab1 WHERE NU
23740 4c 4c 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c  LL BETWEEN ( NUL
23750 4c 20 29 20 41 4e 44 20 28 20 63 6f 6c 31 20 29  L ) AND ( col1 )
23760 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
23770 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23780 54 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20  T col2 / - col0 
23790 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
237a0 4e 4f 54 20 4e 55 4c 4c 20 4e 4f 54 20 42 45 54  NOT NULL NOT BET
237b0 57 45 45 4e 20 28 20 2b 20 63 6f 6c 31 20 29 20  WEEN ( + col1 ) 
237c0 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  AND NULL..----..
237d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
237e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
237f0 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  CT - col1 + - co
23800 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l2 * - col2 FROM
23810 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39   tab1..----..289
23820 30 0d 0a 33 32 33 39 0d 0a 39 32 30 33 0d 0a 0d  0..3239..9203...
23830 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23840 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
23850 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63   col1 + - cor0.c
23860 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
23870 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23880 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
23890 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
238a0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
238b0 20 2b 20 63 6f 6c 31 20 2a 20 37 37 20 41 53 20   + col1 * 77 AS 
238c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
238d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35  S cor0..----..65
238e0 39 38 0d 0a 36 39 31 38 0d 0a 37 34 33 34 0d 0a  98..6918..7434..
238f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23900 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
23910 43 54 20 37 32 20 2a 20 2d 20 63 6f 72 30 2e 63  CT 72 * - cor0.c
23920 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
23930 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
23940 36 0d 0a 2d 34 36 30 38 0d 0a 2d 35 37 36 30 0d  6..-4608..-5760.
23950 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23960 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
23970 20 2d 20 33 36 20 2b 20 2b 20 63 6f 6c 30 20 2a   - 36 + + col0 *
23980 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
23990 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
239a0 0a 2d 2d 2d 2d 0d 0a 31 37 37 34 36 38 0d 0a 33  .----..177468..3
239b0 32 39 32 37 39 0d 0a 37 33 36 39 37 33 0d 0a 0d  29279..736973...
239c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
239d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
239e0 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  T - + cor0.col0 
239f0 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  * + cor0.col2 FR
23a00 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
23a10 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39  .----..-35..-729
23a20 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79  8..-792....query
23a30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23a40 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  CT + col2 * col2
23a50 20 2b 20 31 37 20 2b 20 63 6f 72 30 2e 63 6f 6c   + 17 + cor0.col
23a60 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
23a70 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
23a80 2d 0d 0a 31 31 35 0d 0a 31 31 39 32 0d 0a 36 38  -..115..1192..68
23a90 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
23aa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
23ab0 2b 20 38 38 20 2d 20 63 6f 6c 30 20 41 53 20 63  + 88 - col0 AS c
23ac0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
23ad0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d   cor0..----..10.
23ae0 0a 38 31 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20  .81..9....query 
23af0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
23b00 54 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 63  T ( + col1 ) + c
23b10 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
23b20 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   tab2..----..55.
23b30 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79  .58..85....query
23b40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
23b50 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
23b60 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col2 * - col2 + 
23b70 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 28 20  cor0.col0 * - ( 
23b80 63 6f 6c 31 20 2b 20 35 20 2a 20 2b 20 63 6f 72  col1 + 5 * + cor
23b90 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  0.col2 ) FROM ta
23ba0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
23bb0 0d 0a 2d 31 35 34 31 38 0d 0a 2d 31 37 37 39 37  ..-15418..-17797
23bc0 0d 0a 2d 31 38 39 31 0d 0a 0d 0a 73 6b 69 70 69  ..-1891....skipi
23bd0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
23be0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
23bf0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
23c00 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
23c10 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
23c20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
23c30 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  l0 - + col2 col2
23c40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
23c50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a  r0..----..-171..
23c60 2d 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72  -36..-57....quer
23c70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23c80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
23c90 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 32  ol1 * + col1 + 2
23ca0 31 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b  1 * ( - col2 ) +
23cb0 20 2b 20 39 34 20 46 52 4f 4d 20 74 61 62 30 20   + 94 FROM tab0 
23cc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
23cd0 37 39 39 35 0d 0a 2d 39 33 33 36 0d 0a 2d 39 39  7995..-9336..-99
23ce0 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
23cf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
23d00 53 54 49 4e 43 54 20 2d 20 2d 20 36 38 20 2d 20  STINCT - - 68 - 
23d10 63 6f 6c 32 20 2a 20 39 32 20 46 52 4f 4d 20 74  col2 * 92 FROM t
23d20 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
23d30 2d 0d 0a 2d 32 34 0d 0a 2d 32 39 36 38 0d 0a 2d  -..-24..-2968..-
23d40 37 34 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7476....skipif p
23d50 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
23d60 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
23d70 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
23d80 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
23d90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23da0 0d 0a 53 45 4c 45 43 54 20 2d 20 39 38 20 2b 20  ..SELECT - 98 + 
23db0 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
23dc0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
23dd0 2d 2d 2d 0d 0a 2d 36 33 0d 0a 2d 37 34 0d 0a 2d  ---..-63..-74..-
23de0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
23df0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
23e00 20 63 6f 6c 32 20 2a 20 2d 20 38 33 20 2a 20 2d   col2 * - 83 * -
23e10 20 37 36 20 46 52 4f 4d 20 74 61 62 32 20 41 53   76 FROM tab2 AS
23e20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34   cor0..----..164
23e30 30 30 38 0d 0a 31 37 30 33 31 36 0d 0a 32 33 39  008..170316..239
23e40 37 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  704....query I r
23e50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
23e60 4c 4c 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2b  LL - tab1.col1 +
23e70 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 37 33 20 46   - col2 * + 73 F
23e80 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
23e90 2d 33 39 36 38 0d 0a 2d 34 31 37 31 0d 0a 2d 37  -3968..-4171..-7
23ea0 30 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  021....query I r
23eb0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
23ec0 6f 6c 31 20 2b 20 28 20 36 39 20 29 20 2a 20 63  ol1 + ( 69 ) * c
23ed0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
23ee0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
23ef0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 32 30 0d 0a  r0..----..6020..
23f00 36 33 37 30 0d 0a 36 37 39 30 0d 0a 0d 0a 71 75  6370..6790....qu
23f10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23f20 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 30 20 2b  ELECT ALL + 40 +
23f30 20 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30   ( col1 ) * col0
23f40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
23f50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 34 0d 0a  r0..----..2104..
23f60 33 34 33 35 0d 0a 38 31 33 39 0d 0a 0d 0a 71 75  3435..8139....qu
23f70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23f80 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
23f90 6f 6c 31 20 2d 20 2d 20 36 33 20 46 52 4f 4d 20  ol1 - - 63 FROM 
23fa0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
23fb0 2d 2d 0d 0a 37 33 0d 0a 37 36 0d 0a 38 39 0d 0a  --..73..76..89..
23fc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23fd0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
23fe0 6c 32 20 2a 20 28 20 2b 20 63 6f 6c 30 20 29 20  l2 * ( + col0 ) 
23ff0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
24000 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d  0..----..-162..-
24010 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71  3648..-7680....q
24020 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24030 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
24040 30 20 2a 20 36 30 20 2b 20 2b 20 63 6f 6c 30 20  0 * 60 + + col0 
24050 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * - col1 AS col1
24060 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
24070 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 39  r0..----..-13439
24080 0d 0a 2d 33 35 30 34 0d 0a 2d 35 34 39 35 0d 0a  ..-3504..-5495..
24090 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
240a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
240b0 43 54 20 2b 20 33 35 20 2b 20 37 34 20 46 52 4f  CT + 35 + 74 FRO
240c0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
240d0 2d 0d 0a 31 30 39 0d 0a 0d 0a 71 75 65 72 79 20  -..109....query 
240e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
240f0 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T + col0 * + col
24100 30 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 - col2 FROM ta
24110 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 36 30  b2..----..22..60
24120 35 38 0d 0a 36 32 30 33 0d 0a 0d 0a 71 75 65 72  58..6203....quer
24130 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24140 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
24150 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63  ol1 - - col2 * c
24160 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
24170 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36 39 0d 0a  ---..158..1969..
24180 32 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2985....query I 
24190 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
241a0 2d 20 28 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b  - ( ( + col2 ) +
241b0 20 34 39 20 29 20 2a 20 63 6f 6c 32 20 41 53 20   49 ) * col2 AS 
241c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
241d0 2d 2d 2d 2d 0d 0a 2d 31 30 37 34 32 0d 0a 2d 32  ----..-10742..-2
241e0 37 30 36 0d 0a 2d 35 30 0d 0a 0d 0a 71 75 65 72  706..-50....quer
241f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24200 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ECT - col1 + col
24210 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  2 + col2 AS col1
24220 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
24230 0d 0a 2d 32 30 0d 0a 2d 39 35 0d 0a 37 33 0d 0a  ..-20..-95..73..
24240 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
24250 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
24260 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
24270 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
24280 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
24290 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 33 0d  sort label-1023.
242a0 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 2b 20  .SELECT CAST( + 
242b0 38 35 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  85 AS SIGNED ) A
242c0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
242d0 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 35 0d 0a  ..----..85..85..
242e0 38 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  85....skipif mys
242f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
24300 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
24310 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 33 0d  sort label-1023.
24320 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 2b  .SELECT CAST ( +
24330 20 38 35 20 41 53 20 49 4e 54 45 47 45 52 20 29   85 AS INTEGER )
24340 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
24350 62 32 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 38 35  b2..----..85..85
24360 0d 0a 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..85....query I 
24370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24380 44 49 53 54 49 4e 43 54 20 2b 20 36 39 20 2b 20  DISTINCT + 69 + 
24390 34 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  43 FROM tab0 AS 
243a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d  cor0..----..112.
243b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
243c0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
243d0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
243e0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
243f0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
24400 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 35  wsort label-1025
24410 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24420 54 20 43 41 53 54 28 20 2d 20 63 6f 72 30 2e 63  T CAST( - cor0.c
24430 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol2 AS SIGNED ) 
24440 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  * col0 AS col2 F
24450 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
24460 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38  ---..-189..-2028
24470 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 73 6b 69 70 69  ..-3002....skipi
24480 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24490 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
244a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
244b0 31 30 32 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  1025..SELECT DIS
244c0 54 49 4e 43 54 20 43 41 53 54 20 28 20 2d 20 63  TINCT CAST ( - c
244d0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 49 4e 54 45  or0.col2 AS INTE
244e0 47 45 52 20 29 20 2a 20 63 6f 6c 30 20 41 53 20  GER ) * col0 AS 
244f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
24500 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d  or0..----..-189.
24510 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d  .-2028..-3002...
24520 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
24530 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
24540 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
24550 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
24560 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
24570 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24580 54 20 41 4c 4c 20 2d 20 33 31 20 63 6f 6c 30 20  T ALL - 31 col0 
24590 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
245a0 0a 2d 33 31 0d 0a 2d 33 31 0d 0a 2d 33 31 0d 0a  .-31..-31..-31..
245b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
245c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
245d0 6c 31 20 2a 20 2d 20 36 32 20 41 53 20 63 6f 6c  l1 * - 62 AS col
245e0 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
245f0 2d 0d 0a 2d 31 36 31 32 0d 0a 2d 36 32 30 0d 0a  -..-1612..-620..
24600 2d 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -806....query I 
24610 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24620 41 4c 4c 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20  ALL - cor1.col1 
24630 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
24640 30 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  0 AS cor0 CROSS 
24650 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
24660 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
24670 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 38 65  s hashing to 58e
24680 64 34 36 37 61 39 61 33 33 32 65 34 64 37 62 66  d467a9a332e4d7bf
24690 61 61 39 61 62 64 62 62 64 30 36 33 66 0d 0a 0d  aa9abdbbd063f...
246a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
246b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 32  ..SELECT ALL + 2
246c0 39 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  9 FROM tab2, tab
246d0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  1 cor0..----..9 
246e0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
246f0 6f 20 31 65 37 31 32 30 62 61 38 65 39 31 39 31  o 1e7120ba8e9191
24700 30 38 34 31 37 32 64 64 63 65 64 31 37 65 35 65  084172ddced17e5e
24710 62 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  b2....onlyif mys
24720 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
24730 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
24740 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
24750 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
24760 6c 2d 31 30 33 30 0d 0a 53 45 4c 45 43 54 20 2b  l-1030..SELECT +
24770 20 28 20 2d 20 63 6f 6c 30 20 29 20 44 49 56 20   ( - col0 ) DIV 
24780 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
24790 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d  ----..-6..-6..0.
247a0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
247b0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
247c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
247d0 74 20 6c 61 62 65 6c 2d 31 30 33 30 0d 0a 53 45  t label-1030..SE
247e0 4c 45 43 54 20 2b 20 28 20 2d 20 63 6f 6c 30 20  LECT + ( - col0 
247f0 29 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ) / col1 FROM ta
24800 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 36  b1..----..-6..-6
24810 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
24820 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
24830 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
24840 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
24850 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
24860 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24870 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63  .SELECT + tab2.c
24880 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d  ol0 * - col2 * -
24890 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20   col1 col0 FROM 
248a0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36  tab2..----..1196
248b0 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38 35 39 0d  52..51034..5859.
248c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
248d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
248e0 4e 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63  NCT - - col2 + c
248f0 6f 6c 30 20 2b 20 2b 20 33 39 20 46 52 4f 4d 20  ol0 + + 39 FROM 
24900 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
24910 2d 2d 0d 0a 31 34 33 0d 0a 31 35 36 0d 0a 37 33  --..143..156..73
24920 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24930 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 38  ort..SELECT - 18
24940 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   * - col1 + col2
24950 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
24960 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
24970 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 34 33 0d 0a 34  0..----..1843..4
24980 33 38 36 0d 0a 39 31 30 30 0d 0a 0d 0a 71 75 65  386..9100....que
24990 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
249a0 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63 6f  LECT ALL tab0.co
249b0 6c 31 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 30  l1 * + tab0.col0
249c0 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
249d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
249e0 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
249f0 20 74 6f 20 66 32 39 33 38 62 65 65 30 31 31 62   to f2938bee011b
24a00 38 64 34 39 64 64 39 33 31 62 31 66 39 32 33 35  8d49dd931b1f9235
24a10 65 37 66 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  e7f5....query I 
24a20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24a30 41 4c 4c 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52  ALL cor1.col1 FR
24a40 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
24a50 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
24a60 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
24a70 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
24a80 64 36 37 31 61 30 36 34 65 32 64 61 37 30 39 63  d671a064e2da709c
24a90 61 34 63 64 66 65 61 33 31 37 62 38 65 38 39 32  a4cdfea317b8e892
24aa0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24ab0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
24ac0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
24ad0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
24ae0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24af0 31 30 33 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1036..SELECT DIS
24b00 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 44 49 56  TINCT - col2 DIV
24b10 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 41 53   - ( + col0 ) AS
24b20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
24b30 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73  .----..0..1....s
24b40 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
24b50 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
24b60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
24b70 62 65 6c 2d 31 30 33 36 0d 0a 53 45 4c 45 43 54  bel-1036..SELECT
24b80 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32   DISTINCT - col2
24b90 20 2f 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20   / - ( + col0 ) 
24ba0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
24bb0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d  0..----..0..1...
24bc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24bd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
24be0 6f 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 31 32 20  ol0 + col0 + 12 
24bf0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
24c00 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 30 0d 0a 36 30  0..----..190..60
24c10 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..82....skipif p
24c20 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
24c30 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
24c40 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
24c50 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
24c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24c70 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24c80 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 28 20 2d  T + + col0 * ( -
24c90 20 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31   col2 ) + + col1
24ca0 20 2a 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f   * ( col2 ) + co
24cb0 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
24cc0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
24cd0 0a 2d 33 30 31 34 0d 0a 2d 36 33 35 32 0d 0a 31  .-3014..-6352..1
24ce0 32 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  245....query I r
24cf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
24d00 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 28 20  LL - col0 + + ( 
24d10 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
24d20 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
24d30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
24d40 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
24d50 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
24d60 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
24d70 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
24d80 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
24d90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24da0 45 43 54 20 41 4c 4c 20 2d 20 28 20 2d 20 63 6f  ECT ALL - ( - co
24db0 6c 31 20 29 20 2b 20 63 6f 6c 31 20 63 6f 6c 32  l1 ) + col1 col2
24dc0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
24dd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33  r0..----..118..3
24de0 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  4..62....query I
24df0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24e00 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
24e10 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 29   ( - cor0.col1 )
24e20 20 2d 20 28 20 2b 20 38 34 20 29 20 41 53 20 63   - ( + 84 ) AS c
24e30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
24e40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
24e50 31 0d 0a 2d 32 39 32 32 0d 0a 2d 37 35 34 36 0d  1..-2922..-7546.
24e60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24e70 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34  rt..SELECT ALL 4
24e80 38 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  8 + - col2 * col
24e90 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
24ea0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24eb0 2d 0d 0a 2d 31 34 31 0d 0a 2d 31 39 38 30 0d 0a  -..-141..-1980..
24ec0 2d 32 39 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -2954....onlyif 
24ed0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
24ee0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
24ef0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
24f00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
24f10 61 62 65 6c 2d 31 30 34 33 0d 0a 53 45 4c 45 43  abel-1043..SELEC
24f20 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 44  T ALL - - col1 D
24f30 49 56 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c  IV cor0.col2 col
24f40 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
24f50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
24f60 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .0....skipif pos
24f70 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
24f80 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
24f90 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
24fa0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
24fb0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
24fc0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
24fd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
24fe0 62 65 6c 2d 31 30 34 33 0d 0a 53 45 4c 45 43 54  bel-1043..SELECT
24ff0 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 31 20 2f 20   ALL - - col1 / 
25000 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46  cor0.col2 col1 F
25010 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
25020 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
25030 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25040 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
25050 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2b  NCT - + col2 + +
25060 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
25070 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
25080 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d  .----..-28..-47.
25090 0a 2d 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-83....onlyif m
250a0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
250b0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
250c0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
250d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
250e0 62 65 6c 2d 31 30 34 35 0d 0a 53 45 4c 45 43 54  bel-1045..SELECT
250f0 20 63 6f 6c 32 20 44 49 56 20 2d 20 37 38 20 2b   col2 DIV - 78 +
25100 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46   - col2 * col0 F
25110 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
25120 2d 33 35 0d 0a 2d 37 32 39 39 0d 0a 2d 37 39 32  -35..-7299..-792
25130 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
25140 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
25150 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
25160 72 74 20 6c 61 62 65 6c 2d 31 30 34 35 0d 0a 53  rt label-1045..S
25170 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 2d 20 37  ELECT col2 / - 7
25180 38 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  8 + - col2 * col
25190 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
251a0 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 39 0d 0a 2d  -..-35..-7299..-
251b0 37 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  792....onlyif my
251c0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
251d0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
251e0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
251f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25200 65 6c 2d 31 30 34 36 0d 0a 53 45 4c 45 43 54 20  el-1046..SELECT 
25210 28 20 63 6f 6c 31 20 29 20 44 49 56 20 2d 20 63  ( col1 ) DIV - c
25220 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
25230 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
25240 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
25250 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
25260 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
25270 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 36 0d 0a  ort label-1046..
25280 53 45 4c 45 43 54 20 28 20 63 6f 6c 31 20 29 20  SELECT ( col1 ) 
25290 2f 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  / - col2 FROM ta
252a0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b1 cor0..----..0
252b0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
252c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
252d0 54 20 2d 20 38 32 20 2a 20 2b 20 63 6f 6c 32 20  T - 82 * + col2 
252e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
252f0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  1 cor0..----..-4
25300 34 32 38 0d 0a 2d 34 36 37 34 0d 0a 2d 37 38 37  428..-4674..-787
25310 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
25320 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39  sort..SELECT + 9
25330 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
25340 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
25350 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
25360 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
25370 74 6f 20 65 62 65 66 37 33 30 33 39 34 32 38 33  to ebef730394283
25380 34 63 61 31 65 36 63 61 38 36 30 34 65 63 31 38  4ca1e6ca8604ec18
25390 61 30 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  a07....query I r
253a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
253b0 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a   + col1 + col0 *
253c0 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   - col1 * col2 F
253d0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
253e0 2d 2d 2d 0d 0a 2d 31 31 39 37 31 31 0d 0a 2d 35  ---..-119711..-5
253f0 31 30 35 31 0d 0a 2d 35 38 39 30 0d 0a 0d 0a 71  1051..-5890....q
25400 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25410 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20  SELECT col2 + - 
25420 38 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  83 AS col0 FROM 
25430 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
25440 2d 2d 0d 0a 2d 31 0d 0a 2d 35 30 0d 0a 2d 38 32  --..-1..-50..-82
25450 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25460 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
25470 63 6f 6c 31 20 2b 20 34 31 20 46 52 4f 4d 20 74  col1 + 41 FROM t
25480 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
25490 2d 0d 0a 2d 31 38 0d 0a 31 30 0d 0a 32 34 0d 0a  -..-18..10..24..
254a0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
254b0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
254c0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
254d0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
254e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
254f0 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  52..SELECT DISTI
25500 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  NCT + cor0.col2 
25510 44 49 56 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  DIV + col2 + col
25520 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  0 * col2 AS col2
25530 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
25540 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 32  r0..----..36..72
25550 39 39 0d 0a 37 39 33 0d 0a 0d 0a 73 6b 69 70 69  99..793....skipi
25560 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25570 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25580 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25590 31 30 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  1052..SELECT DIS
255a0 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
255b0 32 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  2 / + col2 + col
255c0 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  0 * col2 AS col2
255d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
255e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 37 32  r0..----..36..72
255f0 39 39 0d 0a 37 39 33 0d 0a 0d 0a 71 75 65 72 79  99..793....query
25600 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25610 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
25620 6c 32 20 2b 20 2d 20 32 34 20 46 52 4f 4d 20 74  l2 + - 24 FROM t
25630 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
25640 2d 0d 0a 2d 31 30 36 0d 0a 2d 32 35 0d 0a 2d 35  -..-106..-25..-5
25650 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
25660 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
25670 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c  TINCT col0 * col
25680 32 20 2b 20 31 37 20 41 53 20 63 6f 6c 31 20 46  2 + 17 AS col1 F
25690 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
256a0 2d 2d 2d 0d 0a 32 30 34 35 0d 0a 32 30 36 0d 0a  ---..2045..206..
256b0 33 30 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  3019....onlyif m
256c0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
256d0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
256e0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
256f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25700 62 65 6c 2d 31 30 35 35 0d 0a 53 45 4c 45 43 54  bel-1055..SELECT
25710 20 2d 20 63 6f 6c 31 20 44 49 56 20 38 34 20 41   - col1 DIV 84 A
25720 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
25730 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
25740 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b  -1..-1..-1....sk
25750 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
25760 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
25770 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25780 65 6c 2d 31 30 35 35 0d 0a 53 45 4c 45 43 54 20  el-1055..SELECT 
25790 2d 20 63 6f 6c 31 20 2f 20 38 34 20 41 53 20 63  - col1 / 84 AS c
257a0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
257b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
257c0 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79  .-1..-1....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 41 4c 4c 20 2b 20 2d 20 28 20 36 33 20  CT ALL + - ( 63 
257f0 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  ) * cor0.col1 AS
25800 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
25810 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
25820 31 30 37 31 0d 0a 2d 31 39 35 33 0d 0a 2d 33 37  1071..-1953..-37
25830 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
25840 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
25850 4c 20 28 20 35 32 20 29 20 46 52 4f 4d 20 74 61  L ( 52 ) FROM ta
25860 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  b0 cor0..----..5
25870 32 0d 0a 35 32 0d 0a 35 32 0d 0a 0d 0a 73 6b 69  2..52..52....ski
25880 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
25890 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
258a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
258b0 45 43 54 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b  ECT ( - col0 ) +
258c0 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20 2b   col1 * CAST ( +
258d0 20 35 37 20 41 53 20 52 45 41 4c 20 29 20 41 53   57 AS REAL ) AS
258e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
258f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 36 30  cor0..----..1760
25900 0d 0a 33 32 38 35 0d 0a 38 39 30 0d 0a 0d 0a 71  ..3285..890....q
25910 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25920 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
25930 36 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  61 AS col2 FROM 
25940 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25950 2d 2d 0d 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  --..61....onlyif
25960 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
25970 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
25980 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
25990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
259a0 6c 61 62 65 6c 2d 31 30 36 30 0d 0a 53 45 4c 45  label-1060..SELE
259b0 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 74 61  CT + col2 + + ta
259c0 62 30 2e 63 6f 6c 32 20 44 49 56 20 38 35 20 46  b0.col2 DIV 85 F
259d0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
259e0 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69  1..33..82....ski
259f0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
25a00 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
25a10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25a20 6c 2d 31 30 36 30 0d 0a 53 45 4c 45 43 54 20 2b  l-1060..SELECT +
25a30 20 63 6f 6c 32 20 2b 20 2b 20 74 61 62 30 2e 63   col2 + + tab0.c
25a40 6f 6c 32 20 2f 20 38 35 20 46 52 4f 4d 20 74 61  ol2 / 85 FROM ta
25a50 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d  b0..----..1..33.
25a60 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .82....query I r
25a70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
25a80 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 2b 20 63   tab0.col0 - + c
25a90 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
25aa0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   tab0..----..-11
25ab0 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d  0..-132..-180...
25ac0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25ad0 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f  ..SELECT tab2.co
25ae0 6c 31 20 2b 20 33 31 20 2a 20 2d 20 63 6f 6c 31  l1 + 31 * - col1
25af0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
25b00 0d 0a 2d 31 37 37 30 0d 0a 2d 35 31 30 0d 0a 2d  ..-1770..-510..-
25b10 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  930....query I r
25b20 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
25b30 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
25b40 20 2d 20 39 30 20 41 53 20 63 6f 6c 31 20 46 52   - 90 AS col1 FR
25b50 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
25b60 31 36 30 0d 0a 33 31 35 30 0d 0a 38 30 31 30 0d  160..3150..8010.
25b70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25b80 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
25b90 32 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20  2 - tab1.col2 * 
25ba0 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d  - tab1.col2 FROM
25bb0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 36   tab1..----..286
25bc0 32 0d 0a 33 31 39 32 0d 0a 39 31 32 30 0d 0a 0d  2..3192..9120...
25bd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25be0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
25bf0 2d 20 2d 20 37 38 20 2a 20 2d 20 34 37 20 46 52  - - 78 * - 47 FR
25c00 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
25c10 33 36 39 32 0d 0a 2d 33 36 39 33 0d 0a 2d 33 37  3692..-3693..-37
25c20 30 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  04....onlyif mys
25c30 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
25c40 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
25c50 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
25c60 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
25c70 6c 2d 31 30 36 36 0d 0a 53 45 4c 45 43 54 20 2b  l-1066..SELECT +
25c80 20 63 6f 6c 32 20 2a 20 2d 20 32 38 20 2b 20 32   col2 * - 28 + 2
25c90 37 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20  7 DIV + col1 AS 
25ca0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
25cb0 2d 2d 2d 2d 0d 0a 2d 31 30 36 33 0d 0a 2d 37 32  ----..-1063..-72
25cc0 38 0d 0a 2d 37 35 36 0d 0a 0d 0a 73 6b 69 70 69  8..-756....skipi
25cd0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25ce0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
25cf0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
25d00 31 30 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1066..SELECT + c
25d10 6f 6c 32 20 2a 20 2d 20 32 38 20 2b 20 32 37 20  ol2 * - 28 + 27 
25d20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  / + col1 AS col2
25d30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
25d40 0d 0a 2d 31 30 36 33 0d 0a 2d 37 32 38 0d 0a 2d  ..-1063..-728..-
25d50 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  756....query I r
25d60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
25d70 20 2b 20 28 20 2b 20 74 61 62 31 2e 63 6f 6c 30   + ( + tab1.col0
25d80 20 29 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f   ) ) AS col0 FRO
25d90 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  M tab1..----..3.
25da0 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .64..80....query
25db0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25dc0 43 54 20 41 4c 4c 20 34 38 20 2a 20 63 6f 6c 32  CT ALL 48 * col2
25dd0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
25de0 0d 0a 31 32 34 38 0d 0a 31 32 39 36 0d 0a 31 38  ..1248..1296..18
25df0 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  24....query I ro
25e00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
25e10 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col2 * - col2 + 
25e20 2b 20 31 32 20 46 52 4f 4d 20 74 61 62 32 20 41  + 12 FROM tab2 A
25e30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
25e40 35 36 0d 0a 36 38 38 0d 0a 37 34 31 0d 0a 0d 0a  56..688..741....
25e50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25e60 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
25e70 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63  0 * + col0 + + c
25e80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
25e90 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36   cor0..----..126
25ea0 30 0d 0a 36 30 30 0d 0a 38 30 31 30 0d 0a 0d 0a  0..600..8010....
25eb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
25ec0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25ed0 20 63 6f 6c 32 20 2a 20 2d 20 39 35 20 41 53 20   col2 * - 95 AS 
25ee0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
25ef0 2d 2d 2d 2d 0d 0a 2d 33 31 33 35 0d 0a 2d 37 37  ----..-3135..-77
25f00 39 30 0d 0a 2d 39 35 0d 0a 0d 0a 71 75 65 72 79  90..-95....query
25f10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25f20 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
25f30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31   * + col0 * col1
25f40 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
25f50 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 35  b0..----..118825
25f60 0d 0a 34 39 35 33 36 0d 0a 37 32 30 38 31 31 0d  ..49536..720811.
25f70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25f80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
25f90 20 31 33 20 2b 20 2b 20 33 38 20 46 52 4f 4d 20   13 + + 38 FROM 
25fa0 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
25fb0 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20  SS JOIN tab1 AS 
25fc0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
25fd0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
25fe0 64 38 62 66 30 61 30 35 63 39 63 34 64 32 61 39  d8bf0a05c9c4d2a9
25ff0 33 38 31 32 64 31 30 36 62 61 61 65 34 37 35 32  3812d106baae4752
26000 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26010 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 20  ort..SELECT - 5 
26020 2b 20 2d 20 63 6f 6c 32 20 2a 20 28 20 2b 20 63  + - col2 * ( + c
26030 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol0 ) AS col0 FR
26040 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26050 0a 2d 2d 2d 2d 0d 0a 2d 31 39 34 0d 0a 2d 32 30  .----..-194..-20
26060 33 33 0d 0a 2d 33 30 30 37 0d 0a 0d 0a 71 75 65  33..-3007....que
26070 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26080 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20  LECT ALL col1 + 
26090 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 37 34 20  + col2 + - ( 74 
260a0 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
260b0 2d 0d 0a 32 34 0d 0a 34 35 0d 0a 39 39 0d 0a 0d  -..24..45..99...
260c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
260d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
260e0 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  T + col2 + + col
260f0 31 20 2a 20 2d 20 35 31 20 41 53 20 63 6f 6c 32  1 * - 51 AS col2
26100 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
26110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 35 33 0d  r0..----..-4353.
26120 0a 2d 34 35 35 39 0d 0a 2d 34 39 34 36 0d 0a 0d  .-4559..-4946...
26130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26140 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26150 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  T col1 * + col1 
26160 2d 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  - + col0 AS col0
26170 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
26180 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a 33  r0..----..210..3
26190 34 30 33 0d 0a 39 35 34 0d 0a 0d 0a 71 75 65 72  403..954....quer
261a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
261b0 45 43 54 20 41 4c 4c 20 37 32 20 2b 20 63 6f 6c  ECT ALL 72 + col
261c0 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 * - col0 AS co
261d0 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
261e0 2d 2d 0d 0a 2d 34 30 32 34 0d 0a 2d 36 33 32 38  --..-4024..-6328
261f0 0d 0a 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..63....query I 
26200 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26210 41 4c 4c 20 2d 20 36 33 20 2b 20 2d 20 63 6f 6c  ALL - 63 + - col
26220 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
26230 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 0d  ab2..----..-141.
26240 0a 2d 31 34 32 0d 0a 2d 37 30 0d 0a 0d 0a 71 75  .-142..-70....qu
26250 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26260 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a  ELECT - - col1 *
26270 20 63 6f 6c 32 20 2b 20 2b 20 39 34 20 46 52 4f   col2 + + 94 FRO
26280 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
26290 2d 2d 2d 2d 0d 0a 31 36 32 38 0d 0a 37 34 30 0d  ----..1628..740.
262a0 0a 39 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .931....query I 
262b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
262c0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
262d0 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
262e0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c  0, tab2 AS cor0,
262f0 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab1 cor1..----
26300 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
26310 69 6e 67 20 74 6f 20 63 34 65 36 62 31 66 31 64  ing to c4e6b1f1d
26320 32 38 65 37 33 31 36 36 34 61 31 35 61 36 66 37  28e731664a15a6f7
26330 63 64 61 34 64 61 39 0d 0a 0d 0a 71 75 65 72 79  cda4da9....query
26340 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26350 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20  CT ALL col0 * + 
26360 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 32  cor0.col2 - col2
26370 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
26380 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
26390 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 32 32  or0..----..14022
263a0 0d 0a 31 38 38 31 0d 0a 33 36 0d 0a 0d 0a 71 75  ..1881..36....qu
263b0 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
263c0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
263d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
263e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
263f0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
26400 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20  , tab1 AS cor1, 
26410 74 61 62 31 20 41 53 20 63 6f 72 32 2c 20 74 61  tab1 AS cor2, ta
26420 62 31 20 41 53 20 63 6f 72 33 0d 0a 2d 2d 2d 2d  b1 AS cor3..----
26430 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
26440 73 68 69 6e 67 20 74 6f 20 32 63 39 62 63 36 32  shing to 2c9bc62
26450 35 36 36 31 36 39 36 66 61 31 63 66 31 38 37 63  5661696fa1cf187c
26460 34 64 30 66 37 30 33 61 31 0d 0a 0d 0a 71 75 65  4d0f703a1....que
26470 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26480 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
26490 63 6f 6c 31 20 2b 20 39 37 20 2a 20 36 33 20 2a  col1 + 97 * 63 *
264a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
264b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 37 34  cor0..----..4274
264c0 36 0d 0a 34 37 36 35 39 39 0d 0a 34 38 32 37 35  6..476599..48275
264d0 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
264e0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
264f0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
26500 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
26510 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
26520 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
26530 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  85..SELECT ALL c
26540 6f 6c 32 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c  ol2 / CAST( NULL
26550 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52   AS DECIMAL ) FR
26560 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26570 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
26580 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
26590 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
265a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
265b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
265c0 31 30 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1085..SELECT ALL
265d0 20 63 6f 6c 32 20 2f 20 43 41 53 54 20 28 20 4e   col2 / CAST ( N
265e0 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 46 52  ULL AS REAL ) FR
265f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26600 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
26610 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
26620 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26630 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  CT - + cor0.col2
26640 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20   + ( - col0 ) * 
26650 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
26660 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
26670 0a 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 71 75 65  .583..944....que
26680 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26690 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 39 31  LECT - col2 + 91
266a0 20 2a 20 2b 20 31 36 20 41 53 20 63 6f 6c 32 20   * + 16 AS col2 
266b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
266c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 38 0d 0a 31  0..----..1418..1
266d0 34 32 39 0d 0a 31 34 33 30 0d 0a 0d 0a 71 75 65  429..1430....que
266e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
266f0 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
26700 32 20 2b 20 2d 20 28 20 2d 20 63 6f 6c 32 20 2a  2 + - ( - col2 *
26710 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53 20   cor0.col0 ) AS 
26720 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
26730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a  or0..----..108..
26740 33 35 39 31 0d 0a 37 35 38 34 0d 0a 0d 0a 71 75  3591..7584....qu
26750 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26760 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
26770 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 2d  ol2 + - col1 - -
26780 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
26790 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
267a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 30 0d 0a  or0..----..190..
267b0 33 36 39 35 0d 0a 37 37 36 33 0d 0a 0d 0a 71 75  3695..7763....qu
267c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
267d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
267e0 20 63 6f 6c 30 20 2a 20 2d 20 34 30 20 2a 20 63   col0 * - 40 * c
267f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
26800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35   cor0..----..-25
26810 36 30 30 0d 0a 2d 33 31 32 30 0d 0a 2d 34 31 36  600..-3120..-416
26820 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
26830 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
26840 2b 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2b 20 63  + col1 * - ( + c
26850 6f 6c 30 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  ol0 ) * - cor0.c
26860 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 33 32 20  ol0 + col0 * 32 
26870 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
26880 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
26890 0d 0a 2d 31 31 37 38 30 32 0d 0a 2d 34 38 38 35  ..-117802..-4885
268a0 34 0d 0a 2d 37 31 38 30 35 34 0d 0a 0d 0a 6f 6e  4..-718054....on
268b0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
268c0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
268d0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
268e0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
268f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26900 20 6c 61 62 65 6c 2d 31 30 39 32 0d 0a 53 45 4c   label-1092..SEL
26910 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31  ECT ALL + - col1
26920 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   * - CAST( NULL 
26930 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
26940 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
26950 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
26960 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
26970 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
26980 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
26990 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
269a0 65 6c 2d 31 30 39 32 0d 0a 53 45 4c 45 43 54 20  el-1092..SELECT 
269b0 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d  ALL + - col1 * -
269c0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
269d0 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
269e0 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
269f0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
26a00 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
26a10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26a20 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 34 38 20  ECT + col1 * 48 
26a30 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
26a40 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 34 38 30 0d  ----..1248..480.
26a50 0a 36 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .624....query I 
26a60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26a70 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
26a80 31 20 2b 20 32 20 46 52 4f 4d 20 74 61 62 32 20  1 + 2 FROM tab2 
26a90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
26aa0 39 0d 0a 33 33 0d 0a 36 31 0d 0a 0d 0a 71 75 65  9..33..61....que
26ab0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26ac0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  LECT + col1 + + 
26ad0 38 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  84 AS col1 FROM 
26ae0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
26af0 2d 2d 0d 0a 31 30 31 0d 0a 31 31 35 0d 0a 31 34  --..101..115..14
26b00 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
26b10 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
26b20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
26b30 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
26b40 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
26b50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
26b60 39 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  96..SELECT col1 
26b70 2b 20 2b 20 43 41 53 54 28 20 38 39 20 41 53 20  + + CAST( 89 AS 
26b80 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
26b90 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
26ba0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
26bb0 2d 0d 0a 2d 32 30 35 30 0d 0a 2d 33 30 31 38 0d  -..-2050..-3018.
26bc0 0a 2d 37 38 33 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-7830....skipif
26bd0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
26be0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
26bf0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26c00 30 39 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  096..SELECT col1
26c10 20 2b 20 2b 20 43 41 53 54 20 28 20 38 39 20 41   + + CAST ( 89 A
26c20 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20  S INTEGER ) * - 
26c30 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
26c40 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
26c50 2d 2d 2d 2d 0d 0a 2d 32 30 35 30 0d 0a 2d 33 30  ----..-2050..-30
26c60 31 38 0d 0a 2d 37 38 33 30 0d 0a 0d 0a 71 75 65  18..-7830....que
26c70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26c80 4c 45 43 54 20 35 32 20 2b 20 2b 20 63 6f 6c 31  LECT 52 + + col1
26c90 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
26ca0 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 33  1..----..119..13
26cb0 32 0d 0a 31 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  2..161....onlyif
26cc0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
26cd0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
26ce0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
26cf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
26d00 6c 61 62 65 6c 2d 31 30 39 38 0d 0a 53 45 4c 45  label-1098..SELE
26d10 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20  CT ALL ( + col1 
26d20 29 20 44 49 56 20 2d 20 74 61 62 30 2e 63 6f 6c  ) DIV - tab0.col
26d30 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  1 + col2 + col1 
26d40 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
26d50 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 30 0d 0a 37 35  ..----..2870..75
26d60 34 33 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  43..97....skipif
26d70 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
26d80 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
26d90 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26da0 30 39 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  098..SELECT ALL 
26db0 28 20 2b 20 63 6f 6c 31 20 29 20 2f 20 2d 20 74  ( + col1 ) / - t
26dc0 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  ab0.col1 + col2 
26dd0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
26de0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
26df0 38 37 30 0d 0a 37 35 34 33 0d 0a 39 37 0d 0a 0d  870..7543..97...
26e00 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
26e10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26e20 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30   ALL * FROM tab0
26e30 2c 20 74 61 62 32 20 63 6f 72 30 20 43 52 4f 53  , tab2 cor0 CROS
26e40 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63  S JOIN tab0 AS c
26e50 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76  or1..----..243 v
26e60 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
26e70 20 35 63 33 33 65 39 36 62 38 35 61 66 65 31 65   5c33e96b85afe1e
26e80 61 35 31 62 62 36 64 34 65 39 66 61 36 66 39 39  a51bb6d4e9fa6f99
26e90 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
26ea0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
26eb0 31 20 2a 20 2b 20 39 36 20 46 52 4f 4d 20 74 61  1 * + 96 FROM ta
26ec0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  b1..----..1248..
26ed0 32 34 39 36 0d 0a 39 36 30 0d 0a 0d 0a 71 75 65  2496..960....que
26ee0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26ef0 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 37 37 20  LECT ALL - + 77 
26f00 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
26f10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26f20 2d 31 38 0d 0a 2d 34 36 0d 0a 2d 36 30 0d 0a 0d  -18..-46..-60...
26f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26f40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26f50 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T + col0 * + col
26f60 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  1 * cor0.col1 FR
26f70 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
26f80 0a 2d 2d 2d 2d 0d 0a 31 37 37 35 30 34 0d 0a 33  .----..177504..3
26f90 32 39 33 31 35 0d 0a 37 33 37 30 30 39 0d 0a 0d  29315..737009...
26fa0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26fb0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
26fc0 54 20 2d 20 35 33 20 2b 20 63 6f 6c 30 20 41 53  T - 53 + col0 AS
26fd0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
26fe0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
26ff0 31 38 0d 0a 2d 32 39 0d 0a 33 36 0d 0a 0d 0a 71  18..-29..36....q
27000 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27010 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27020 2b 20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  + 0 AS col1 FROM
27030 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
27040 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
27050 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
27060 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
27070 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
27080 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
27090 65 6c 2d 31 31 30 35 0d 0a 53 45 4c 45 43 54 20  el-1105..SELECT 
270a0 2d 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  - + col1 DIV + c
270b0 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  or0.col2 - + col
270c0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
270d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
270e0 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36  -..-10..-13..-26
270f0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
27100 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
27110 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
27120 72 74 20 6c 61 62 65 6c 2d 31 31 30 35 0d 0a 53  rt label-1105..S
27130 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2f  ELECT - + col1 /
27140 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b   + cor0.col2 - +
27150 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
27160 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
27170 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
27180 0a 2d 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-26....onlyif m
27190 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
271a0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
271b0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
271c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
271d0 62 65 6c 2d 31 31 30 36 0d 0a 53 45 4c 45 43 54  bel-1106..SELECT
271e0 20 41 4c 4c 20 2d 20 33 39 20 2a 20 33 31 20 44   ALL - 39 * 31 D
271f0 49 56 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46  IV + col0 col1 F
27200 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
27210 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 31 38  ..----..-15..-18
27220 0d 0a 2d 34 30 33 0d 0a 0d 0a 73 6b 69 70 69 66  ..-403....skipif
27230 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
27240 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
27250 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
27260 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
27270 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
27280 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
27290 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
272a0 74 20 6c 61 62 65 6c 2d 31 31 30 36 0d 0a 53 45  t label-1106..SE
272b0 4c 45 43 54 20 41 4c 4c 20 2d 20 33 39 20 2a 20  LECT ALL - 39 * 
272c0 33 31 20 2f 20 2b 20 63 6f 6c 30 20 63 6f 6c 31  31 / + col0 col1
272d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
272e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d  r0..----..-15..-
272f0 31 38 0d 0a 2d 34 30 33 0d 0a 0d 0a 6f 6e 6c 79  18..-403....only
27300 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
27310 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
27320 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
27330 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27340 74 20 6c 61 62 65 6c 2d 31 31 30 37 0d 0a 53 45  t label-1107..SE
27350 4c 45 43 54 20 2d 20 28 20 2b 20 39 32 20 29 20  LECT - ( + 92 ) 
27360 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20  - col1 DIV col0 
27370 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27380 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27390 0a 2d 39 33 0d 0a 2d 39 34 0d 0a 2d 39 35 0d 0a  .-93..-94..-95..
273a0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
273b0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
273c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
273d0 20 6c 61 62 65 6c 2d 31 31 30 37 0d 0a 53 45 4c   label-1107..SEL
273e0 45 43 54 20 2d 20 28 20 2b 20 39 32 20 29 20 2d  ECT - ( + 92 ) -
273f0 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 41 53 20   col1 / col0 AS 
27400 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
27410 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39  S cor0..----..-9
27420 33 0d 0a 2d 39 34 0d 0a 2d 39 35 0d 0a 0d 0a 71  3..-94..-95....q
27430 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27440 53 45 4c 45 43 54 20 28 20 2b 20 36 32 20 29 20  SELECT ( + 62 ) 
27450 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20  * col2 + - col1 
27460 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
27470 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
27480 0a 33 33 32 32 0d 0a 33 35 32 34 0d 0a 35 39 33  .3322..3524..593
27490 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
274a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
274b0 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 32 20 29  TINCT ( - col2 )
274c0 20 2b 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52   + + ( col1 ) FR
274d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
274e0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d  .----..-28..-47.
274f0 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-83....query I 
27500 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27510 2d 20 2b 20 31 35 20 2b 20 63 6f 6c 32 20 2a 20  - + 15 + col2 * 
27520 2b 20 31 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 11 AS col2 FRO
27530 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
27540 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 33 34 38 0d 0a 38  ----..-4..348..8
27550 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
27560 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
27570 4c 20 2b 20 37 35 20 2a 20 63 6f 6c 30 20 2a 20  L + 75 * col0 * 
27580 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
27590 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
275a0 2d 2d 2d 2d 0d 0a 34 33 32 30 30 0d 0a 35 39 34  ----..43200..594
275b0 30 37 35 0d 0a 39 31 38 37 35 0d 0a 0d 0a 71 75  075..91875....qu
275c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
275d0 45 4c 45 43 54 20 2d 20 34 31 20 2b 20 32 36 20  ELECT - 41 + 26 
275e0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
275f0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
27600 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
27610 68 61 73 68 69 6e 67 20 74 6f 20 31 31 37 32 63  hashing to 1172c
27620 39 61 36 32 62 64 61 64 37 64 62 30 64 65 66 39  9a62bdad7db0def9
27630 32 30 35 63 30 36 65 65 31 66 32 0d 0a 0d 0a 71  205c06ee1f2....q
27640 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27650 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e  SELECT - + cor0.
27660 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col0 + col1 * + 
27670 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
27680 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
27690 36 38 0d 0a 31 34 30 31 0d 0a 35 30 36 0d 0a 0d  68..1401..506...
276a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
276b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 38 20  ..SELECT ALL 28 
276c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
276d0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  1 cor0..----..28
276e0 0d 0a 32 38 0d 0a 32 38 0d 0a 0d 0a 71 75 65 72  ..28..28....quer
276f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27700 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
27710 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
27720 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
27730 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27740 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 33 0d 0a  r0..----..1523..
27750 37 33 36 0d 0a 37 35 34 0d 0a 0d 0a 73 6b 69 70  736..754....skip
27760 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
27770 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
27780 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
27790 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
277a0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
277b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
277c0 20 33 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 39   30 * col1 + - 9
277d0 34 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  4 col0 FROM tab1
277e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
277f0 32 30 36 0d 0a 32 39 36 0d 0a 36 38 36 0d 0a 0d  206..296..686...
27800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27810 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 34  ..SELECT - ( - 4
27820 36 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 35  6 ) * - col0 + 5
27830 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
27840 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32 0d  ab2..----..-272.
27850 0a 2d 33 35 33 38 0d 0a 2d 33 35 38 34 0d 0a 0d  .-3538..-3584...
27860 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27870 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
27880 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 + + cor0.col
27890 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
278a0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
278b0 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d  -..-2..-62..-62.
278c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
278d0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
278e0 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30   + col1 + + col0
278f0 20 2a 20 28 20 2d 20 35 36 20 29 20 2a 20 2b 20   * ( - 56 ) * + 
27900 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
27910 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27920 2d 2d 2d 2d 0d 0a 2d 32 32 39 33 36 36 0d 0a 2d  ----..-229366..-
27930 33 35 38 33 38 37 0d 0a 2d 34 37 38 0d 0a 0d 0a  358387..-478....
27940 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27950 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 35  .SELECT col1 + 5
27960 38 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  8 FROM tab1..---
27970 2d 0d 0a 36 38 0d 0a 37 31 0d 0a 38 34 0d 0a 0d  -..68..71..84...
27980 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27990 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
279a0 20 63 6f 6c 30 20 2b 20 31 34 20 46 52 4f 4d 20   col0 + 14 FROM 
279b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
279c0 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36 35 0d 0a 37 0d  --..-64..-65..7.
279d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
279e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
279f0 20 63 6f 6c 32 20 2a 20 2b 20 32 20 2b 20 2b 20   col2 * + 2 + + 
27a00 39 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  97 AS col0 FROM 
27a10 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
27a20 2d 2d 0d 0a 32 30 35 0d 0a 32 31 31 0d 0a 32 38  --..205..211..28
27a30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
27a40 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
27a50 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
27a60 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
27a70 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
27a80 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
27a90 32 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  23..SELECT col0 
27aa0 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
27ab0 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 72  SIGNED ) * - cor
27ac0 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
27ad0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27ae0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
27af0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
27b00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
27b10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
27b20 72 74 20 6c 61 62 65 6c 2d 31 31 32 33 0d 0a 53  rt label-1123..S
27b30 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 43 41 53  ELECT col0 * CAS
27b40 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
27b50 47 45 52 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  GER ) * - cor0.c
27b60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
27b70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
27b80 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
27b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27ba0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
27bb0 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  or0.col1 * col2 
27bc0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
27bd0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  1 cor0..----..12
27be0 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
27bf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27c00 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
27c10 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c   cor0.col0 + col
27c20 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
27c30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
27c40 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e  -..0..0..0....on
27c50 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
27c60 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
27c70 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
27c80 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
27c90 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32 36 0d 0a  ort label-1126..
27ca0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27cb0 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 36 34 20  - col2 DIV + 64 
27cc0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
27cd0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
27ce0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
27cf0 0d 0a 36 34 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70  ..64..79....skip
27d00 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
27d10 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
27d20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
27d30 2d 31 31 32 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1126..SELECT DI
27d40 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2f 20  STINCT - col2 / 
27d50 2b 20 36 34 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  + 64 + + cor0.co
27d60 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
27d70 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
27d80 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 37 39 0d 0a 0d  --..3..64..79...
27d90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27da0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
27db0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63  ol2 + - col1 + c
27dc0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
27dd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31   cor0..----..-51
27de0 0d 0a 2d 37 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72  ..-7..24....quer
27df0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27e00 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63  ECT ALL col1 * c
27e10 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol2 * col2 + col
27e20 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
27e30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 34 0d 0a  or0..----..194..
27e40 36 31 31 39 37 35 0d 0a 39 33 37 34 30 0d 0a 0d  611975..93740...
27e50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27e60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
27e70 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T + col0 + col2 
27e80 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  * + col0 AS col1
27e90 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
27ea0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33  r0..----..165..3
27eb0 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65  712..7760....que
27ec0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27ed0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
27ee0 2d 20 33 39 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  - 39 + col2 * - 
27ef0 63 6f 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 30 20  col1 * - ( col0 
27f00 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
27f10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
27f20 2d 0d 0a 31 31 39 36 39 31 0d 0a 35 31 30 37 33  -..119691..51073
27f30 0d 0a 35 38 39 38 0d 0a 0d 0a 71 75 65 72 79 20  ..5898....query 
27f40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27f50 54 20 41 4c 4c 20 2d 20 31 20 2b 20 63 6f 6c 30  T ALL - 1 + col0
27f60 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
27f70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
27f80 0d 0a 32 0d 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 71  ..2..63..79....q
27f90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27fa0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63  SELECT ALL - - c
27fb0 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 * - col0 AS 
27fc0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
27fd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d  or0..----..-162.
27fe0 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d  .-3648..-7680...
27ff0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28000 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 31 20 41  ..SELECT ALL 1 A
28010 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
28020 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
28030 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
28040 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
28050 73 68 69 6e 67 20 74 6f 20 64 61 38 61 37 32 61  shing to da8a72a
28060 37 39 36 37 63 30 63 37 33 64 39 31 32 33 39 32  7967c0c73d912392
28070 37 35 32 33 30 61 65 64 39 0d 0a 0d 0a 71 75 65  75230aed9....que
28080 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28090 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 30  LECT DISTINCT 90
280a0 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
280b0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
280c0 2d 32 31 36 30 0d 0a 2d 33 31 35 30 0d 0a 2d 38  -2160..-3150..-8
280d0 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  010....query I r
280e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
280f0 4c 4c 20 28 20 38 36 20 29 20 2b 20 2b 20 63 6f  LL ( 86 ) + + co
28100 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
28110 2d 2d 0d 0a 31 31 32 0d 0a 31 31 33 0d 0a 31 32  --..112..113..12
28120 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
28130 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28140 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b  TINCT + + col0 +
28150 20 2b 20 63 6f 6c 32 20 2b 20 33 35 20 2a 20 63   + col2 + 35 * c
28160 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
28170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31   cor0..----..111
28180 39 0d 0a 32 31 36 39 0d 0a 37 31 32 0d 0a 0d 0a  9..2169..712....
28190 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
281a0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
281b0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
281c0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
281d0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
281e0 72 74 20 6c 61 62 65 6c 2d 31 31 33 37 0d 0a 53  rt label-1137..S
281f0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a  ELECT ALL col0 *
28200 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
28210 49 47 4e 45 44 20 29 20 2f 20 28 20 2d 20 63 6f  IGNED ) / ( - co
28220 72 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c  r0.col1 ) AS col
28230 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
28240 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
28250 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
28260 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
28270 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
28280 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28290 62 65 6c 2d 31 31 33 37 0d 0a 53 45 4c 45 43 54  bel-1137..SELECT
282a0 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 43 41 53 54   ALL col0 * CAST
282b0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
282c0 45 52 20 29 20 2f 20 28 20 2d 20 63 6f 72 30 2e  ER ) / ( - cor0.
282d0 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
282e0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
282f0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
28300 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
28310 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
28320 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
28330 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
28340 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
28350 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
28360 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
28370 6f 6c 30 20 2b 20 32 37 20 63 6f 6c 31 20 46 52  ol0 + 27 col1 FR
28380 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28390 0a 2d 2d 2d 2d 0d 0a 31 30 37 0d 0a 33 30 0d 0a  .----..107..30..
283a0 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  91....query I ro
283b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
283c0 37 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  7 FROM tab2, tab
283d0 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
283e0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
283f0 20 68 61 73 68 69 6e 67 20 74 6f 20 34 65 37 32   hashing to 4e72
28400 65 39 65 33 33 64 61 63 61 63 37 35 37 66 34 38  e9e33dacac757f48
28410 64 30 63 65 34 36 30 39 34 36 30 37 0d 0a 0d 0a  d0ce46094607....
28420 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28430 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d  .SELECT col1 + -
28440 20 63 6f 6c 31 20 2a 20 2b 20 39 32 20 41 53 20   col1 * + 92 AS 
28450 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
28460 2d 2d 2d 2d 0d 0a 2d 31 35 34 37 0d 0a 2d 32 38  ----..-1547..-28
28470 32 31 0d 0a 2d 35 33 36 39 0d 0a 0d 0a 71 75 65  21..-5369....que
28480 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28490 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
284a0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
284b0 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
284c0 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20  2 AS cor0, tab0 
284d0 41 53 20 63 6f 72 31 2c 20 74 61 62 30 20 41 53  AS cor1, tab0 AS
284e0 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d   cor2..----..17.
284f0 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79  .31..59....query
28500 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28510 43 54 20 2b 20 38 38 20 41 53 20 63 6f 6c 31 20  CT + 88 AS col1 
28520 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
28530 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
28540 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
28550 74 6f 20 36 62 65 31 37 62 38 32 65 63 62 33 65  to 6be17b82ecb3e
28560 38 62 32 36 38 66 63 62 34 62 61 36 31 30 64 64  8b268fcb4ba610dd
28570 62 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  b37....query I r
28580 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
28590 20 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f 6c   col1 * tab2.col
285a0 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 + col0 FROM ta
285b0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a  b2..----..-210..
285c0 2d 33 34 30 33 0d 0a 2d 39 35 34 0d 0a 0d 0a 71  -3403..-954....q
285d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
285e0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
285f0 2d 20 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c  - + col2 * ( col
28600 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  1 ) AS col2 FROM
28610 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
28620 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30  ---..-1248..-140
28630 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79  4..-570....query
28640 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28650 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 37 34  CT ALL col1 + 74
28660 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
28670 0d 0a 31 36 30 0d 0a 31 36 35 0d 0a 31 37 31 0d  ..160..165..171.
28680 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28690 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c  rt..SELECT ( col
286a0 32 20 2b 20 2d 20 63 6f 6c 30 20 29 20 41 53 20  2 + - col0 ) AS 
286b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
286c0 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 0d 0a 39  ----..-34..-7..9
286d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
286e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
286f0 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  l1 * + col0 + - 
28700 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
28710 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
28720 2d 2d 2d 2d 0d 0a 31 39 37 38 0d 0a 33 32 39 38  ----..1978..3298
28730 0d 0a 38 30 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..8008....onlyif
28740 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
28750 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
28760 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
28770 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28780 6c 61 62 65 6c 2d 31 31 34 38 0d 0a 53 45 4c 45  label-1148..SELE
28790 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
287a0 6c 31 20 2b 20 2b 20 39 32 20 44 49 56 20 2d 20  l1 + + 92 DIV - 
287b0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
287c0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
287d0 32 0d 0a 2d 33 33 0d 0a 2d 36 30 0d 0a 0d 0a 73  2..-33..-60....s
287e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
287f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
28800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28810 62 65 6c 2d 31 31 34 38 0d 0a 53 45 4c 45 43 54  bel-1148..SELECT
28820 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
28830 20 2b 20 2b 20 39 32 20 2f 20 2d 20 63 6f 6c 31   + + 92 / - col1
28840 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
28850 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d  b2..----..-22..-
28860 33 33 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65 72 79  33..-60....query
28870 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28880 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a  CT col0 * col1 *
28890 20 37 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   78 AS col2 FROM
288a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
288b0 2d 2d 2d 0d 0a 34 39 39 32 30 0d 0a 36 30 38 34  ---..49920..6084
288c0 0d 0a 38 31 31 32 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..81120....onlyi
288d0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
288e0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
288f0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
28900 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
28910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
28920 62 65 6c 2d 31 31 35 30 0d 0a 53 45 4c 45 43 54  bel-1150..SELECT
28930 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20   + ( col1 ) + - 
28940 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 63 6f 6c  col1 * CAST( col
28950 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  1 AS SIGNED ) AS
28960 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
28970 0a 2d 2d 2d 2d 0d 0a 2d 32 37 32 0d 0a 2d 33 34  .----..-272..-34
28980 32 32 0d 0a 2d 39 33 30 0d 0a 0d 0a 73 6b 69 70  22..-930....skip
28990 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
289a0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
289b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
289c0 2d 31 31 35 30 0d 0a 53 45 4c 45 43 54 20 2b 20  -1150..SELECT + 
289d0 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c  ( col1 ) + - col
289e0 31 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 31 20  1 * CAST ( col1 
289f0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
28a00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
28a10 2d 2d 2d 2d 0d 0a 2d 32 37 32 0d 0a 2d 33 34 32  ----..-272..-342
28a20 32 0d 0a 2d 39 33 30 0d 0a 0d 0a 6f 6e 6c 79 69  2..-930....onlyi
28a30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
28a40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
28a50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
28a60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28a70 20 6c 61 62 65 6c 2d 31 31 35 31 0d 0a 53 45 4c   label-1151..SEL
28a80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
28a90 6f 6c 31 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol1 DIV cor0.col
28aa0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
28ab0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
28ac0 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..-1....skipif 
28ad0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
28ae0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
28af0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28b00 35 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  51..SELECT DISTI
28b10 4e 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 72  NCT - col1 / cor
28b20 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  0.col1 AS col1 F
28b30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
28b40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71 75  ..----..-1....qu
28b50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28b60 45 4c 45 43 54 20 37 33 20 2a 20 2d 20 63 6f 72  ELECT 73 * - cor
28b70 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  0.col1 + - col0 
28b80 2b 20 2b 20 28 20 2d 20 63 6f 6c 30 20 2a 20 63  + + ( - col0 * c
28b90 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol0 ) AS col1 FR
28ba0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28bb0 0a 2d 2d 2d 2d 0d 0a 2d 31 39 31 30 0d 0a 2d 34  .----..-1910..-4
28bc0 38 39 30 0d 0a 2d 37 34 32 39 0d 0a 0d 0a 71 75  890..-7429....qu
28bd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28be0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
28bf0 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l0 + - cor0.col2
28c00 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * - col1 FROM t
28c10 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28c20 2d 0d 0a 31 34 35 36 0d 0a 35 36 37 0d 0a 38 33  -..1456..567..83
28c30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28c40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
28c50 20 2b 20 63 6f 6c 30 20 29 20 2b 20 28 20 2d 20   + col0 ) + ( - 
28c60 63 6f 6c 31 20 29 20 2a 20 63 6f 72 30 2e 63 6f  col1 ) * cor0.co
28c70 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
28c80 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
28c90 2d 2d 0d 0a 2d 37 34 32 30 0d 0a 2d 38 33 37 30  --..-7420..-8370
28ca0 0d 0a 2d 39 34 34 34 0d 0a 0d 0a 71 75 65 72 79  ..-9444....query
28cb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28cc0 43 54 20 2b 20 2d 20 37 34 20 46 52 4f 4d 20 74  CT + - 74 FROM t
28cd0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
28ce0 2d 37 34 0d 0a 2d 37 34 0d 0a 2d 37 34 0d 0a 0d  -74..-74..-74...
28cf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28d00 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
28d10 63 6f 6c 31 20 2b 20 36 35 20 41 53 20 63 6f 6c  col1 + 65 AS col
28d20 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
28d30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 38 0d  or0..----..1408.
28d40 0a 32 38 32 0d 0a 34 36 36 37 0d 0a 0d 0a 6f 6e  .282..4667....on
28d50 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
28d60 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
28d70 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
28d80 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
28d90 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 37 0d 0a  ort label-1157..
28da0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28db0 2d 20 2d 20 31 38 20 2a 20 63 6f 6c 30 20 44 49  - - 18 * col0 DI
28dc0 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V - col0 FROM ta
28dd0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
28de0 0d 0a 2d 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-18....skipif 
28df0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
28e00 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
28e10 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
28e20 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  57..SELECT DISTI
28e30 4e 43 54 20 2d 20 2d 20 31 38 20 2a 20 63 6f 6c  NCT - - 18 * col
28e40 30 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 / - col0 FROM 
28e50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
28e60 2d 2d 0d 0a 2d 31 38 0d 0a 0d 0a 71 75 65 72 79  --..-18....query
28e70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
28e80 43 54 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b  CT col0 * col2 +
28e90 20 2d 20 63 6f 6c 31 20 2a 20 32 20 2b 20 2d 20   - col1 * 2 + - 
28ea0 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
28eb0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
28ec0 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 38 38 34 0d  ----..100..1884.
28ed0 0a 32 39 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .2930....query I
28ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28ef0 20 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 32   DISTINCT ( col2
28f00 20 29 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   ) + col1 + - co
28f10 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
28f20 2d 2d 0d 0a 32 39 0d 0a 33 0d 0a 37 37 0d 0a 0d  --..29..3..77...
28f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28f40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 20 2b  ..SELECT ALL 6 +
28f50 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   - col2 * col2 +
28f60 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
28f70 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
28f80 0a 2d 31 34 35 35 0d 0a 2d 37 32 39 0d 0a 2d 37  .-1455..-729..-7
28f90 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  54....onlyif mys
28fa0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
28fb0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
28fc0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
28fd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28fe0 6c 2d 31 31 36 31 0d 0a 53 45 4c 45 43 54 20 2d  l-1161..SELECT -
28ff0 20 34 35 20 44 49 56 20 63 6f 6c 30 20 41 53 20   45 DIV col0 AS 
29000 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
29010 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
29020 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  ..-1..0....skipi
29030 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
29040 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
29050 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
29060 31 31 36 31 0d 0a 53 45 4c 45 43 54 20 2d 20 34  1161..SELECT - 4
29070 35 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  5 / col0 AS col0
29080 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
29090 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
290a0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
290b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
290c0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63  ol1 + - col1 * c
290d0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
290e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   cor0..----..-27
290f0 35 32 0d 0a 2d 37 33 37 31 0d 0a 30 0d 0a 0d 0a  52..-7371..0....
29100 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29110 0a 53 45 4c 45 43 54 20 39 37 20 41 53 20 63 6f  .SELECT 97 AS co
29120 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
29130 30 0d 0a 2d 2d 2d 2d 0d 0a 39 37 0d 0a 39 37 0d  0..----..97..97.
29140 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
29150 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
29160 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f  LL cor0.col0 FRO
29170 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
29180 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d  cor0, tab2 cor1.
29190 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
291a0 20 68 61 73 68 69 6e 67 20 74 6f 20 37 37 38 62   hashing to 778b
291b0 35 30 35 37 35 61 39 62 39 31 34 34 38 31 31 39  50575a9b91448119
291c0 65 65 30 65 65 31 61 39 63 34 34 66 0d 0a 0d 0a  ee0ee1a9c44f....
291d0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
291e0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
291f0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
29200 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
29210 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
29220 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29230 20 44 49 53 54 49 4e 43 54 20 32 37 20 63 6f 6c   DISTINCT 27 col
29240 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
29250 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 0d  or0..----..27...
29260 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29270 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
29280 20 35 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   54 AS col0 FROM
29290 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
292a0 0d 0a 35 34 0d 0a 35 34 0d 0a 35 34 0d 0a 0d 0a  ..54..54..54....
292b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
292c0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d  .SELECT col1 + -
292d0 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 28   cor0.col0 * + (
292e0 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62   col1 ) FROM tab
292f0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
29300 0a 2d 31 33 32 36 0d 0a 2d 31 38 36 0d 0a 2d 34  .-1326..-186..-4
29310 35 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  543....query I r
29320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
29330 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
29340 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 * + col1 AS co
29350 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
29360 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30  cor0..----..1040
29370 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65  ..640..78....que
29380 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29390 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
293a0 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 41 53 20 63  col0 + col1 AS c
293b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
293c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
293d0 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65  ..-67..23....que
293e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
293f0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
29400 2a 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  * col1 * - cor0.
29410 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
29420 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
29430 2d 2d 2d 2d 0d 0a 32 32 38 33 31 0d 0a 32 37 31  ----..22831..271
29440 35 31 38 0d 0a 36 37 32 37 0d 0a 0d 0a 71 75 65  518..6727....que
29450 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29460 4c 45 43 54 20 2d 20 38 20 2b 20 2d 20 63 6f 6c  LECT - 8 + - col
29470 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
29480 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
29490 2d 0d 0a 2d 34 31 0d 0a 2d 39 0d 0a 2d 39 30 0d  -..-41..-9..-90.
294a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
294b0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 38 20  rt..SELECT + 78 
294c0 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + + col0 AS col2
294d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
294e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31  r0..----..102..1
294f0 31 33 0d 0a 31 36 37 0d 0a 0d 0a 71 75 65 72 79  13..167....query
29500 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29510 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20  CT ALL - + col2 
29520 2b 20 63 6f 6c 31 20 2a 20 2b 20 37 33 20 2a 20  + col1 * + 73 * 
29530 2b 20 35 37 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 57 AS col2 FRO
29540 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
29550 2d 0d 0a 33 35 37 38 31 33 0d 0a 33 37 38 35 36  -..357813..37856
29560 39 0d 0a 34 30 33 36 31 36 0d 0a 0d 0a 71 75 65  9..403616....que
29570 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29580 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
29590 28 20 32 33 20 29 20 41 53 20 63 6f 6c 31 20 46  ( 23 ) AS col1 F
295a0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20  ROM tab2, tab0, 
295b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
295c0 2d 2d 0d 0a 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  --..23....onlyif
295d0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
295e0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
295f0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
29600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
29610 6c 61 62 65 6c 2d 31 31 37 35 0d 0a 53 45 4c 45  label-1175..SELE
29620 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 32 32  CT + col1 + + 22
29630 20 44 49 56 20 37 33 20 41 53 20 63 6f 6c 31 20   DIV 73 AS col1 
29640 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
29650 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d  0..----..17..31.
29660 0a 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .59....skipif my
29670 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
29680 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
29690 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 35  wsort label-1175
296a0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
296b0 2b 20 2b 20 32 32 20 2f 20 37 33 20 41 53 20 63  + + 22 / 73 AS c
296c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
296d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d   cor0..----..17.
296e0 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79 69  .31..59....onlyi
296f0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
29700 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
29710 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
29720 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29730 20 6c 61 62 65 6c 2d 31 31 37 36 0d 0a 53 45 4c   label-1176..SEL
29740 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  ECT cor0.col2 DI
29750 56 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  V - col2 - - col
29760 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
29770 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 32  or0..----..12..2
29780 35 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  5..9....skipif m
29790 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
297a0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
297b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37  owsort label-117
297c0 36 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63  6..SELECT cor0.c
297d0 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32 20 2d 20 2d  ol2 / - col2 - -
297e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
297f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
29800 32 0d 0a 32 35 0d 0a 39 0d 0a 0d 0a 71 75 65 72  2..25..9....quer
29810 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29820 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT - cor0.col0 
29830 2b 20 2d 20 28 20 39 35 20 29 20 46 52 4f 4d 20  + - ( 95 ) FROM 
29840 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
29850 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 31 37 33 0d 0a  --..-102..-173..
29860 2d 31 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -174....query I 
29870 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29880 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  col0 - col0 * co
29890 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  r0.col1 AS col1 
298a0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
298b0 2d 2d 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d 37 35 0d  ----..-576..-75.
298c0 0a 2d 39 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-960....onlyif 
298d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
298e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
298f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
29900 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
29910 61 62 65 6c 2d 31 31 37 39 0d 0a 53 45 4c 45 43  abel-1179..SELEC
29920 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
29930 30 20 44 49 56 20 2d 20 33 30 20 46 52 4f 4d 20  0 DIV - 30 FROM 
29940 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
29950 2d 2d 0d 0a 30 0d 0a 32 0d 0a 0d 0a 73 6b 69 70  --..0..2....skip
29960 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
29970 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
29980 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
29990 2d 31 31 37 39 0d 0a 53 45 4c 45 43 54 20 44 49  -1179..SELECT DI
299a0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2f 20  STINCT - col0 / 
299b0 2d 20 33 30 20 46 52 4f 4d 20 74 61 62 32 20 41  - 30 FROM tab2 A
299c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
299d0 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .2....query I ro
299e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
299f0 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 35 20 2a  L + col0 + - 5 *
29a00 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41   - col2 * col2 A
29a10 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
29a20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
29a30 33 33 37 30 39 0d 0a 34 30 0d 0a 35 34 36 39 0d  33709..40..5469.
29a40 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
29a50 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
29a60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a  ELECT DISTINCT *
29a70 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
29a80 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
29a90 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  b0, tab1 AS cor1
29aa0 2c 20 74 61 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d  , tab0 cor2..---
29ab0 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61  -..972 values ha
29ac0 73 68 69 6e 67 20 74 6f 20 39 35 39 32 30 34 30  shing to 9592040
29ad0 33 64 66 32 36 38 61 32 37 32 63 34 65 39 33 33  3df268a272c4e933
29ae0 63 64 30 62 62 65 30 62 65 0d 0a 0d 0a 71 75 65  cd0bbe0be....que
29af0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
29b00 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
29b10 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d 20 2d 20  col1 * col0 - - 
29b20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
29b30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 38  or0..----..-1978
29b40 0d 0a 2d 33 32 39 38 0d 0a 2d 38 30 30 38 0d 0a  ..-3298..-8008..
29b50 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
29b60 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
29b70 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
29b80 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
29b90 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
29ba0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29bb0 43 54 20 32 34 20 63 6f 6c 32 20 46 52 4f 4d 20  CT 24 col2 FROM 
29bc0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
29bd0 2d 2d 0d 0a 32 34 0d 0a 32 34 0d 0a 32 34 0d 0a  --..24..24..24..
29be0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
29bf0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
29c00 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
29c10 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
29c20 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
29c30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29c40 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2d 20  CT ALL + col2 - 
29c50 2b 20 32 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74  + 24 col1 FROM t
29c60 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
29c70 33 30 0d 0a 33 33 0d 0a 37 32 0d 0a 0d 0a 71 75  30..33..72....qu
29c80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29c90 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
29ca0 20 2d 20 39 31 20 2a 20 2b 20 39 31 20 2a 20 2d   - 91 * + 91 * -
29cb0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
29cc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 38  cor0..----..-198
29cd0 37 34 34 0d 0a 2d 32 38 39 38 33 35 0d 0a 2d 37  744..-289835..-7
29ce0 33 37 30 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  37009....onlyif 
29cf0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
29d00 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
29d10 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
29d20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
29d30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29d40 6c 2d 31 31 38 36 0d 0a 53 45 4c 45 43 54 20 44  l-1186..SELECT D
29d50 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 4e 55  ISTINCT CAST( NU
29d60 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f  LL AS SIGNED ) /
29d70 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
29d80 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
29d90 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
29da0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
29db0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
29dc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
29dd0 6c 61 62 65 6c 2d 31 31 38 36 0d 0a 53 45 4c 45  label-1186..SELE
29de0 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
29df0 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
29e00 45 52 20 29 20 2f 20 2d 20 63 6f 6c 31 20 41 53  ER ) / - col1 AS
29e10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
29e20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
29e30 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ULL....skipif po
29e40 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
29e50 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
29e60 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
29e70 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
29e80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29e90 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 63  .SELECT col2 - c
29ea0 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
29eb0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
29ec0 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a  ..28..47..83....
29ed0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
29ee0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
29ef0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
29f00 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
29f10 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
29f20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29f30 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20   ALL + col2 * + 
29f40 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 63 6f  col0 + - col1 co
29f50 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
29f60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d  cor0..----..158.
29f70 0a 31 39 36 39 0d 0a 32 39 38 35 0d 0a 0d 0a 71  .1969..2985....q
29f80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29f90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29fa0 2d 20 33 33 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  - 33 + col1 * co
29fb0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
29fc0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 36 33  cor0..----..7363
29fd0 0d 0a 38 32 34 38 0d 0a 39 33 37 36 0d 0a 0d 0a  ..8248..9376....
29fe0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
29ff0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2a000 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2a010 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2a020 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 30  wsort label-1190
2a030 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a040 54 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 63  T + - col2 DIV c
2a050 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 72  or0.col0 - - cor
2a060 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
2a070 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a080 0d 0a 2d 2d 2d 2d 0d 0a 38 35 0d 0a 39 31 0d 0a  ..----..85..91..
2a090 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
2a0a0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a0b0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a0c0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 30 0d  sort label-1190.
2a0d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a0e0 20 2b 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 72 30   + - col2 / cor0
2a0f0 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 72 30 2e 63  .col0 - - cor0.c
2a100 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2a110 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a120 2d 2d 2d 0d 0a 38 35 0d 0a 39 31 0d 0a 39 37 0d  ---..85..91..97.
2a130 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2a140 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d  rt..SELECT + ( -
2a150 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 2a   col1 ) * col2 *
2a160 20 63 6f 6c 30 20 2b 20 2d 20 35 34 20 46 52 4f   col0 + - 54 FRO
2a170 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
2a180 2d 0d 0a 2d 31 31 39 37 30 36 0d 0a 2d 35 31 30  -..-119706..-510
2a190 38 38 0d 0a 2d 35 39 31 33 0d 0a 0d 0a 73 6b 69  88..-5913....ski
2a1a0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2a1b0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2a1c0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2a1d0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2a1e0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2a1f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2a200 2b 20 38 33 20 2a 20 63 6f 6c 31 20 63 6f 6c 32  + 83 * col1 col2
2a210 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2a220 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 31 31 0d  r0..----..-1411.
2a230 0a 2d 32 35 37 33 0d 0a 2d 34 38 39 37 0d 0a 0d  .-2573..-4897...
2a240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a250 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a260 54 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 72 30 2e  T col2 - + cor0.
2a270 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
2a280 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
2a290 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2a2a0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2a2b0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2a2c0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2a2d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 34  wsort label-1194
2a2e0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a2f0 54 20 2d 20 63 6f 6c 32 20 2d 20 36 31 20 44 49  T - col2 - 61 DI
2a300 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  V col2 AS col0 F
2a310 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2a320 2d 33 34 0d 0a 2d 36 32 0d 0a 2d 38 32 0d 0a 0d  -34..-62..-82...
2a330 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2a340 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2a350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2a360 6c 61 62 65 6c 2d 31 31 39 34 0d 0a 53 45 4c 45  label-1194..SELE
2a370 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
2a380 6c 32 20 2d 20 36 31 20 2f 20 63 6f 6c 32 20 41  l2 - 61 / col2 A
2a390 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2a3a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 36 32  ..----..-34..-62
2a3b0 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-82....query I
2a3c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a3d0 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 31 38 20 2a   - col0 + - 18 *
2a3e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2a3f0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
2a400 31 30 39 30 0d 0a 2d 31 38 30 38 0d 0a 2d 39 37  1090..-1808..-97
2a410 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2a420 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2a430 6f 6c 32 20 2b 20 63 6f 6c 32 20 2d 20 74 61 62  ol2 + col2 - tab
2a440 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  1.col0 FROM tab1
2a450 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 31 32  ..----..105..112
2a460 0d 0a 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..50....query I 
2a470 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a480 44 49 53 54 49 4e 43 54 20 2d 20 32 33 20 2b 20  DISTINCT - 23 + 
2a490 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
2a4a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
2a4b0 0a 31 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79  .12..66....query
2a4c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a4d0 43 54 20 2b 20 38 36 20 2a 20 37 36 20 46 52 4f  CT + 86 * 76 FRO
2a4e0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 36 35  M tab1..----..65
2a4f0 33 36 0d 0a 36 35 33 36 0d 0a 36 35 33 36 0d 0a  36..6536..6536..
2a500 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a510 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 35 20 2b  t..SELECT + 45 +
2a520 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
2a530 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37  OM tab2..----..7
2a540 31 0d 0a 37 32 0d 0a 38 33 0d 0a 0d 0a 71 75 65  1..72..83....que
2a550 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a560 4c 45 43 54 20 63 6f 6c 31 20 2b 20 34 20 41 53  LECT col1 + 4 AS
2a570 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2a580 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 37 0d 0a 33  .----..14..17..3
2a590 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2a5a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2a5b0 54 49 4e 43 54 20 2d 20 37 34 20 2b 20 74 61 62  TINCT - 74 + tab
2a5c0 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1.col1 FROM tab1
2a5d0 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 0d 0a 2d 36 31  ..----..-48..-61
2a5e0 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-64....query I
2a5f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a600 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
2a610 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 28 20 2d 20  r0.col0 + + ( - 
2a620 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
2a630 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a640 2d 32 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d  -29..-74..-93...
2a650 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2a660 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2a670 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2a680 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2a690 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2a6a0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 33 0d 0a  ort label-1203..
2a6b0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
2a6c0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
2a6d0 44 20 29 20 2b 20 36 34 20 41 53 20 63 6f 6c 32  D ) + 64 AS col2
2a6e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2a6f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2a700 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
2a710 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2a720 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2a730 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2a740 65 6c 2d 31 32 30 33 0d 0a 53 45 4c 45 43 54 20  el-1203..SELECT 
2a750 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  ALL - CAST ( NUL
2a760 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  L AS INTEGER ) +
2a770 20 36 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   64 AS col2 FROM
2a780 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2a790 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2a7a0 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
2a7b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a7c0 20 2b 20 28 20 2d 20 36 37 20 29 20 2a 20 2b 20   + ( - 67 ) * + 
2a7d0 63 6f 6c 31 20 2b 20 2d 20 39 31 20 46 52 4f 4d  col1 + - 91 FROM
2a7e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2a7f0 2d 2d 2d 0d 0a 2d 31 32 33 30 0d 0a 2d 32 31 36  ---..-1230..-216
2a800 38 0d 0a 2d 34 30 34 34 0d 0a 0d 0a 6f 6e 6c 79  8..-4044....only
2a810 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2a820 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2a830 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2a840 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a850 74 20 6c 61 62 65 6c 2d 31 32 30 35 0d 0a 53 45  t label-1205..SE
2a860 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2a870 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31 20  col1 DIV + col1 
2a880 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2a890 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  ----..1....skipi
2a8a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2a8b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2a8c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2a8d0 31 32 30 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  1205..SELECT DIS
2a8e0 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2f 20 2b  TINCT + col1 / +
2a8f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2a900 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  cor0..----..1...
2a910 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a920 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a930 54 20 2d 20 2d 20 28 20 36 20 29 20 46 52 4f 4d  T - - ( 6 ) FROM
2a940 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2a950 2d 2d 2d 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20  ---..6....query 
2a960 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a970 54 20 2d 20 2d 20 39 30 20 41 53 20 63 6f 6c 32  T - - 90 AS col2
2a980 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2a990 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a 39 30  r0..----..90..90
2a9a0 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..90....query I 
2a9b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a9c0 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  - col2 * - col0 
2a9d0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  * cor0.col0 AS c
2a9e0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
2a9f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a  r0..----..1323..
2aa00 31 35 38 31 38 34 0d 0a 32 33 37 31 35 38 0d 0a  158184..237158..
2aa10 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2aa20 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2aa30 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2aa40 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2aa50 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2aa60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2aa70 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30  CT col1 * + cor0
2aa80 2e 63 6f 6c 32 20 2b 20 37 30 20 2a 20 63 6f 6c  .col2 + 70 * col
2aa90 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
2aaa0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2aab0 31 33 32 30 32 0d 0a 31 36 37 0d 0a 35 31 34 38  13202..167..5148
2aac0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2aad0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 38  ort..SELECT + 98
2aae0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
2aaf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2ab00 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34 0d 0a 36 32  0..----..294..62
2ab10 37 32 0d 0a 37 38 34 30 0d 0a 0d 0a 71 75 65 72  72..7840....quer
2ab20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ab30 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ECT cor0.col1 * 
2ab40 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
2ab50 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
2ab60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2ab70 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2ab80 67 20 74 6f 20 62 63 36 36 39 61 33 63 63 39 36  g to bc669a3cc96
2ab90 39 63 37 36 31 39 65 62 63 66 66 62 35 34 30 30  9c7619ebcffb5400
2aba0 62 61 30 62 61 0d 0a 0d 0a 71 75 65 72 79 20 49  ba0ba....query I
2abb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2abc0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 33 37 20   cor0.col0 + 37 
2abd0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2abe0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d 0a 31 31  0..----..115..11
2abf0 36 0d 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  6..44....query I
2ac00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ac10 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63   - col2 - cor0.c
2ac20 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
2ac30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
2ac40 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a 6f  9..-67..-80....o
2ac50 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2ac60 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2ac70 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2ac80 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2ac90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2aca0 74 20 6c 61 62 65 6c 2d 31 32 31 34 0d 0a 53 45  t label-1214..SE
2acb0 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 43 41  LECT - col2 + CA
2acc0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
2acd0 45 44 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  ED ) AS col2 FRO
2ace0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2acf0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
2ad00 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2ad10 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2ad20 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2ad30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2ad40 32 31 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  214..SELECT - co
2ad50 6c 32 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c  l2 + CAST ( NULL
2ad60 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
2ad70 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
2ad80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
2ad90 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
2ada0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2adb0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
2adc0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col2 * - col0 + 
2add0 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col2 * - cor0.co
2ade0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2adf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 36  cor0..----..-156
2ae00 36 0d 0a 2d 34 32 31 38 0d 0a 2d 38 39 32 38 0d  6..-4218..-8928.
2ae10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ae20 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2ae30 20 63 6f 6c 32 20 2b 20 28 20 2d 20 28 20 74 61   col2 + ( - ( ta
2ae40 62 30 2e 63 6f 6c 30 20 29 20 2b 20 2b 20 63 6f  b0.col0 ) + + co
2ae50 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l1 ) FROM tab0..
2ae60 2d 2d 2d 2d 0d 0a 36 33 0d 0a 38 34 0d 0a 39 35  ----..63..84..95
2ae70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ae80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ae90 49 4e 43 54 20 2d 20 33 38 20 2d 20 34 36 20 46  INCT - 38 - 46 F
2aea0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
2aeb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor0..----..-8
2aec0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2aed0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2aee0 6f 6c 32 20 2a 20 28 20 63 6f 6c 30 20 29 20 2b  ol2 * ( col0 ) +
2aef0 20 63 6f 6c 32 20 2a 20 35 33 20 2a 20 2b 20 37   col2 * 53 * + 7
2af00 33 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  3 - + col1 FROM 
2af10 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
2af20 0a 32 30 39 30 36 32 0d 0a 32 32 34 31 37 31 0d  .209062..224171.
2af30 0a 33 37 39 30 39 31 0d 0a 0d 0a 71 75 65 72 79  .379091....query
2af40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2af50 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20  CT ALL - col1 * 
2af60 36 34 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 31  64 * col1 - col1
2af70 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
2af80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2af90 0a 2d 34 38 30 37 34 30 0d 0a 2d 35 33 38 32 36  .-480740..-53826
2afa0 35 0d 0a 2d 36 31 31 35 38 35 0d 0a 0d 0a 71 75  5..-611585....qu
2afb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2afc0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
2afd0 20 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 2b 20   * + ( col1 ) + 
2afe0 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 30  cor0.col2 - col0
2aff0 20 2a 20 39 33 20 46 52 4f 4d 20 74 61 62 31 20   * 93 FROM tab1 
2b000 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2b010 35 39 39 35 0d 0a 2d 37 35 31 33 0d 0a 2d 39 30  5995..-7513..-90
2b020 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2b030 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2b040 54 49 4e 43 54 20 2b 20 34 33 20 2a 20 63 6f 6c  TINCT + 43 * col
2b050 32 20 2a 20 35 33 20 46 52 4f 4d 20 74 61 62 31  2 * 53 FROM tab1
2b060 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 30 36 36 0d 0a  ..----..123066..
2b070 31 32 39 39 30 33 0d 0a 32 31 38 37 38 34 0d 0a  129903..218784..
2b080 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b090 74 0d 0a 53 45 4c 45 43 54 20 32 33 20 2a 20 63  t..SELECT 23 * c
2b0a0 6f 6c 31 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20  ol1 + tab2.col0 
2b0b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2b0c0 0a 31 34 33 35 0d 0a 34 37 30 0d 0a 37 32 30 0d  .1435..470..720.
2b0d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b0e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2b0f0 4e 43 54 20 2b 20 63 6f 72 31 2e 63 6f 6c 31 20  NCT + cor1.col1 
2b100 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2b110 32 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  2 cor0 CROSS JOI
2b120 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
2b130 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37  ----..86..91..97
2b140 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b150 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2b160 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63 6f 72 30  INCT col1 * cor0
2b170 2e 63 6f 6c 32 20 2d 20 63 6f 72 30 2e 63 6f 6c  .col2 - cor0.col
2b180 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
2b190 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 35 0d 0a 31 33  ..----..1235..13
2b1a0 37 38 0d 0a 35 36 30 0d 0a 0d 0a 71 75 65 72 79  78..560....query
2b1b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b1c0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f  CT ALL col2 + co
2b1d0 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63  r0.col0 * cor0.c
2b1e0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2b1f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2b200 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32 31 36 0d 0a  ---..2054..216..
2b210 33 30 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3040....query I 
2b220 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b230 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
2b240 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  - cor0.col0 * + 
2b250 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
2b260 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2b270 2d 2d 2d 2d 0d 0a 2d 32 30 39 37 0d 0a 2d 33 33  ----..-2097..-33
2b280 39 36 0d 0a 2d 38 31 38 31 0d 0a 0d 0a 6f 6e 6c  96..-8181....onl
2b290 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2b2a0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2b2b0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2b2c0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2b2d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b2e0 6c 61 62 65 6c 2d 31 32 32 37 0d 0a 53 45 4c 45  label-1227..SELE
2b2f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2b300 6c 30 20 2b 20 43 41 53 54 28 20 63 6f 6c 30 20  l0 + CAST( col0 
2b310 2a 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  * col1 AS SIGNED
2b320 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
2b330 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2b340 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d 0a 38  --..1120..704..8
2b350 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
2b360 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2b370 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2b380 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 37 0d 0a  ort label-1227..
2b390 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2b3a0 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20  + col0 + CAST ( 
2b3b0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53 20 49  col0 * col1 AS I
2b3c0 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
2b3d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2b3e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a  r0..----..1120..
2b3f0 37 30 34 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79  704..81....query
2b400 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b410 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
2b420 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l0 + + col2 FROM
2b430 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35   tab2..----..205
2b440 34 0d 0a 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a  4..216..3040....
2b450 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b460 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2b470 20 63 6f 6c 32 20 2b 20 74 61 62 30 2e 63 6f 6c   col2 + tab0.col
2b480 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  0 * col0 AS col1
2b490 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2b4a0 0d 0a 31 32 32 36 0d 0a 36 30 39 0d 0a 38 30 30  ..1226..609..800
2b4b0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  3....query III r
2b4c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2b4d0 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57  LL * FROM tab1 W
2b4e0 48 45 52 45 20 28 20 2b 20 63 6f 6c 32 20 2b 20  HERE ( + col2 + 
2b4f0 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 29 20 3c 3e  col1 + col1 ) <>
2b500 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   col1..----..9 v
2b510 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2b520 20 38 64 36 36 39 32 65 36 64 34 31 35 30 35 63   8d6692e6d41505c
2b530 33 61 64 34 32 64 39 31 39 62 64 39 65 63 64 30  3ad42d919bd9ecd0
2b540 64 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  d....skipif post
2b550 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2b560 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2b570 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2b580 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2b590 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b5a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2b5b0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 63 6f 6c   col0 + col0 col
2b5c0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
2b5d0 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
2b5e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b5f0 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20  ALL tab1.col0 * 
2b600 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f  tab1.col1 + + co
2b610 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
2b620 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d 0a 38  --..1120..704..8
2b630 31 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  1....query III r
2b640 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a  owsort..SELECT *
2b650 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45   FROM tab1 WHERE
2b660 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d   col0 * col1 + -
2b670 20 63 6f 6c 32 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d   col2 = NULL..--
2b680 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
2b690 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2b6a0 6c 32 20 2f 20 74 61 62 30 2e 63 6f 6c 32 20 41  l2 / tab0.col2 A
2b6b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2b6c0 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20   WHERE NOT NULL 
2b6d0 42 45 54 57 45 45 4e 20 28 20 2d 20 63 6f 6c 32  BETWEEN ( - col2
2b6e0 20 2a 20 2d 20 63 6f 6c 32 20 29 20 41 4e 44 20   * - col2 ) AND 
2b6f0 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  NULL..----....qu
2b700 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2b710 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2b720 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63  ol0 * col1 + - c
2b730 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 + col0 AS co
2b740 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45  l1 FROM tab0 WHE
2b750 52 45 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  RE + col1 + col1
2b760 20 2a 20 63 6f 6c 31 20 49 4e 20 28 20 2d 20 74   * col1 IN ( - t
2b770 61 62 30 2e 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  ab0.col2 )..----
2b780 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2b790 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2b7a0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2b7b0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2b7c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2b7d0 31 32 33 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1236..SELECT DIS
2b7e0 54 49 4e 43 54 20 74 61 62 30 2e 63 6f 6c 32 20  TINCT tab0.col2 
2b7f0 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  DIV + col1 + col
2b800 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
2b810 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
2b820 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2b830 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2b840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b850 6c 61 62 65 6c 2d 31 32 33 36 0d 0a 53 45 4c 45  label-1236..SELE
2b860 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30  CT DISTINCT tab0
2b870 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 20 2b  .col2 / + col1 +
2b880 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2b890 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38  .----..24..35..8
2b8a0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2b8b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2b8c0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a   + col0 * col2 *
2b8d0 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30   + col0 + - col0
2b8e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2b8f0 0d 0a 32 33 33 34 30 38 0d 0a 34 38 33 0d 0a 36  ..233408..483..6
2b900 31 34 33 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  14320....query I
2b910 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b920 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 2a   col1 - + col1 *
2b930 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 46   col2 * + col2 F
2b940 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2b950 2d 36 31 31 37 39 33 0d 0a 2d 39 33 35 36 38 0d  -611793..-93568.
2b960 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .0....skipif pos
2b970 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2b980 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2b990 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2b9a0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2b9b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b9c0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
2b9d0 74 61 62 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46  tab0.col1 col0 F
2b9e0 52 4f 4d 20 74 61 62 30 20 57 48 45 52 45 20 4e  ROM tab0 WHERE N
2b9f0 55 4c 4c 20 42 45 54 57 45 45 4e 20 2d 20 63 6f  ULL BETWEEN - co
2ba00 6c 31 20 2b 20 63 6f 6c 31 20 41 4e 44 20 4e 55  l1 + col1 AND NU
2ba10 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79  LL..----....only
2ba20 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2ba30 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2ba40 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2ba50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ba60 74 20 6c 61 62 65 6c 2d 31 32 34 30 0d 0a 53 45  t label-1240..SE
2ba70 4c 45 43 54 20 63 6f 6c 30 20 44 49 56 20 2d 20  LECT col0 DIV - 
2ba80 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col0 - - col2 AS
2ba90 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2baa0 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39  .----..53..56..9
2bab0 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
2bac0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2bad0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2bae0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34 30 0d 0a  ort label-1240..
2baf0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 2d 20  SELECT col0 / - 
2bb00 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53  col0 - - col2 AS
2bb10 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2bb20 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39  .----..53..56..9
2bb30 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
2bb40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2bb50 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 * col2 FROM ta
2bb60 62 32 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c  b2 WHERE NOT col
2bb70 31 20 2a 20 2d 20 63 6f 6c 32 20 4e 4f 54 20 42  1 * - col2 NOT B
2bb80 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20  ETWEEN NULL AND 
2bb90 28 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d  ( - col2 )..----
2bba0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2bbb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2bbc0 2d 20 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d  - tab2.col2 FROM
2bbd0 20 74 61 62 32 20 57 48 45 52 45 20 2d 20 63 6f   tab2 WHERE - co
2bbe0 6c 32 20 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d  l2 > NULL..----.
2bbf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2bc00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2bc10 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  NCT col0 + + col
2bc20 31 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  1 * col0 * col0 
2bc30 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2bc40 0a 31 31 38 38 36 30 0d 0a 34 39 35 36 30 0d 0a  .118860..49560..
2bc50 37 32 30 39 30 30 0d 0a 0d 0a 71 75 65 72 79 20  720900....query 
2bc60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bc70 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  T - - col0 * col
2bc80 31 20 2b 20 37 36 20 41 53 20 63 6f 6c 32 20 46  1 + 76 AS col2 F
2bc90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2bca0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 36 0d 0a 31 35  ..----..1116..15
2bcb0 34 0d 0a 37 31 36 0d 0a 0d 0a 71 75 65 72 79 20  4..716....query 
2bcc0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bcd0 54 20 41 4c 4c 20 2d 20 2b 20 28 20 63 6f 72 30  T ALL - + ( cor0
2bce0 2e 63 6f 6c 31 20 29 20 2d 20 2d 20 63 6f 6c 30  .col1 ) - - col0
2bcf0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2bd00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31  r0..----..-24..1
2bd10 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9..62....query I
2bd20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bd30 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 31 20 29 20   ALL + ( col1 ) 
2bd40 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  + ( col1 ) FROM 
2bd50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2bd60 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a 31 39  --..172..182..19
2bd70 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  4....skipif post
2bd80 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2bd90 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2bda0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2bdb0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2bdc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2bdd0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30  ELECT ALL + tab0
2bde0 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 63  .col2 * - col0 c
2bdf0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
2be00 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
2be10 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
2be20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2be30 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d   + tab1.col1 + -
2be40 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
2be50 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
2be60 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71  54..-67..23....q
2be70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2be80 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20  SELECT - - col1 
2be90 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  + col1 * + col1 
2bea0 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
2beb0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2bec0 2d 2d 2d 0d 0a 31 30 39 39 39 0d 0a 32 35 39 37  ---..10999..2597
2bed0 38 0d 0a 39 30 35 36 35 0d 0a 0d 0a 71 75 65 72  8..90565....quer
2bee0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2bef0 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b  ECT - + col2 * +
2bf00 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 30 20 2b   col1 + ( col0 +
2bf10 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
2bf20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2bf30 0a 2d 31 30 37 32 0d 0a 2d 31 33 34 37 0d 0a 2d  .-1072..-1347..-
2bf40 34 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  449....query I r
2bf50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2bf60 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63   col1 * - cor0.c
2bf70 6f 6c 31 20 2b 20 2b 20 28 20 28 20 2b 20 63 6f  ol1 + + ( ( + co
2bf80 6c 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32  l2 ) ) FROM tab2
2bf90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2bfa0 2d 32 35 31 0d 0a 2d 33 34 35 35 0d 0a 2d 39 33  -251..-3455..-93
2bfb0 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
2bfc0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2bfd0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2bfe0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2bff0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2c000 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2c010 35 32 0d 0a 53 45 4c 45 43 54 20 35 20 2b 20 2d  52..SELECT 5 + -
2c020 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28 20   col2 * + CAST( 
2c030 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
2c040 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c050 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2c060 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
2c070 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2c080 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2c090 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2c0a0 65 6c 2d 31 32 35 32 0d 0a 53 45 4c 45 43 54 20  el-1252..SELECT 
2c0b0 35 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43  5 + - col2 * + C
2c0c0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
2c0d0 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
2c0e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2c0f0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
2c100 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
2c110 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
2c120 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
2c130 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
2c140 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
2c150 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2c160 35 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  53..SELECT - - c
2c170 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 43  ol1 * - col1 + C
2c180 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
2c190 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 63 6f 6c  NED ) * col1 col
2c1a0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2c1b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2c1c0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
2c1d0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2c1e0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2c1f0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2c200 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2c210 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
2c220 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2c230 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2c240 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35  owsort label-125
2c250 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  3..SELECT - - co
2c260 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 43 41  l1 * - col1 + CA
2c270 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
2c280 45 47 45 52 20 29 20 2a 20 63 6f 6c 31 20 63 6f  EGER ) * col1 co
2c290 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2c2a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2c2b0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2c2c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2c2d0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
2c2e0 20 2b 20 32 31 20 46 52 4f 4d 20 74 61 62 32 20   + 21 FROM tab2 
2c2f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
2c300 37 0d 0a 34 38 0d 0a 35 39 0d 0a 0d 0a 6f 6e 6c  7..48..59....onl
2c310 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2c320 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2c330 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2c340 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2c350 72 74 20 6c 61 62 65 6c 2d 31 32 35 35 0d 0a 53  rt label-1255..S
2c360 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2c370 20 28 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   ( + col0 + col2
2c380 20 29 20 44 49 56 20 34 39 20 46 52 4f 4d 20 74   ) DIV 49 FROM t
2c390 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  ab0..----..0..1.
2c3a0 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .3....skipif mys
2c3b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2c3c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2c3d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 35 0d  sort label-1255.
2c3e0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2c3f0 20 2b 20 28 20 2b 20 63 6f 6c 30 20 2b 20 63 6f   + ( + col0 + co
2c400 6c 32 20 29 20 2f 20 34 39 20 46 52 4f 4d 20 74  l2 ) / 49 FROM t
2c410 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  ab0..----..0..1.
2c420 0a 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .3....query I ro
2c430 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2c440 2b 20 63 6f 6c 30 20 2a 20 36 37 20 2b 20 63 6f  + col0 * 67 + co
2c450 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
2c460 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2c470 2d 2d 0d 0a 2d 31 34 37 0d 0a 2d 34 32 33 31 0d  --..-147..-4231.
2c480 0a 2d 35 32 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5264....onlyif
2c490 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2c4a0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2c4b0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2c4c0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2c4d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2c4e0 65 6c 2d 31 32 35 37 0d 0a 53 45 4c 45 43 54 20  el-1257..SELECT 
2c4f0 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28  DISTINCT - CAST(
2c500 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
2c510 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
2c520 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2c530 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
2c540 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2c550 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2c560 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c570 31 32 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  1257..SELECT DIS
2c580 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28 20 4e  TINCT - CAST ( N
2c590 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20  ULL AS REAL ) * 
2c5a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2c5b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
2c5c0 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  LL....onlyif mys
2c5d0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2c5e0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2c5f0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2c600 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2c610 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c620 32 35 38 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  258..SELECT CAST
2c630 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  ( col2 AS SIGNED
2c640 20 29 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 63 6f   ) * col2 - + co
2c650 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
2c660 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2c670 2d 2d 0d 0a 2d 39 36 0d 0a 31 30 30 33 0d 0a 36  --..-96..1003..6
2c680 36 33 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  633....skipif my
2c690 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2c6a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2c6b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 38  wsort label-1258
2c6c0 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20  ..SELECT CAST ( 
2c6d0 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20  col2 AS INTEGER 
2c6e0 29 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  ) * col2 - + col
2c6f0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2c700 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2c710 2d 0d 0a 2d 39 36 0d 0a 31 30 30 33 0d 0a 36 36  -..-96..1003..66
2c720 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  33....query I ro
2c730 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2c740 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20  STINCT - - col1 
2c750 2a 20 38 30 20 46 52 4f 4d 20 74 61 62 32 20 41  * 80 FROM tab2 A
2c760 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
2c770 36 30 0d 0a 32 34 38 30 0d 0a 34 37 32 30 0d 0a  60..2480..4720..
2c780 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c790 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  t..SELECT - + co
2c7a0 6c 32 20 2a 20 2b 20 32 33 20 2b 20 63 6f 6c 30  l2 * + 23 + col0
2c7b0 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 32 20 2a 20   * - ( - col2 * 
2c7c0 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 30 20  col1 ) + + col0 
2c7d0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2c7e0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37 33 0d 0a 33  0..----..2973..3
2c7f0 35 32 33 33 0d 0a 39 37 37 31 32 0d 0a 0d 0a 71  5233..97712....q
2c800 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c810 53 45 4c 45 43 54 20 2b 20 63 6f 72 31 2e 63 6f  SELECT + cor1.co
2c820 6c 32 20 2a 20 2b 20 37 36 20 2d 20 2b 20 31 32  l2 * + 76 - + 12
2c830 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
2c840 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
2c850 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
2c860 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2c870 74 6f 20 36 31 32 33 38 62 64 32 66 37 61 64 39  to 61238bd2f7ad9
2c880 30 61 64 30 61 31 37 38 35 39 32 36 65 65 64 37  0ad0a1785926eed7
2c890 39 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  984....query I r
2c8a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2c8b0 20 28 20 36 34 20 29 20 2b 20 2b 20 63 6f 6c 30   ( 64 ) + + col0
2c8c0 20 2a 20 2d 20 35 39 20 46 52 4f 4d 20 74 61 62   * - 59 FROM tab
2c8d0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2c8e0 0a 2d 34 36 36 36 0d 0a 2d 34 37 32 35 0d 0a 2d  .-4666..-4725..-
2c8f0 34 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  477....query I r
2c900 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2c910 20 34 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   44 AS col1 FROM
2c920 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2c930 0d 0a 2d 34 34 0d 0a 2d 34 34 0d 0a 2d 34 34 0d  ..-44..-44..-44.
2c940 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c950 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2c960 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 74  ol1 + col2 + - t
2c970 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab0.col0 FROM ta
2c980 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 38 34  b0..----..63..84
2c990 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..95....skipif m
2c9a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2c9b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2c9c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2c9d0 20 2b 20 36 38 20 2a 20 2d 20 63 6f 6c 32 20 2b   + 68 * - col2 +
2c9e0 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20   CAST ( col1 AS 
2c9f0 52 45 41 4c 20 29 20 2a 20 2b 20 63 6f 6c 31 20  REAL ) * + col1 
2ca00 2b 20 37 39 20 46 52 4f 4d 20 74 61 62 31 20 63  + 79 FROM tab1 c
2ca10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31 37  or0..----..-2917
2ca20 0d 0a 2d 33 36 39 37 0d 0a 2d 36 32 38 30 0d 0a  ..-3697..-6280..
2ca30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ca40 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
2ca50 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f   * + col2 - - co
2ca60 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2ca70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38  cor0..----..-108
2ca80 0d 0a 2d 33 35 39 31 0d 0a 2d 37 35 38 34 0d 0a  ..-3591..-7584..
2ca90 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2caa0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2cab0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2cac0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2cad0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2cae0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 37 0d  sort label-1267.
2caf0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
2cb00 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20   col1 + - CAST( 
2cb10 2b 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  + col1 AS SIGNED
2cb20 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) + col2 FROM t
2cb30 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2cb40 2d 0d 0a 31 0d 0a 32 37 38 35 0d 0a 37 34 35 33  -..1..2785..7453
2cb50 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2cb60 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2cb70 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2cb80 72 74 20 6c 61 62 65 6c 2d 31 32 36 37 0d 0a 53  rt label-1267..S
2cb90 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
2cba0 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20 2b  ol1 + - CAST ( +
2cbb0 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
2cbc0 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) + col2 FROM t
2cbd0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2cbe0 2d 0d 0a 31 0d 0a 32 37 38 35 0d 0a 37 34 35 33  -..1..2785..7453
2cbf0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cc00 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 31 20 2a  ort..SELECT 21 *
2cc10 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f   + tab2.col2 FRO
2cc20 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 34  M tab2..----..54
2cc30 36 0d 0a 35 36 37 0d 0a 37 39 38 0d 0a 0d 0a 71  6..567..798....q
2cc40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2cc50 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 30 20  SELECT ( + col0 
2cc60 2a 20 74 61 62 31 2e 63 6f 6c 31 20 29 20 41 53  * tab1.col1 ) AS
2cc70 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2cc80 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30  .----..1040..640
2cc90 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
2cca0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ccb0 2b 20 28 20 37 31 20 29 20 41 53 20 63 6f 6c 31  + ( 71 ) AS col1
2ccc0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2ccd0 0d 0a 37 31 0d 0a 37 31 0d 0a 37 31 0d 0a 0d 0a  ..71..71..71....
2cce0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ccf0 0a 53 45 4c 45 43 54 20 2b 20 32 30 20 2b 20 74  .SELECT + 20 + t
2cd00 61 62 31 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  ab1.col1 + col0 
2cd10 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  * col2 FROM tab1
2cd20 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 0d 0a 33 36 37  ..----..208..367
2cd30 38 0d 0a 37 37 31 33 0d 0a 0d 0a 71 75 65 72 79  8..7713....query
2cd40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cd50 43 54 20 2d 20 35 38 20 2a 20 63 6f 6c 31 20 2d  CT - 58 * col1 -
2cd60 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   - col1 AS col2 
2cd70 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
2cd80 2d 2d 2d 2d 0d 0a 2d 31 37 36 37 0d 0a 2d 33 33  ----..-1767..-33
2cd90 36 33 0d 0a 2d 39 36 39 0d 0a 0d 0a 73 6b 69 70  63..-969....skip
2cda0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2cdb0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2cdc0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2cdd0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2cde0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2cdf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2ce00 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32   - col0 - + col2
2ce10 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46   * - col2 col0 F
2ce20 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2ce30 2d 33 34 0d 0a 31 30 36 35 0d 0a 36 36 33 35 0d  -34..1065..6635.
2ce40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ce50 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
2ce60 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b  ol0 * + col2 + +
2ce70 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46   col1 * + col0 F
2ce80 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
2ce90 34 30 36 0d 0a 34 33 34 35 0d 0a 36 36 33 30 0d  406..4345..6630.
2cea0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ceb0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2cec0 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63   col0 * col2 + c
2ced0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
2cee0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36   tab1..----..216
2cef0 0d 0a 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a  ..3705..7776....
2cf00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2cf10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2cf20 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f   - - col2 * + co
2cf30 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30  r0.col2 * - cor0
2cf40 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
2cf50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2cf60 31 31 34 30 37 36 0d 0a 2d 35 31 30 33 0d 0a 2d  114076..-5103..-
2cf70 35 32 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  52728....query I
2cf80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2cf90 20 63 6f 6c 30 20 2b 20 2d 20 37 33 20 46 52 4f   col0 + - 73 FRO
2cfa0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab1..----..-7
2cfb0 30 0d 0a 2d 39 0d 0a 37 0d 0a 0d 0a 73 6b 69 70  0..-9..7....skip
2cfc0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2cfd0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2cfe0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2cff0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2d000 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2d010 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31  sort..SELECT + 1
2d020 38 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  8 col2 FROM tab1
2d030 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 31 38 0d 0a  ..----..18..18..
2d040 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  18....onlyif mys
2d050 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2d060 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2d070 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2d080 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d090 6c 2d 31 32 37 39 0d 0a 53 45 4c 45 43 54 20 34  l-1279..SELECT 4
2d0a0 30 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d 20 2b  0 DIV + col0 - +
2d0b0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
2d0c0 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 37 0d  .----..-41..-57.
2d0d0 0a 2d 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-96....skipif m
2d0e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2d0f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2d100 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37  owsort label-127
2d110 39 0d 0a 53 45 4c 45 43 54 20 34 30 20 2f 20 2b  9..SELECT 40 / +
2d120 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 46   col0 - + col2 F
2d130 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2d140 2d 34 31 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d  -41..-57..-96...
2d150 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d160 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 39 20 2a  ..SELECT ALL 9 *
2d170 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
2d180 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a 32 33 34 0d  .----..117..234.
2d190 0a 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .90....query I r
2d1a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2d1b0 6f 6c 31 20 2b 20 2b 20 33 38 20 46 52 4f 4d 20  ol1 + + 38 FROM 
2d1c0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
2d1d0 0a 35 35 0d 0a 36 39 0d 0a 39 37 0d 0a 0d 0a 71  .55..69..97....q
2d1e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d1f0 53 45 4c 45 43 54 20 2d 20 2b 20 32 38 20 2a 20  SELECT - + 28 * 
2d200 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
2d210 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d220 31 36 35 32 0d 0a 34 37 36 0d 0a 38 36 38 0d 0a  1652..476..868..
2d230 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d240 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33 31  t..SELECT + - 31
2d250 20 2a 20 35 34 20 41 53 20 63 6f 6c 31 20 46 52   * 54 AS col1 FR
2d260 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d270 0a 2d 2d 2d 2d 0d 0a 2d 31 36 37 34 0d 0a 2d 31  .----..-1674..-1
2d280 36 37 34 0d 0a 2d 31 36 37 34 0d 0a 0d 0a 71 75  674..-1674....qu
2d290 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d2a0 45 4c 45 43 54 20 41 4c 4c 20 34 36 20 41 53 20  ELECT ALL 46 AS 
2d2b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
2d2c0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2d2d0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2d2e0 68 69 6e 67 20 74 6f 20 33 31 38 31 38 63 39 64  hing to 31818c9d
2d2f0 34 64 33 32 35 65 62 32 34 38 37 33 35 63 39 37  4d325eb248735c97
2d300 63 62 31 64 63 65 33 39 0d 0a 0d 0a 71 75 65 72  cb1dce39....quer
2d310 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d320 45 43 54 20 2b 20 31 36 20 41 53 20 63 6f 6c 31  ECT + 16 AS col1
2d330 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
2d340 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2d350 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2d360 20 33 66 64 62 30 38 65 63 32 65 33 64 34 62 36   3fdb08ec2e3d4b6
2d370 34 32 64 64 34 35 39 34 37 37 38 63 63 61 38 62  42dd4594778cca8b
2d380 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  3....skipif post
2d390 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2d3a0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2d3b0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2d3c0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2d3d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d3e0 45 4c 45 43 54 20 63 6f 72 31 2e 63 6f 6c 31 20  ELECT cor1.col1 
2d3f0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
2d400 74 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61  tab1 AS cor0, ta
2d410 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  b0 cor1..----..2
2d420 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
2d430 20 74 6f 20 32 64 36 64 33 30 33 31 64 66 65 39   to 2d6d3031dfe9
2d440 30 65 30 63 30 32 64 62 31 33 61 61 36 33 39 39  0e0c02db13aa6399
2d450 33 62 66 64 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  3bfd....skipif p
2d460 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2d470 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2d480 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2d490 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2d4a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d4b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2d4c0 54 20 39 37 20 2a 20 2b 20 63 6f 6c 32 20 63 6f  T 97 * + col2 co
2d4d0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2d4e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 33 38  cor0..----..5238
2d4f0 0d 0a 35 35 32 39 0d 0a 39 33 31 32 0d 0a 0d 0a  ..5529..9312....
2d500 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d510 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
2d520 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52 4f   col0 + col0 FRO
2d530 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2d540 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30 0d 0a 38  -..2088..3430..8
2d550 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  188....query I r
2d560 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2d570 20 34 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   49 AS col2 FROM
2d580 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2d590 2d 2d 2d 0d 0a 2d 34 39 0d 0a 2d 34 39 0d 0a 2d  ---..-49..-49..-
2d5a0 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  49....query I ro
2d5b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
2d5c0 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 46 52  col0 ) * col1 FR
2d5d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d5e0 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30  .----..1040..640
2d5f0 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..78....query I 
2d600 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d610 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  + + col1 * col2 
2d620 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
2d630 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2d640 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a 36 30  ..----..1508..60
2d650 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20  8..810....query 
2d660 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d670 54 20 41 4c 4c 20 35 31 20 41 53 20 63 6f 6c 30  T ALL 51 AS col0
2d680 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2d690 0d 0a 35 31 0d 0a 35 31 0d 0a 35 31 0d 0a 0d 0a  ..51..51..51....
2d6a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d6b0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
2d6c0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a   + col0 * col0 *
2d6d0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
2d6e0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2d6f0 0a 2d 2d 2d 2d 0d 0a 33 31 32 0d 0a 34 37 34 34  .----..312..4744
2d700 39 33 0d 0a 34 39 33 30 32 32 0d 0a 0d 0a 6f 6e  93..493022....on
2d710 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2d720 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2d730 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2d740 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2d750 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 34 0d 0a  ort label-1294..
2d760 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
2d770 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 31   col2 ) * - col1
2d780 20 44 49 56 20 2d 20 63 6f 6c 31 20 41 53 20 63   DIV - col1 AS c
2d790 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
2d7a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37  r0..----..26..27
2d7b0 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..38....skipif m
2d7c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2d7d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2d7e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39  owsort label-129
2d7f0 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  4..SELECT ALL + 
2d800 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63  ( + col2 ) * - c
2d810 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 / - col1 AS 
2d820 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
2d830 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32  or0..----..26..2
2d840 37 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..38....onlyif 
2d850 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2d860 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2d870 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2d880 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2d890 61 62 65 6c 2d 31 32 39 35 0d 0a 53 45 4c 45 43  abel-1295..SELEC
2d8a0 54 20 28 20 2d 20 39 39 20 29 20 44 49 56 20 2d  T ( - 99 ) DIV -
2d8b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2d8c0 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 34 0d 0a  .----..1..2..4..
2d8d0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2d8e0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2d8f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2d900 20 6c 61 62 65 6c 2d 31 32 39 35 0d 0a 53 45 4c   label-1295..SEL
2d910 45 43 54 20 28 20 2d 20 39 39 20 29 20 2f 20 2d  ECT ( - 99 ) / -
2d920 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2d930 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 34 0d 0a  .----..1..2..4..
2d940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d950 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
2d960 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63   + col2 * cor0.c
2d970 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
2d980 72 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 3c 20  r0 WHERE NULL < 
2d990 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75  NULL..----....qu
2d9a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d9b0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
2d9c0 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  2 * + cor0.col0 
2d9d0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2d9e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2d9f0 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
2da00 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  002....query III
2da10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2da20 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
2da30 20 74 61 62 31 20 57 48 45 52 45 20 2d 20 63 6f   tab1 WHERE - co
2da40 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  l2 + - col1 * co
2da50 6c 30 20 4e 4f 54 20 42 45 54 57 45 45 4e 20 28  l0 NOT BETWEEN (
2da60 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 29   - col1 - col1 )
2da70 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d   AND NULL..----.
2da80 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
2da90 67 20 74 6f 20 38 64 36 36 39 32 65 36 64 34 31  g to 8d6692e6d41
2daa0 35 30 35 63 33 61 64 34 32 64 39 31 39 62 64 39  505c3ad42d919bd9
2dab0 65 63 64 30 64 0d 0a 0d 0a 71 75 65 72 79 20 49  ecd0d....query I
2dac0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2dad0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a   col0 * + col1 *
2dae0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2daf0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2db00 31 39 36 35 32 0d 0a 35 31 30 33 34 0d 0a 35 38  19652..51034..58
2db10 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  59....query I ro
2db20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2db30 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f  STINCT col0 + co
2db40 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32  r0.col2 * - col2
2db50 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   - + col2 AS col
2db60 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2db70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 38  or0..----..-1098
2db80 0d 0a 2d 36 37 31 37 0d 0a 33 33 0d 0a 0d 0a 71  ..-6717..33....q
2db90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2dba0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
2dbb0 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20  0.col2 + col0 + 
2dbc0 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  + col2 * - col1 
2dbd0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2dbe0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2dbf0 0a 2d 31 30 37 32 0d 0a 2d 31 33 34 37 0d 0a 2d  .-1072..-1347..-
2dc00 34 34 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  449....skipif po
2dc10 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2dc20 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2dc30 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2dc40 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2dc50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2dc60 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
2dc70 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f   + col2 col2 FRO
2dc80 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2dc90 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 0d 0a 36 36  ----..164..2..66
2dca0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2dcb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2dcc0 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 31  INCT + tab1.col1
2dcd0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30   + + col2 * col0
2dce0 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + - col1 FROM t
2dcf0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a  ab1..----..162..
2dd00 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 6f 6e  3648..7680....on
2dd10 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
2dd20 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
2dd30 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
2dd40 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
2dd50 6f 72 74 20 6c 61 62 65 6c 2d 31 33 30 34 0d 0a  ort label-1304..
2dd60 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
2dd70 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 74  2 * - col2 + - t
2dd80 61 62 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20 63  ab0.col0 DIV + c
2dd90 6f 6c 32 20 2b 20 2d 20 74 61 62 30 2e 63 6f 6c  ol2 + - tab0.col
2dda0 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
2ddb0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 0d 0a  b0..----..-133..
2ddc0 2d 31 34 31 38 37 0d 0a 2d 33 39 32 37 0d 0a 0d  -14187..-3927...
2ddd0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2dde0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2ddf0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2de00 6c 61 62 65 6c 2d 31 33 30 34 0d 0a 53 45 4c 45  label-1304..SELE
2de10 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20  CT ALL + col2 * 
2de20 2d 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62 30 2e  - col2 + - tab0.
2de30 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 2b 20  col0 / + col2 + 
2de40 2d 20 74 61 62 30 2e 63 6f 6c 31 20 2a 20 63 6f  - tab0.col1 * co
2de50 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
2de60 2d 2d 0d 0a 2d 31 33 33 0d 0a 2d 31 34 31 38 37  --..-133..-14187
2de70 0d 0a 2d 33 39 32 37 0d 0a 0d 0a 73 6b 69 70 69  ..-3927....skipi
2de80 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2de90 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2dea0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2deb0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2dec0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2ded0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2dee0 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  l1 * - col1 + - 
2def0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
2df00 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 31 30 0d  ab0..----..7310.
2df10 0a 38 31 39 30 0d 0a 39 33 31 32 0d 0a 0d 0a 71  .8190..9312....q
2df20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2df30 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
2df40 2b 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  + + col2 + col1 
2df50 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2df60 0a 31 33 33 0d 0a 31 34 33 0d 0a 32 36 32 0d 0a  .133..143..262..
2df70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2df80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2df90 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2d 20 2d 20  col1 + col2 - - 
2dfa0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
2dfb0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab2..----..-7
2dfc0 0d 0a 32 33 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72  ..23..59....quer
2dfd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dfe0 45 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20  ECT + tab1.col0 
2dff0 2a 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62 31 2e  * col2 + - tab1.
2e000 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63  col1 + col0 AS c
2e010 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
2e020 2d 2d 2d 0d 0a 31 33 39 0d 0a 33 37 30 32 0d 0a  ---..139..3702..
2e030 37 37 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7747....query I 
2e040 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e050 41 4c 4c 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20  ALL - tab2.col0 
2e060 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  + col2 + - col0 
2e070 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
2e080 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 36 31  ..----..-29..-61
2e090 33 36 0d 0a 2d 36 32 38 32 0d 0a 0d 0a 71 75 65  36..-6282....que
2e0a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e0b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2e0c0 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2b 20  col0 + col2 + + 
2e0d0 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col0 * col0 FROM
2e0e0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30 38   tab1..----..408
2e0f0 39 0d 0a 36 30 0d 0a 36 34 31 36 0d 0a 0d 0a 6f  9..60..6416....o
2e100 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2e110 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2e120 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2e130 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2e140 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31 31 0d  sort label-1311.
2e150 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56  .SELECT col1 DIV
2e160 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41   col2 + - col0 A
2e170 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2e180 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 38 38  ..----..-22..-88
2e190 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..62....skipif m
2e1a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e1b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e1c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31  owsort label-131
2e1d0 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f  1..SELECT col1 /
2e1e0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41   col2 + - col0 A
2e1f0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
2e200 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 0d 0a 2d 38 38  ..----..-22..-88
2e210 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..62....query I 
2e220 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e230 2d 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f  - col1 * tab0.co
2e240 6c 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 * col0 AS col
2e250 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
2e260 2d 0d 0a 2d 31 31 38 38 32 35 0d 0a 2d 34 39 35  -..-118825..-495
2e270 33 36 0d 0a 2d 37 32 30 38 31 31 0d 0a 0d 0a 71  36..-720811....q
2e280 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e290 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e2a0 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f 6c 32  col2 * tab2.col2
2e2b0 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 2d 20 63   + tab2.col2 - c
2e2c0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
2e2d0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30   tab2..----..140
2e2e0 33 0d 0a 36 32 34 0d 0a 37 34 39 0d 0a 0d 0a 71  3..624..749....q
2e2f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e300 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e310 63 6f 6c 32 20 2b 20 2d 20 74 61 62 30 2e 63 6f  col2 + - tab0.co
2e320 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 + col1 FROM t
2e330 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 38  ab0..----..63..8
2e340 34 0d 0a 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..95....onlyif 
2e350 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2e360 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2e370 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2e380 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e390 61 62 65 6c 2d 31 33 31 35 0d 0a 53 45 4c 45 43  abel-1315..SELEC
2e3a0 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63  T ALL - col2 * c
2e3b0 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 32 20 46  ol0 DIV + col2 F
2e3c0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2e3d0 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
2e3e0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2e3f0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2e400 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e410 61 62 65 6c 2d 31 33 31 35 0d 0a 53 45 4c 45 43  abel-1315..SELEC
2e420 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63  T ALL - col2 * c
2e430 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 / + col2 FRO
2e440 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
2e450 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75  ..-64..-80....qu
2e460 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2e470 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2e480 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d   + cor0.col0 * -
2e490 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b   col0 * + col2 +
2e4a0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63   - cor0.col2 + c
2e4b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2e4c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
2e4d0 32 39 0d 0a 2d 31 38 39 35 35 0d 0a 2d 36 34 39  29..-18955..-649
2e4e0 35 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  513....query I r
2e4f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2e500 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30  ISTINCT - - col0
2e510 20 2a 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 72 30   * col1 - - cor0
2e520 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
2e530 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2e540 0a 2d 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38  .----..1360..248
2e550 0d 0a 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20  ..4661....query 
2e560 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e570 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
2e580 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  * col2 + col2 * 
2e590 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f  + cor0.col2 + co
2e5a0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2e5b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2e5c0 2d 2d 0d 0a 31 34 31 31 31 0d 0a 31 39 30 35 0d  --..14111..1905.
2e5d0 0a 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49  .71....query III
2e5e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e5f0 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   * FROM tab0 AS 
2e600 63 6f 72 30 20 57 48 45 52 45 20 4e 55 4c 4c 20  cor0 WHERE NULL 
2e610 3c 3d 20 63 6f 6c 31 20 4f 52 20 4e 55 4c 4c 20  <= col1 OR NULL 
2e620 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 31 20  NOT IN ( + col1 
2e630 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69  )..----....onlyi
2e640 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2e650 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2e660 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2e670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e680 20 6c 61 62 65 6c 2d 31 33 32 30 0d 0a 53 45 4c   label-1320..SEL
2e690 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31  ECT ALL + - col1
2e6a0 20 44 49 56 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   DIV col2 + + co
2e6b0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2e6c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36  cor0..----..3..6
2e6d0 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..80....skipif 
2e6e0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2e6f0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2e700 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2e710 32 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  20..SELECT ALL +
2e720 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 2b   - col1 / col2 +
2e730 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
2e740 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2e750 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b  .3..64..80....sk
2e760 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2e770 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2e780 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2e790 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2e7a0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2e7b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2e7c0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b  ISTINCT col1 * +
2e7d0 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 63 6f 6c   col0 + col0 col
2e7e0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2e7f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38 0d  or0..----..2088.
2e800 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a 73  .3430..8188....s
2e810 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2e820 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2e830 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2e840 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2e850 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2e860 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e870 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
2e880 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  + col1 col2 FROM
2e890 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2e8a0 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30  ..2064..3395..80
2e8b0 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  99....query I ro
2e8c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2e8d0 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  L - + col2 * + c
2e8e0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2e8f0 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
2e900 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d  ..-1444..-676..-
2e910 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  729....query I r
2e920 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2e930 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  LL - col2 + col0
2e940 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   * - col0 + + co
2e950 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
2e960 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2e970 2d 2d 0d 0a 2d 33 37 0d 0a 2d 34 31 34 33 0d 0a  --..-37..-4143..
2e980 2d 36 34 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  -6483....skipif 
2e990 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2e9a0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2e9b0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2e9c0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2e9d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e9e0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2e9f0 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  CT - col0 + + co
2ea00 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 30  l2 * - col2 col0
2ea10 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
2ea20 0d 0a 2d 32 39 31 39 0d 0a 2d 33 33 31 33 0d 0a  ..-2919..-3313..
2ea30 2d 39 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -9296....query I
2ea40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ea50 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   ALL col1 * col0
2ea60 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
2ea70 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32  2..----..1422..2
2ea80 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a 6f 6e 6c 79  24..4680....only
2ea90 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2eaa0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2eab0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2eac0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ead0 74 20 6c 61 62 65 6c 2d 31 33 32 37 0d 0a 53 45  t label-1327..SE
2eae0 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2a  LECT tab0.col2 *
2eaf0 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 2b   col0 DIV col2 +
2eb00 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f   col2 * col2 FRO
2eb10 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
2eb20 31 33 0d 0a 33 36 0d 0a 36 38 31 33 0d 0a 0d 0a  13..36..6813....
2eb30 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2eb40 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2eb50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2eb60 61 62 65 6c 2d 31 33 32 37 0d 0a 53 45 4c 45 43  abel-1327..SELEC
2eb70 54 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63 6f  T tab0.col2 * co
2eb80 6c 30 20 2f 20 63 6f 6c 32 20 2b 20 63 6f 6c 32  l0 / col2 + col2
2eb90 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
2eba0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 33 0d 0a 33  0..----..1113..3
2ebb0 36 0d 0a 36 38 31 33 0d 0a 0d 0a 71 75 65 72 79  6..6813....query
2ebc0 20 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f   IIIIIIIII rowso
2ebd0 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f  rt..SELECT * FRO
2ebe0 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72  M tab0, tab0 cor
2ebf0 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
2ec00 31 20 57 48 45 52 45 20 4e 55 4c 4c 20 4e 4f 54  1 WHERE NULL NOT
2ec10 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c 20   BETWEEN ( NULL 
2ec20 29 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  ) AND NULL..----
2ec30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2ec40 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2ec50 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2ec60 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2ec70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2ec80 31 33 32 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1329..SELECT col
2ec90 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2b  2 DIV - col0 + +
2eca0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
2ecb0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38  OM tab0..----..8
2ecc0 35 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69  5..91..97....ski
2ecd0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ece0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2ecf0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2ed00 6c 2d 31 33 32 39 0d 0a 53 45 4c 45 43 54 20 63  l-1329..SELECT c
2ed10 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 2b  ol2 / - col0 + +
2ed20 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
2ed30 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38  OM tab0..----..8
2ed40 35 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65  5..91..97....que
2ed50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ed60 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2ed70 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2d 20  col2 * - col2 - 
2ed80 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32  cor0.col0 * col2
2ed90 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2eda0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2edb0 0d 0a 2d 31 33 35 32 0d 0a 2d 31 35 35 38 0d 0a  ..-1352..-1558..
2edc0 35 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  540....query I r
2edd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2ede0 4c 4c 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 32  LL - col0 / col2
2edf0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2ee00 62 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 42 45  b0 WHERE NULL BE
2ee10 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e  TWEEN NULL AND N
2ee20 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
2ee30 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ee40 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72  LECT ALL - - cor
2ee50 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f  0.col1 * cor0.co
2ee60 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
2ee70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
2ee80 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65  .169..676....que
2ee90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2eea0 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
2eeb0 20 2b 20 2d 20 32 39 20 41 53 20 63 6f 6c 31 20   + - 29 AS col1 
2eec0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2eed0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 36 0d 0a  0..----..-5..6..
2eee0 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
2eef0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2ef00 4c 20 28 20 2d 20 38 35 20 29 20 41 53 20 63 6f  L ( - 85 ) AS co
2ef10 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
2ef20 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 35 0d 0a 2d 38  0..----..-85..-8
2ef30 35 0d 0a 2d 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  5..-85....onlyif
2ef40 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2ef50 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2ef60 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2ef70 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2ef80 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2ef90 65 6c 2d 31 33 33 35 0d 0a 53 45 4c 45 43 54 20  el-1335..SELECT 
2efa0 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20  CAST( - col1 AS 
2efb0 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20  SIGNED ) * col0 
2efc0 2b 20 2d 20 36 36 20 41 53 20 63 6f 6c 32 20 46  + - 66 AS col2 F
2efd0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2efe0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 39 0d 0a 2d  ..----..-1409..-
2eff0 32 38 33 0d 0a 2d 34 36 36 38 0d 0a 0d 0a 73 6b  283..-4668....sk
2f000 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2f010 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2f020 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f030 65 6c 2d 31 33 33 35 0d 0a 53 45 4c 45 43 54 20  el-1335..SELECT 
2f040 43 41 53 54 20 28 20 2d 20 63 6f 6c 31 20 41 53  CAST ( - col1 AS
2f050 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
2f060 30 20 2b 20 2d 20 36 36 20 41 53 20 63 6f 6c 32  0 + - 66 AS col2
2f070 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2f080 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 39 0d  r0..----..-1409.
2f090 0a 2d 32 38 33 0d 0a 2d 34 36 36 38 0d 0a 0d 0a  .-283..-4668....
2f0a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f0b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2f0c0 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 28 20 63 6f   - - col0 + ( co
2f0d0 6c 31 20 2a 20 63 6f 6c 31 20 29 20 41 53 20 63  l1 * col1 ) AS c
2f0e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2f0f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 34 32   cor0..----..742
2f100 30 0d 0a 38 33 37 30 0d 0a 39 34 34 34 0d 0a 0d  0..8370..9444...
2f110 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2f120 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2f130 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2f140 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2f150 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33  owsort label-133
2f160 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
2f170 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20  - col2 DIV col1 
2f180 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + - col1 AS col1
2f190 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2f1a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d  r0..----..-15..-
2f1b0 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70 69  31..-59....skipi
2f1c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f1d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f1e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f1f0 31 33 33 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1337..SELECT ALL
2f200 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31   - - col2 / col1
2f210 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + - col1 AS col
2f220 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2f230 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a  or0..----..-15..
2f240 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 6f 6e 6c 79  -31..-59....only
2f250 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2f260 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2f270 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2f280 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f290 74 20 6c 61 62 65 6c 2d 31 33 33 38 0d 0a 53 45  t label-1338..SE
2f2a0 4c 45 43 54 20 35 38 20 2b 20 63 6f 6c 30 20 44  LECT 58 + col0 D
2f2b0 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  IV col1 FROM tab
2f2c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2f2d0 0a 35 38 0d 0a 35 39 0d 0a 36 32 0d 0a 0d 0a 73  .58..59..62....s
2f2e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f2f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f310 62 65 6c 2d 31 33 33 38 0d 0a 53 45 4c 45 43 54  bel-1338..SELECT
2f320 20 35 38 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c   58 + col0 / col
2f330 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2f340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 38 0d 0a 35  or0..----..58..5
2f350 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  9..62....query I
2f360 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f370 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
2f380 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  l2 * + col2 + co
2f390 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2f3a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35  cor0..----..-105
2f3b0 36 0d 0a 2d 36 36 34 32 0d 0a 30 0d 0a 0d 0a 6f  6..-6642..0....o
2f3c0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
2f3d0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
2f3e0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
2f3f0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
2f400 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f410 74 20 6c 61 62 65 6c 2d 31 33 34 30 0d 0a 53 45  t label-1340..SE
2f420 4c 45 43 54 20 63 6f 6c 30 20 2b 20 43 41 53 54  LECT col0 + CAST
2f430 28 20 2b 20 63 6f 6c 32 20 41 53 20 53 49 47 4e  ( + col2 AS SIGN
2f440 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ED ) AS col1 FRO
2f450 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab0..----..17
2f460 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69  1..36..57....ski
2f470 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2f480 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2f490 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f4a0 6c 2d 31 33 34 30 0d 0a 53 45 4c 45 43 54 20 63  l-1340..SELECT c
2f4b0 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 2b 20 63  ol0 + CAST ( + c
2f4c0 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
2f4d0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2f4e0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33  b0..----..171..3
2f4f0 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..57....skipif 
2f500 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2f510 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2f520 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2f530 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2f540 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f550 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2f560 74 61 62 31 2e 63 6f 6c 30 20 2a 20 74 61 62 31  tab1.col0 * tab1
2f570 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 63  .col1 + - col2 c
2f580 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
2f590 2d 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d 31 33 32  ---..-1136..-132
2f5a0 0d 0a 2d 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-697....query 
2f5b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f5c0 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20  T cor0.col0 * + 
2f5d0 35 34 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  54 FROM tab1, ta
2f5e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f5f0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2f600 6e 67 20 74 6f 20 30 38 30 38 35 65 35 64 64 37  ng to 08085e5dd7
2f610 37 36 66 64 35 31 66 62 33 66 63 30 63 63 36 37  76fd51fb3fc0cc67
2f620 66 32 33 66 33 39 0d 0a 0d 0a 71 75 65 72 79 20  f23f39....query 
2f630 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f640 54 20 41 4c 4c 20 2b 20 74 61 62 32 2e 63 6f 6c  T ALL + tab2.col
2f650 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  1 + + col0 FROM 
2f660 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d  tab2..----..137.
2f670 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .38..96....query
2f680 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f690 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 32 20  CT - col0 * - 2 
2f6a0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
2f6b0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2f6c0 31 35 33 36 30 0d 0a 33 32 34 0d 0a 37 32 39 36  15360..324..7296
2f6d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f6e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2f6f0 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2b  INCT tab2.col0 +
2f700 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20   + tab2.col0 AS 
2f710 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2f720 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31  ----..14..156..1
2f730 35 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  58....onlyif mys
2f740 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2f750 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2f760 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2f770 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f780 6c 2d 31 33 34 36 0d 0a 53 45 4c 45 43 54 20 41  l-1346..SELECT A
2f790 4c 4c 20 2d 20 63 6f 6c 31 20 44 49 56 20 38 39  LL - col1 DIV 89
2f7a0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30   + col2 * - cor0
2f7b0 2e 63 6f 6c 30 20 2b 20 37 32 20 46 52 4f 4d 20  .col0 + 72 FROM 
2f7c0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2f7d0 2d 2d 0d 0a 2d 31 31 37 0d 0a 2d 31 39 35 36 0d  --..-117..-1956.
2f7e0 0a 2d 32 39 33 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-2930....skipif
2f7f0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2f800 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2f810 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f820 33 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  346..SELECT ALL 
2f830 2d 20 63 6f 6c 31 20 2f 20 38 39 20 2b 20 63 6f  - col1 / 89 + co
2f840 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l2 * - cor0.col0
2f850 20 2b 20 37 32 20 46 52 4f 4d 20 74 61 62 32 20   + 72 FROM tab2 
2f860 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2f870 31 31 37 0d 0a 2d 31 39 35 36 0d 0a 2d 32 39 33  117..-1956..-293
2f880 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2f890 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2f8a0 6f 6c 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 * - cor0.col
2f8b0 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 + col2 FROM ta
2f8c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2f8d0 0d 0a 2d 31 32 32 34 0d 0a 2d 35 34 33 0d 0a 2d  ..-1224..-543..-
2f8e0 37 38 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7839....query I 
2f8f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2f900 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
2f910 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col0 * + col0 AS
2f920 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2f930 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a  cor0..----..49..
2f940 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75  6084..6241....qu
2f950 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f960 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 30  ELECT - ( + col0
2f970 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) * col1 FROM t
2f980 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2f990 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d  -..-2064..-3395.
2f9a0 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  .-8099....query 
2f9b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f9c0 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20  T ALL cor0.col0 
2f9d0 2a 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  * col1 + cor0.co
2f9e0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2f9f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 30  cor0..----..1360
2fa00 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d 0a 71  ..248..4661....q
2fa10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2fa20 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20  SELECT col1 * - 
2fa30 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 30  cor0.col0 - col0
2fa40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2fa50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 38 0d  r0..----..-2088.
2fa60 0a 2d 33 34 33 30 0d 0a 2d 38 31 38 38 0d 0a 0d  .-3430..-8188...
2fa70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fa80 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
2fa90 2a 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  * ( col1 ) FROM 
2faa0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
2fab0 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32  .1343..217..4602
2fac0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fad0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
2fae0 2d 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c  - col0 ) * + col
2faf0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2fb00 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2fb10 2d 0d 0a 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39  -..4096..6400..9
2fb20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fb30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2fb40 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  INCT + - col2 * 
2fb50 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 30 20  ( col1 ) + col0 
2fb60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2fb70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2fb80 0a 2d 31 34 35 36 0d 0a 2d 35 36 37 0d 0a 2d 38  .-1456..-567..-8
2fb90 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
2fba0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2fbb0 4c 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  L + col1 - col0 
2fbc0 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53  * col2 * col1 AS
2fbd0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
2fbe0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39  cor0..----..-119
2fbf0 35 39 33 0d 0a 2d 35 31 30 31 37 0d 0a 2d 35 38  593..-51017..-58
2fc00 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  28....onlyif mys
2fc10 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2fc20 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2fc30 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2fc40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2fc50 6c 2d 31 33 35 36 0d 0a 53 45 4c 45 43 54 20 41  l-1356..SELECT A
2fc60 4c 4c 20 74 61 62 30 2e 63 6f 6c 31 20 44 49 56  LL tab0.col1 DIV
2fc70 20 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 2b 20   - ( col0 ) + + 
2fc80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2fc90 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 33 30 0d 0a 38 31  ----..-1..30..81
2fca0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2fcb0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2fcc0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2fcd0 72 74 20 6c 61 62 65 6c 2d 31 33 35 36 0d 0a 53  rt label-1356..S
2fce0 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 30 2e 63  ELECT ALL tab0.c
2fcf0 6f 6c 31 20 2f 20 2d 20 28 20 63 6f 6c 30 20 29  ol1 / - ( col0 )
2fd00 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + + col2 FROM t
2fd10 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 33  ab0..----..-1..3
2fd20 30 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  0..81....query I
2fd30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2fd40 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
2fd50 20 2d 20 31 34 20 46 52 4f 4d 20 74 61 62 31 0d   - 14 FROM tab1.
2fd60 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 31  .----..-1..-4..1
2fd70 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2fd80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
2fd90 61 62 31 2e 63 6f 6c 32 20 2b 20 28 20 2d 20 63  ab1.col2 + ( - c
2fda0 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  ol2 ) FROM tab1.
2fdb0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31 31  .----..-108..-11
2fdc0 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 71 75 65 72 79  4..-192....query
2fdd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fde0 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  CT + col1 + + co
2fdf0 6c 32 20 2d 20 33 37 20 41 53 20 63 6f 6c 30 20  l2 - 37 AS col0 
2fe00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2fe10 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d 0a 34 33 0d  0..----..30..43.
2fe20 0a 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .72....onlyif my
2fe30 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2fe40 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2fe50 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2fe60 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2fe70 65 6c 2d 31 33 36 30 0d 0a 53 45 4c 45 43 54 20  el-1360..SELECT 
2fe80 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
2fe90 31 20 2b 20 35 37 20 44 49 56 20 2b 20 63 6f 6c  1 + 57 DIV + col
2fea0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2feb0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2fec0 2d 0d 0a 2d 32 34 0d 0a 2d 35 0d 0a 2d 39 0d 0a  -..-24..-5..-9..
2fed0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2fee0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2fef0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ff00 20 6c 61 62 65 6c 2d 31 33 36 30 0d 0a 53 45 4c   label-1360..SEL
2ff10 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
2ff20 20 63 6f 6c 31 20 2b 20 35 37 20 2f 20 2b 20 63   col1 + 57 / + c
2ff30 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2ff40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2ff50 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35 0d 0a 2d 39  ---..-24..-5..-9
2ff60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2ff70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
2ff80 49 4e 43 54 20 38 33 20 46 52 4f 4d 20 74 61 62  INCT 83 FROM tab
2ff90 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  1, tab0 AS cor0,
2ffa0 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
2ffb0 2d 2d 2d 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79  ---..83....query
2ffc0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ffd0 43 54 20 31 34 20 41 53 20 63 6f 6c 30 20 46 52  CT 14 AS col0 FR
2ffe0 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
2fff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
30000 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
30010 20 38 33 65 35 37 37 39 64 32 34 38 37 64 31 32   83e5779d2487d12
30020 34 39 35 65 37 64 38 31 36 63 37 39 37 32 36 34  495e7d816c797264
30030 66 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  f....skipif post
30040 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
30050 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
30060 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
30070 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
30080 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30090 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
300a0 20 2a 20 33 34 20 63 6f 6c 32 20 46 52 4f 4d 20   * 34 col2 FROM 
300b0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
300c0 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 32 31 37 36 0d  --..-102..-2176.
300d0 0a 2d 32 37 32 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-2720....skipif
300e0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
300f0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
30100 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
30110 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
30120 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
30130 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
30140 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   - cor0.col2 * +
30150 20 63 6f 6c 32 20 2b 20 39 34 20 2b 20 63 6f 6c   col2 + 94 + col
30160 32 20 2a 20 28 20 63 6f 6c 32 20 29 20 63 6f 6c  2 * ( col2 ) col
30170 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
30180 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 35 32 36  or0..----..18526
30190 0d 0a 35 39 32 36 0d 0a 36 35 39 32 0d 0a 0d 0a  ..5926..6592....
301a0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
301b0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
301c0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
301d0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
301e0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
301f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30200 20 63 6f 6c 32 20 2a 20 39 37 20 2d 20 63 6f 6c   col2 * 97 - col
30210 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0 col2 FROM tab1
30220 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30230 35 32 33 35 0d 0a 35 34 36 35 0d 0a 39 32 33 32  5235..5465..9232
30240 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30250 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
30260 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  INCT col0 + col1
30270 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   * cor0.col0 AS 
30280 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
30290 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
302a0 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a  88..3430..8188..
302b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
302c0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 37 20  t..SELECT - ( 7 
302d0 29 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 35 32 20  ) * col0 + - 52 
302e0 2a 20 36 36 20 46 52 4f 4d 20 74 61 62 30 20 41  * 66 FROM tab0 A
302f0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
30300 36 30 30 0d 0a 2d 33 36 37 37 0d 0a 2d 34 30 35  600..-3677..-405
30310 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
30320 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36  sort..SELECT - 6
30330 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
30340 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
30350 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
30360 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36 30 31  s hashing to 601
30370 65 63 34 33 39 61 37 32 66 62 34 37 38 36 61 39  ec439a72fb4786a9
30380 63 62 37 61 36 35 34 37 61 63 65 35 65 0d 0a 0d  cb7a6547ace5e...
30390 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
303a0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
303b0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
303c0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
303d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36  owsort label-136
303e0 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
303f0 43 54 20 2b 20 33 34 20 44 49 56 20 63 6f 72 30  CT + 34 DIV cor0
30400 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
30410 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
30420 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
30430 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor1..----..0..1
30440 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..34....skipif m
30450 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
30460 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
30470 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 36  owsort label-136
30480 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
30490 43 54 20 2b 20 33 34 20 2f 20 63 6f 72 30 2e 63  CT + 34 / cor0.c
304a0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
304b0 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
304c0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 63 6f  OSS JOIN tab2 co
304d0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a  r1..----..0..1..
304e0 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
304f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30500 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20  STINCT col2 * + 
30510 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 41 53  col0 + - col1 AS
30520 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
30530 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 0d  cor0..----..-62.
30540 0a 37 30 36 0d 0a 37 32 30 37 0d 0a 0d 0a 6f 6e  .706..7207....on
30550 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
30560 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
30570 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
30580 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
30590 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 31 0d 0a  ort label-1371..
305a0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
305b0 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20  2 DIV - col0 AS 
305c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
305d0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
305e0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
305f0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30610 20 6c 61 62 65 6c 2d 31 33 37 31 0d 0a 53 45 4c   label-1371..SEL
30620 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2f  ECT ALL + col2 /
30630 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
30640 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
30650 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  .-1..0..0....que
30660 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30670 4c 45 43 54 20 2b 20 2b 20 39 32 20 2a 20 2b 20  LECT + + 92 * + 
30680 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
30690 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  S cor0..----..22
306a0 30 38 0d 0a 33 32 32 30 0d 0a 38 31 38 38 0d 0a  08..3220..8188..
306b0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
306c0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
306d0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
306e0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
306f0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
30700 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30710 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
30720 36 33 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  63 col2 FROM tab
30730 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
30740 0a 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .63....query I r
30750 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
30760 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
30770 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  b1 cor0..----..8
30780 0d 0a 38 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8..8....query 
30790 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
307a0 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  T - - col1 * - c
307b0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol1 * + col0 AS 
307c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
307d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32  or0..----..-1352
307e0 30 0d 0a 2d 32 30 32 38 0d 0a 2d 36 34 30 30 0d  0..-2028..-6400.
307f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30800 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  rt..SELECT + tab
30810 30 2e 63 6f 6c 32 20 2a 20 2d 20 74 61 62 30 2e  0.col2 * - tab0.
30820 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
30830 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
30840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
30850 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
30860 62 63 37 65 61 37 38 31 65 32 31 39 66 34 31 37  bc7ea781e219f417
30870 37 31 32 36 66 65 65 62 35 39 66 65 62 32 64 0d  7126feeb59feb2d.
30880 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
30890 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
308a0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
308b0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
308c0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
308d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
308e0 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 63  ECT ALL col2 - c
308f0 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ol2 col2 FROM ta
30900 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
30910 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..0..0..0....ski
30920 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
30930 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
30940 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
30950 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
30960 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
30970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30980 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e  STINCT + + cor0.
30990 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 63 6f 6c 31  col1 + col1 col1
309a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
309b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 33  r0..----..118..3
309c0 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  4..62....query I
309d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
309e0 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f   ALL - col0 * co
309f0 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  l1 - - col2 * co
30a00 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
30a10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 30 38  cor0..----..3008
30a20 0d 0a 36 36 34 30 0d 0a 38 34 0d 0a 0d 0a 71 75  ..6640..84....qu
30a30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30a40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 39 34 20 46  ELECT ALL + 94 F
30a50 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 63  ROM tab0, tab0 c
30a60 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
30a70 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
30a80 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 61 34  es hashing to a4
30a90 64 32 33 39 36 32 36 63 66 30 35 34 36 61 63 31  d239626cf0546ac1
30aa0 62 32 66 35 37 62 62 38 34 30 37 30 38 39 0d 0a  b2f57bb8407089..
30ab0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30ac0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
30ad0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2a   col1 + + col0 *
30ae0 20 2b 20 37 31 20 2a 20 63 6f 6c 32 20 46 52 4f   + 71 * col2 FRO
30af0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
30b00 2d 2d 2d 2d 0d 0a 32 35 38 32 0d 0a 35 32 35 36  ----..2582..5256
30b10 32 30 0d 0a 35 39 30 37 30 0d 0a 0d 0a 71 75 65  20..59070....que
30b20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30b30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
30b40 36 33 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  63 * - cor0.col1
30b50 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 38 31   + + col0 + - 81
30b60 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
30b70 0a 2d 2d 2d 2d 0d 0a 31 30 36 39 0d 0a 31 38 37  .----..1069..187
30b80 39 0d 0a 33 37 31 34 0d 0a 0d 0a 71 75 65 72 79  9..3714....query
30b90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30ba0 43 54 20 41 4c 4c 20 35 36 20 46 52 4f 4d 20 74  CT ALL 56 FROM t
30bb0 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a  ab1, tab0 cor0..
30bc0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
30bd0 61 73 68 69 6e 67 20 74 6f 20 39 63 34 35 32 33  ashing to 9c4523
30be0 33 31 32 31 37 34 37 33 30 62 62 63 35 32 35 62  312174730bbc525b
30bf0 39 39 37 37 61 61 39 39 66 61 0d 0a 0d 0a 71 75  9977aa99fa....qu
30c00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30c10 45 4c 45 43 54 20 34 39 20 2b 20 63 6f 6c 31 20  ELECT 49 + col1 
30c20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 41 53  + + tab1.col1 AS
30c30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
30c40 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 36 39 0d 0a  .----..101..69..
30c50 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
30c60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
30c70 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  l2 - + col1 * co
30c80 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
30c90 2d 2d 0d 0a 2d 37 33 36 33 0d 0a 2d 38 31 39 39  --..-7363..-8199
30ca0 0d 0a 2d 39 34 30 38 0d 0a 0d 0a 6f 6e 6c 79 69  ..-9408....onlyi
30cb0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
30cc0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
30cd0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
30ce0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
30cf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
30d00 62 65 6c 2d 31 33 38 36 0d 0a 53 45 4c 45 43 54  bel-1386..SELECT
30d10 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54 28 20 4e   ALL - - CAST( N
30d20 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
30d30 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
30d40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
30d50 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
30d60 74 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31  to cd7a7901e47c1
30d70 35 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66  5155404aff0d216f
30d80 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  e0b....skipif my
30d90 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
30da0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
30db0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 36  wsort label-1386
30dc0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
30dd0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
30de0 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
30df0 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
30e00 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
30e10 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37  s hashing to cd7
30e20 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34 30  a7901e47c1515540
30e30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d  4aff0d216fe0b...
30e40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30e50 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
30e60 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  + col1 * + col0 
30e70 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  + col0 * - col1 
30e80 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
30e90 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
30ea0 0a 31 31 35 30 35 30 0d 0a 34 39 36 39 31 0d 0a  .115050..49691..
30eb0 35 36 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5642....query I 
30ec0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30ed0 2d 20 39 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  - 98 AS col0 FRO
30ee0 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
30ef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
30f00 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
30f10 66 31 37 62 37 30 30 38 61 37 64 65 61 65 31 65  f17b7008a7deae1e
30f20 62 35 61 32 65 37 30 37 65 63 32 33 37 36 33 38  b5a2e707ec237638
30f30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30f40 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
30f50 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
30f60 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
30f70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
30f80 31 33 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1389..SELECT ALL
30f90 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 74 61   - col1 DIV - ta
30fa0 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  b2.col0 AS col2 
30fb0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
30fc0 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 73 6b 69 70  .0..0..4....skip
30fd0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30fe0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30ff0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
31000 2d 31 33 38 39 0d 0a 53 45 4c 45 43 54 20 41 4c  -1389..SELECT AL
31010 4c 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 74 61 62  L - col1 / - tab
31020 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  2.col0 AS col2 F
31030 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
31040 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69  0..0..4....skipi
31050 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
31060 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
31070 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
31080 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
31090 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
310a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
310b0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20 35 30  INCT + col0 + 50
310c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
310d0 0a 2d 2d 2d 2d 0d 0a 31 33 39 0d 0a 37 34 0d 0a  .----..139..74..
310e0 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
310f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
31100 2d 20 36 35 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  - 65 * - cor0.co
31110 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
31120 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30  cor0..----..1690
31130 0d 0a 36 35 30 0d 0a 38 34 35 0d 0a 0d 0a 71 75  ..650..845....qu
31140 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31150 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 36 37 20  ELECT col2 * 67 
31160 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
31170 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30 31 0d 0a  b2..----..1801..
31180 31 38 34 30 0d 0a 32 35 36 33 0d 0a 0d 0a 71 75  1840..2563....qu
31190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
311a0 45 4c 45 43 54 20 28 20 2d 20 31 32 20 29 20 2a  ELECT ( - 12 ) *
311b0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
311c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
311d0 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39 33 36  .----..-84..-936
311e0 0d 0a 2d 39 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-948....onlyif
311f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
31200 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
31210 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
31220 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
31230 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31240 65 6c 2d 31 33 39 34 0d 0a 53 45 4c 45 43 54 20  el-1394..SELECT 
31250 2b 20 2b 20 43 41 53 54 28 20 35 37 20 41 53 20  + + CAST( 57 AS 
31260 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
31270 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
31280 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a 35 37  r0..----..57..57
31290 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..57....skipif m
312a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
312b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
312c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39  owsort label-139
312d0 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43 41  4..SELECT + + CA
312e0 53 54 20 28 20 35 37 20 41 53 20 49 4e 54 45 47  ST ( 57 AS INTEG
312f0 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  ER ) AS col1 FRO
31300 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31310 2d 2d 2d 2d 0d 0a 35 37 0d 0a 35 37 0d 0a 35 37  ----..57..57..57
31320 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31330 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
31340 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  INCT - cor0.col0
31350 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
31360 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
31370 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 6f 6e  0..----..0....on
31380 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
31390 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
313a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
313b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
313c0 6f 72 74 20 6c 61 62 65 6c 2d 31 33 39 36 0d 0a  ort label-1396..
313d0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 36 20  SELECT ALL - 86 
313e0 44 49 56 20 35 34 20 46 52 4f 4d 20 74 61 62 32  DIV 54 FROM tab2
313f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31400 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b  -1..-1..-1....sk
31410 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
31420 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
31430 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31440 65 6c 2d 31 33 39 36 0d 0a 53 45 4c 45 43 54 20  el-1396..SELECT 
31450 41 4c 4c 20 2d 20 38 36 20 2f 20 35 34 20 46 52  ALL - 86 / 54 FR
31460 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
31470 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d  .----..-1..-1..-
31480 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
31490 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
314a0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
314b0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
314c0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
314d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
314e0 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
314f0 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f  0 * cor0.col1 co
31500 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
31510 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  cor0..----..-104
31520 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a  0..-640..-78....
31530 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31540 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 39  .SELECT ALL + 69
31550 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   * cor0.col1 FRO
31560 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  M tab1, tab2 AS 
31570 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
31580 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
31590 36 31 62 65 38 62 34 63 63 65 61 34 63 62 31 63  61be8b4ccea4cb1c
315a0 63 34 61 64 64 30 30 30 62 64 37 30 64 65 66 37  c4add000bd70def7
315b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
315c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
315d0 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 32  INCT + tab1.col2
315e0 20 2a 20 31 39 20 41 53 20 63 6f 6c 30 20 46 52   * 19 AS col0 FR
315f0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74  OM tab1, tab0, t
31600 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
31610 2d 0d 0a 31 30 32 36 0d 0a 31 30 38 33 0d 0a 31  -..1026..1083..1
31620 38 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  824....onlyif my
31630 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
31640 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
31650 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
31660 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31670 65 6c 2d 31 34 30 30 0d 0a 53 45 4c 45 43 54 20  el-1400..SELECT 
31680 41 4c 4c 20 63 6f 6c 30 20 44 49 56 20 2d 20 37  ALL col0 DIV - 7
31690 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
316a0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
316b0 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a  -..-1..-1..0....
316c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
316d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
316e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
316f0 61 62 65 6c 2d 31 34 30 30 0d 0a 53 45 4c 45 43  abel-1400..SELEC
31700 54 20 41 4c 4c 20 63 6f 6c 30 20 2f 20 2d 20 37  T ALL col0 / - 7
31710 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
31720 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
31730 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a  -..-1..-1..0....
31740 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31750 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
31760 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  l1 * col2 * col1
31770 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
31780 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 30 36  r0..----..-24406
31790 38 0d 0a 2d 36 37 39 30 34 32 0d 0a 2d 39 34 30  8..-679042..-940
317a0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
317b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
317c0 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b  TINCT - + col1 +
317d0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   - cor0.col0 * c
317e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
317f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
31800 0d 0a 2d 34 31 30 36 0d 0a 2d 36 34 31 33 0d 0a  ..-4106..-6413..
31810 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31820 74 0d 0a 53 45 4c 45 43 54 20 2d 20 30 20 2a 20  t..SELECT - 0 * 
31830 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
31840 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
31850 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
31860 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
31870 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
31880 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
31890 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
318a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30  owsort label-140
318b0 34 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 28 20  4..SELECT - + ( 
318c0 2d 20 63 6f 6c 32 20 29 20 44 49 56 20 2b 20 63  - col2 ) DIV + c
318d0 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
318e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
318f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a  r0..----..2..5..
31900 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
31910 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
31920 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
31930 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 34 0d 0a  ort label-1404..
31940 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 2d 20 63  SELECT - + ( - c
31950 6f 6c 32 20 29 20 2f 20 2b 20 63 6f 72 30 2e 63  ol2 ) / + cor0.c
31960 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
31970 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
31980 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d 0a  ---..2..5..7....
31990 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
319a0 0a 53 45 4c 45 43 54 20 2b 20 34 36 20 41 53 20  .SELECT + 46 AS 
319b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20  col1 FROM tab0, 
319c0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
319d0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
319e0 67 20 74 6f 20 33 31 38 31 38 63 39 64 34 64 33  g to 31818c9d4d3
319f0 32 35 65 62 32 34 38 37 33 35 63 39 37 63 62 31  25eb248735c97cb1
31a00 64 63 65 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49  dce39....query I
31a10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31a20 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63   cor0.col2 * - c
31a30 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
31a40 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
31a50 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
31a60 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
31a70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31a80 20 2b 20 35 31 20 2a 20 63 6f 6c 31 20 41 53 20   + 51 * col1 AS 
31a90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
31aa0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
31ab0 32 36 0d 0a 35 31 30 0d 0a 36 36 33 0d 0a 0d 0a  26..510..663....
31ac0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
31ad0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
31ae0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
31af0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
31b00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 38  wsort label-1408
31b10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
31b20 54 20 2d 20 39 38 20 44 49 56 20 63 6f 6c 31 20  T - 98 DIV col1 
31b30 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
31b40 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
31b50 0d 0a 2d 33 0d 0a 2d 35 0d 0a 0d 0a 73 6b 69 70  ..-3..-5....skip
31b60 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
31b70 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
31b80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
31b90 2d 31 34 30 38 0d 0a 53 45 4c 45 43 54 20 44 49  -1408..SELECT DI
31ba0 53 54 49 4e 43 54 20 2d 20 39 38 20 2f 20 63 6f  STINCT - 98 / co
31bb0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
31bc0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
31bd0 0a 2d 31 0d 0a 2d 33 0d 0a 2d 35 0d 0a 0d 0a 71  .-1..-3..-5....q
31be0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31bf0 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
31c00 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  l1 + col1 * + co
31c10 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
31c20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
31c30 0a 31 31 30 0d 0a 31 38 32 0d 0a 37 30 32 0d 0a  .110..182..702..
31c40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31c50 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
31c60 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 * col2 FROM ta
31c70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
31c80 0d 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d  ..108..114..192.
31c90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31ca0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
31cb0 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63   cor0.col0 + + c
31cc0 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f  ol1 * col1 AS co
31cd0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
31ce0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 37 32  cor0..----..7372
31cf0 0d 0a 38 31 39 32 0d 0a 39 33 37 34 0d 0a 0d 0a  ..8192..9374....
31d00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31d10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31d20 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
31d30 6f 6c 32 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c  ol2 + col2 - col
31d40 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
31d50 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
31d60 32 31 33 0d 0a 33 36 34 31 0d 0a 37 36 39 36 0d  213..3641..7696.
31d70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31d80 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
31d90 30 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  0 + col2 * + col
31da0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
31db0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
31dc0 2d 0d 0a 31 31 31 33 0d 0a 33 36 0d 0a 36 38 31  -..1113..36..681
31dd0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
31de0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
31df0 54 49 4e 43 54 20 2b 20 2b 20 28 20 63 6f 6c 31  TINCT + + ( col1
31e00 20 29 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   ) * - col1 FROM
31e10 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
31e20 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d  ---..-100..-169.
31e30 0a 2d 36 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-676....onlyif 
31e40 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
31e50 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
31e60 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
31e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
31e80 61 62 65 6c 2d 31 34 31 35 0d 0a 53 45 4c 45 43  abel-1415..SELEC
31e90 54 20 28 20 2b 20 63 6f 6c 32 20 29 20 44 49 56  T ( + col2 ) DIV
31ea0 20 63 6f 6c 32 20 2b 20 2b 20 28 20 74 61 62 30   col2 + + ( tab0
31eb0 2e 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 31 20  .col2 ) AS col1 
31ec0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
31ed0 0a 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b  .2..34..83....sk
31ee0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
31ef0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
31f00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31f10 65 6c 2d 31 34 31 35 0d 0a 53 45 4c 45 43 54 20  el-1415..SELECT 
31f20 28 20 2b 20 63 6f 6c 32 20 29 20 2f 20 63 6f 6c  ( + col2 ) / col
31f30 32 20 2b 20 2b 20 28 20 74 61 62 30 2e 63 6f 6c  2 + + ( tab0.col
31f40 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  2 ) AS col1 FROM
31f50 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   tab0..----..2..
31f60 33 34 0d 0a 38 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  34..83....onlyif
31f70 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
31f80 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
31f90 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
31fa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31fb0 6c 61 62 65 6c 2d 31 34 31 36 0d 0a 53 45 4c 45  label-1416..SELE
31fc0 43 54 20 2d 20 28 20 32 34 20 29 20 2a 20 74 61  CT - ( 24 ) * ta
31fd0 62 31 2e 63 6f 6c 32 20 2b 20 2b 20 32 30 20 44  b1.col2 + + 20 D
31fe0 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV - col0 FROM t
31ff0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 32  ab1..----..-1302
32000 0d 0a 2d 31 33 36 38 0d 0a 2d 32 33 30 34 0d 0a  ..-1368..-2304..
32010 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
32020 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
32030 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32040 20 6c 61 62 65 6c 2d 31 34 31 36 0d 0a 53 45 4c   label-1416..SEL
32050 45 43 54 20 2d 20 28 20 32 34 20 29 20 2a 20 74  ECT - ( 24 ) * t
32060 61 62 31 2e 63 6f 6c 32 20 2b 20 2b 20 32 30 20  ab1.col2 + + 20 
32070 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / - col0 FROM ta
32080 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 30 32 0d  b1..----..-1302.
32090 0a 2d 31 33 36 38 0d 0a 2d 32 33 30 34 0d 0a 0d  .-1368..-2304...
320a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
320b0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
320c0 54 20 31 20 2a 20 2b 20 34 36 20 46 52 4f 4d 20  T 1 * + 46 FROM 
320d0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 36 0d 0a  tab2..----..46..
320e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
320f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
32100 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  - col0 * cor0.co
32110 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
32120 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d  cor0..----..-49.
32130 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d 0a 0d  .-6084..-6241...
32140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32150 0d 0a 53 45 4c 45 43 54 20 2b 20 33 32 20 2a 20  ..SELECT + 32 * 
32160 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
32170 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
32180 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 36 0d 0a 2d  ..----..-1216..-
32190 38 33 32 0d 0a 2d 38 36 34 0d 0a 0d 0a 73 6b 69  832..-864....ski
321a0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
321b0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
321c0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
321d0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
321e0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
321f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37 20  wsort..SELECT 7 
32200 2b 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  + + col1 col2 FR
32210 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
32220 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 38 0d 0a 36  .----..24..38..6
32230 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
32240 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
32250 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  ol1 + - col2 * c
32260 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
32270 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
32280 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37 32 30 37  ---..-706..-7207
32290 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..62....query I 
322a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
322b0 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ALL + cor0.col0 
322c0 2b 20 32 38 20 46 52 4f 4d 20 74 61 62 30 20 63  + 28 FROM tab0 c
322d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37 0d 0a  or0..----..117..
322e0 35 32 0d 0a 36 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  52..63....onlyif
322f0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
32300 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
32310 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
32320 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32330 6c 61 62 65 6c 2d 31 34 32 33 0d 0a 53 45 4c 45  label-1423..SELE
32340 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20  CT + + col0 + - 
32350 63 6f 6c 30 20 44 49 56 20 2d 20 32 37 20 41 53  col0 DIV - 27 AS
32360 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
32370 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
32380 0d 0a 36 36 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70  ..66..82....skip
32390 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
323a0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
323b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
323c0 2d 31 34 32 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1423..SELECT + 
323d0 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20  + col0 + - col0 
323e0 2f 20 2d 20 32 37 20 41 53 20 63 6f 6c 31 20 46  / - 27 AS col1 F
323f0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
32400 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 36 0d 0a 38  ..----..3..66..8
32410 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
32420 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
32430 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 33   cor0.col1 + + 3
32440 30 20 2b 20 33 38 20 2a 20 63 6f 72 30 2e 63 6f  0 + 38 * cor0.co
32450 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
32460 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 34  cor0..----..1044
32470 0d 0a 34 32 30 0d 0a 35 33 37 0d 0a 0d 0a 71 75  ..420..537....qu
32480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32490 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 34 31  ELECT ALL - + 41
324a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
324b0 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b2 AS cor0 CROSS
324c0 20 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f   JOIN tab1 AS co
324d0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
324e0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 62  es hashing to 4b
324f0 61 30 63 31 30 32 30 39 31 66 39 63 62 63 39 66  a0c102091f9cbc9f
32500 65 39 34 33 39 62 30 34 35 38 34 65 37 30 0d 0a  e9439b04584e70..
32510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32520 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
32530 20 2b 20 33 36 20 46 52 4f 4d 20 74 61 62 30 20   + 36 FROM tab0 
32540 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
32550 31 38 0d 0a 33 37 0d 0a 36 39 0d 0a 0d 0a 71 75  18..37..69....qu
32560 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32570 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d  ELECT + col1 * -
32580 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
32590 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 + col2 FROM ta
325a0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
325b0 0d 0a 2d 37 32 37 37 0d 0a 2d 38 31 30 38 0d 0a  ..-7277..-8108..
325c0 2d 39 33 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -9311....query I
325d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
325e0 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 33 30   + - col1 + - 30
325f0 20 2a 20 2b 20 32 37 20 2a 20 2d 20 63 6f 6c 30   * + 27 * - col0
32600 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
32610 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
32620 0a 32 34 30 37 0d 0a 35 31 38 39 34 0d 0a 36 34  .2407..51894..64
32630 38 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  867....query I r
32640 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
32650 6f 6c 30 20 2b 20 32 30 20 41 53 20 63 6f 6c 32  ol0 + 20 AS col2
32660 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
32670 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 39 38  r0..----..27..98
32680 0d 0a 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..99....skipif p
32690 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
326a0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
326b0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
326c0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
326d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
326e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
326f0 2b 20 31 34 20 63 6f 6c 30 20 46 52 4f 4d 20 74  + 14 col0 FROM t
32700 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
32710 2d 0d 0a 2d 31 39 0d 0a 2d 36 38 0d 0a 31 33 0d  -..-19..-68..13.
32720 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
32730 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
32740 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
32750 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
32760 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
32770 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 31  wsort label-1431
32780 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c  ..SELECT ( + col
32790 32 20 29 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  2 ) * CAST( NULL
327a0 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
327b0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab2..----..NU
327c0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
327d0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
327e0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
327f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32800 20 6c 61 62 65 6c 2d 31 34 33 31 0d 0a 53 45 4c   label-1431..SEL
32810 45 43 54 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a  ECT ( + col2 ) *
32820 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
32830 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
32840 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab2..----..NULL.
32850 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
32860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32870 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
32880 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f  - ( - col1 ) FRO
32890 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
328a0 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a  ----..-54..-67..
328b0 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
328c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
328d0 4c 20 63 6f 6c 32 20 2a 20 28 20 2d 20 36 20 2a  L col2 * ( - 6 *
328e0 20 63 6f 6c 30 20 29 20 2b 20 2b 20 28 20 2b 20   col0 ) + + ( + 
328f0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 29 20  col0 * + col0 ) 
32900 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
32910 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 38 36 37 0d  0..----..-35867.
32920 0a 2d 34 31 37 36 0d 0a 31 30 31 35 0d 0a 0d 0a  .-4176..1015....
32930 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32940 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
32950 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col0 + col1 * + 
32960 31 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  12 AS col2 FROM 
32970 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
32980 2d 2d 0d 0a 31 30 35 36 0d 0a 31 31 38 31 0d 0a  --..1056..1181..
32990 31 31 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1199....query I 
329a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
329b0 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
329c0 32 20 2b 20 2d 20 33 36 20 2b 20 2d 20 63 6f 6c  2 + - 36 + - col
329d0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
329e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 31  or0..----..-8..1
329f0 31 0d 0a 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..47....query I
32a00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32a10 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
32a20 20 2a 20 37 32 20 2b 20 32 38 20 2b 20 63 6f 6c   * 72 + 28 + col
32a30 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
32a40 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
32a50 2d 0d 0a 31 33 35 0d 0a 32 34 32 38 0d 0a 36 30  -..135..2428..60
32a60 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  21....onlyif mys
32a70 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
32a80 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
32a90 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
32aa0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32ab0 6c 2d 31 34 33 37 0d 0a 53 45 4c 45 43 54 20 44  l-1437..SELECT D
32ac0 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63  ISTINCT col0 + c
32ad0 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2b 20 63  or0.col2 DIV + c
32ae0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
32af0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
32b00 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  .35..89....skipi
32b10 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
32b20 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
32b30 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
32b40 31 34 33 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  1437..SELECT DIS
32b50 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 72  TINCT col0 + cor
32b60 30 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31 20  0.col2 / + col1 
32b70 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
32b80 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d  0..----..24..35.
32b90 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .89....query I r
32ba0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
32bb0 6f 72 31 2e 63 6f 6c 32 20 2b 20 2b 20 31 35 20  or1.col2 + + 15 
32bc0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
32bd0 30 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61  0, tab0 cor0, ta
32be0 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
32bf0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
32c00 69 6e 67 20 74 6f 20 33 35 35 64 36 62 36 30 32  ing to 355d6b602
32c10 39 65 61 30 62 62 39 65 39 35 62 38 61 38 32 30  9ea0bb9e95b8a820
32c20 64 64 62 39 32 32 31 0d 0a 0d 0a 71 75 65 72 79  ddb9221....query
32c30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32c40 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37 30  CT DISTINCT + 70
32c50 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
32c60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32c70 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
32c80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32c90 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b 20  STINCT col0 + + 
32ca0 32 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  29 AS col1 FROM 
32cb0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d  tab1..----..109.
32cc0 0a 33 32 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  .32..93....query
32cd0 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
32ce0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32cf0 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
32d00 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
32d10 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74  OSS JOIN tab2, t
32d20 61 62 32 20 63 6f 72 31 2c 20 74 61 62 31 2c 20  ab2 cor1, tab1, 
32d30 74 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d  tab0 AS cor2..--
32d40 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20  --..3645 values 
32d50 68 61 73 68 69 6e 67 20 74 6f 20 36 61 36 33 30  hashing to 6a630
32d60 38 35 65 38 63 61 62 36 66 39 37 35 39 31 66 64  85e8cab6f97591fd
32d70 30 61 36 62 36 66 66 66 66 30 37 0d 0a 0d 0a 71  0a6b6ffff07....q
32d80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
32d90 53 45 4c 45 43 54 20 36 20 46 52 4f 4d 20 74 61  SELECT 6 FROM ta
32da0 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53  b1 AS cor0 CROSS
32db0 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f   JOIN tab2 AS co
32dc0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r1..----..9 valu
32dd0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 64  es hashing to 5d
32de0 31 63 62 39 30 65 64 35 38 66 61 37 35 37 33 38  1cb90ed58fa75738
32df0 39 35 64 32 66 39 35 62 32 31 31 38 32 31 0d 0a  95d2f95b211821..
32e00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32e10 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 36 32  t..SELECT ALL 62
32e20 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
32e30 32 0d 0a 2d 2d 2d 2d 0d 0a 34 33 34 0d 0a 34 38  2..----..434..48
32e40 33 36 0d 0a 34 38 39 38 0d 0a 0d 0a 71 75 65 72  36..4898....quer
32e50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32e60 45 43 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ECT col1 * - col
32e70 32 20 2d 20 2b 20 28 20 32 34 20 29 20 41 53 20  2 - + ( 24 ) AS 
32e80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
32e90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
32ea0 35 35 38 0d 0a 2d 36 37 30 0d 0a 2d 38 36 31 0d  558..-670..-861.
32eb0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32ec0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 31 20  rt..SELECT + 11 
32ed0 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  - + col0 FROM ta
32ee0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
32ef0 31 33 0d 0a 2d 32 34 0d 0a 2d 37 38 0d 0a 0d 0a  13..-24..-78....
32f00 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
32f10 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
32f20 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
32f30 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
32f40 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
32f50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32f60 20 41 4c 4c 20 36 20 2a 20 2b 20 63 6f 6c 30 20   ALL 6 * + col0 
32f70 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
32f80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32  S cor0..----..42
32f90 0d 0a 34 36 38 0d 0a 34 37 34 0d 0a 0d 0a 71 75  ..468..474....qu
32fa0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32fb0 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d  ELECT + col0 + -
32fc0 20 33 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   37 AS col2 FROM
32fd0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
32fe0 2d 2d 2d 0d 0a 2d 33 30 0d 0a 34 31 0d 0a 34 32  ---..-30..41..42
32ff0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33000 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
33010 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  l0 * col1 + col1
33020 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
33030 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d  r0..----..-1027.
33040 0a 2d 35 32 0d 0a 2d 36 33 30 0d 0a 0d 0a 71 75  .-52..-630....qu
33050 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33060 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  ELECT cor0.col2 
33070 2b 20 2b 20 33 32 20 2a 20 2d 20 63 6f 72 30 2e  + + 32 * - cor0.
33080 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
33090 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
330a0 2d 2d 2d 2d 0d 0a 2d 31 31 31 39 0d 0a 2d 32 37  ----..-1119..-27
330b0 36 36 0d 0a 2d 37 33 35 0d 0a 0d 0a 6f 6e 6c 79  66..-735....only
330c0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
330d0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
330e0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
330f0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
33100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33110 61 62 65 6c 2d 31 34 35 30 0d 0a 53 45 4c 45 43  abel-1450..SELEC
33120 54 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28  T col2 * - CAST(
33130 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
33140 29 20 2b 20 39 32 20 2a 20 63 6f 72 30 2e 63 6f  ) + 92 * cor0.co
33150 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
33160 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
33170 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
33180 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
33190 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
331a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
331b0 61 62 65 6c 2d 31 34 35 30 0d 0a 53 45 4c 45 43  abel-1450..SELEC
331c0 54 20 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 20  T col2 * - CAST 
331d0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
331e0 52 20 29 20 2b 20 39 32 20 2a 20 63 6f 72 30 2e  R ) + 92 * cor0.
331f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
33200 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
33210 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
33220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33230 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
33240 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20   + - ( + col2 ) 
33250 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  * col2 FROM tab0
33260 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33270 2d 31 31 32 32 0d 0a 2d 32 0d 0a 2d 36 38 30 36  -1122..-2..-6806
33280 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
33290 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
332a0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
332b0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
332c0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
332d0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35  owsort label-145
332e0 32 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  2..SELECT - + co
332f0 6c 32 20 2a 20 2b 20 43 41 53 54 28 20 36 32 20  l2 * + CAST( 62 
33300 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
33310 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
33320 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
33330 31 32 0d 0a 2d 31 36 37 34 0d 0a 2d 32 33 35 36  12..-1674..-2356
33340 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
33350 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
33360 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
33370 72 74 20 6c 61 62 65 6c 2d 31 34 35 32 0d 0a 53  rt label-1452..S
33380 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a  ELECT - + col2 *
33390 20 2b 20 43 41 53 54 20 28 20 36 32 20 41 53 20   + CAST ( 62 AS 
333a0 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
333b0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
333c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 32  or0..----..-1612
333d0 0d 0a 2d 31 36 37 34 0d 0a 2d 32 33 35 36 0d 0a  ..-1674..-2356..
333e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
333f0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
33400 62 32 2e 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63  b2.col2 + tab2.c
33410 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 * col0 AS co
33420 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
33430 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d 0a 34  --..1381..244..4
33440 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  628....query I r
33450 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
33460 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63   cor0.col1 + + c
33470 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f  ol1 + - col2 FRO
33480 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
33490 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 33 37 0d 0a 2d  ----..-2..-37..-
334a0 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  70....skipif pos
334b0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
334c0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
334d0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
334e0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
334f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
33500 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f  SELECT col2 + co
33510 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 35 35  l2 + + col2 * 55
33520 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
33530 0a 2d 2d 2d 2d 0d 0a 31 34 38 32 0d 0a 31 35 33  .----..1482..153
33540 39 0d 0a 32 31 36 36 0d 0a 0d 0a 71 75 65 72 79  9..2166....query
33550 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33560 43 54 20 2b 20 39 32 20 41 53 20 63 6f 6c 32 20  CT + 92 AS col2 
33570 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
33580 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f  AS cor0, tab2 co
33590 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
335a0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
335b0 36 34 63 62 37 61 38 31 64 61 35 31 66 34 62 65  64cb7a81da51f4be
335c0 30 62 36 39 30 36 61 32 32 33 65 38 38 31 37 0d  0b6906a223e8817.
335d0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
335e0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
335f0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
33600 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
33610 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
33620 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33630 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
33640 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63  ol0 * - col0 + c
33650 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
33660 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
33670 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a 37 36  ..6110..6279..76
33680 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33690 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
336a0 49 4e 43 54 20 2b 20 28 20 2d 20 63 6f 6c 31 20  INCT + ( - col1 
336b0 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ) + col2 AS col0
336c0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
336d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d  r0..----..-33..-
336e0 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  4..21....query I
336f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33700 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b   - col1 * col1 +
33710 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
33720 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
33730 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36  0..----..-43..-6
33740 32 32 0d 0a 2d 37 33 0d 0a 0d 0a 6f 6e 6c 79 69  22..-73....onlyi
33750 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
33760 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
33770 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
33780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33790 20 6c 61 62 65 6c 2d 31 34 36 30 0d 0a 53 45 4c   label-1460..SEL
337a0 45 43 54 20 2b 20 28 20 63 6f 6c 30 20 29 20 44  ECT + ( col0 ) D
337b0 49 56 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f  IV col0 col0 FRO
337c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
337d0 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d  ----..1..1..1...
337e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
337f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
33800 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
33810 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
33820 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
33830 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
33840 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
33850 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
33860 34 36 30 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20  460..SELECT + ( 
33870 63 6f 6c 30 20 29 20 2f 20 63 6f 6c 30 20 63 6f  col0 ) / col0 co
33880 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
33890 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31  cor0..----..1..1
338a0 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..1....onlyif my
338b0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
338c0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
338d0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
338e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
338f0 65 6c 2d 31 34 36 31 0d 0a 53 45 4c 45 43 54 20  el-1461..SELECT 
33900 41 4c 4c 20 2b 20 32 37 20 44 49 56 20 2d 20 63  ALL + 27 DIV - c
33910 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
33920 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
33930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32  r0..----..-1..-2
33940 0d 0a 2d 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..-2....skipif m
33950 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
33960 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
33970 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36  owsort label-146
33980 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  1..SELECT ALL + 
33990 32 37 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  27 / - cor0.col1
339a0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
339b0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
339c0 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 32 0d 0a 0d 0a  ..-1..-2..-2....
339d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
339e0 0a 53 45 4c 45 43 54 20 34 38 20 41 53 20 63 6f  .SELECT 48 AS co
339f0 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
33a00 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
33a10 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
33a20 6e 67 20 74 6f 20 38 62 30 39 63 63 32 63 39 39  ng to 8b09cc2c99
33a30 63 32 31 30 32 30 33 36 31 36 32 64 30 36 33 65  c2102036162d063e
33a40 30 65 35 61 34 62 0d 0a 0d 0a 71 75 65 72 79 20  0e5a4b....query 
33a50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33a60 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 38 34 20  T - col0 * + 84 
33a70 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
33a80 2d 2d 2d 2d 0d 0a 2d 32 30 31 36 0d 0a 2d 32 39  ----..-2016..-29
33a90 34 30 0d 0a 2d 37 34 37 36 0d 0a 0d 0a 71 75 65  40..-7476....que
33aa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33ab0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  LECT + - col2 * 
33ac0 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 46 52  col0 - - col2 FR
33ad0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
33ae0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 33 35  .----..-108..-35
33af0 39 31 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 71 75 65  91..-7584....que
33b00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33b10 4c 45 43 54 20 2d 20 38 20 2a 20 2d 20 63 6f 6c  LECT - 8 * - col
33b20 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
33b30 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33 32 0d 0a  or0..----..432..
33b40 34 35 36 0d 0a 37 36 38 0d 0a 0d 0a 6f 6e 6c 79  456..768....only
33b50 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
33b60 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
33b70 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
33b80 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
33b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33ba0 61 62 65 6c 2d 31 34 36 36 0d 0a 53 45 4c 45 43  abel-1466..SELEC
33bb0 54 20 41 4c 4c 20 2b 20 43 41 53 54 28 20 63 6f  T ALL + CAST( co
33bc0 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l2 AS SIGNED ) *
33bd0 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   + col1 AS col1 
33be0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
33bf0 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30  .1248..1404..570
33c00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
33c10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
33c20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
33c30 72 74 20 6c 61 62 65 6c 2d 31 34 36 36 0d 0a 53  rt label-1466..S
33c40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54  ELECT ALL + CAST
33c50 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47   ( col2 AS INTEG
33c60 45 52 20 29 20 2a 20 2b 20 63 6f 6c 31 20 41 53  ER ) * + col1 AS
33c70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d   col1 FROM tab1.
33c80 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30  .----..1248..140
33c90 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20  4..570....query 
33ca0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33cb0 54 20 2b 20 37 31 20 2b 20 63 6f 6c 31 20 41 53  T + 71 + col1 AS
33cc0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
33cd0 0a 2d 2d 2d 2d 0d 0a 31 35 37 0d 0a 31 36 32 0d  .----..157..162.
33ce0 0a 31 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .168....query I 
33cf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33d00 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20  - col0 + col1 * 
33d10 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
33d20 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
33d30 0d 0a 2d 2d 2d 2d 0d 0a 35 37 36 0d 0a 37 35 0d  ..----..576..75.
33d40 0a 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .960....query I 
33d50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33d60 44 49 53 54 49 4e 43 54 20 2b 20 31 37 20 41 53  DISTINCT + 17 AS
33d70 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
33d80 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 0d 0a 71 75 65  .----..17....que
33d90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33da0 4c 45 43 54 20 32 34 20 46 52 4f 4d 20 74 61 62  LECT 24 FROM tab
33db0 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  1, tab1 AS cor0,
33dc0 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
33dd0 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
33de0 61 73 68 69 6e 67 20 74 6f 20 61 65 65 61 63 34  ashing to aeeac4
33df0 33 31 64 32 32 35 32 38 31 38 38 65 38 61 35 61  31d22528188e8a5a
33e00 32 61 36 30 64 32 64 30 38 30 0d 0a 0d 0a 71 75  2a60d2d080....qu
33e10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33e20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
33e30 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 31 2e  or0.col2 + cor1.
33e40 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
33e50 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
33e60 4e 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d  N tab0 cor1..---
33e70 2d 0d 0a 31 31 35 0d 0a 31 31 36 0d 0a 31 32 37  -..115..116..127
33e80 0d 0a 35 30 0d 0a 35 31 0d 0a 36 31 0d 0a 36 32  ..50..51..61..62
33e90 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..73....query I 
33ea0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33eb0 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72  DISTINCT - + cor
33ec0 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  1.col2 FROM tab0
33ed0 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a   AS cor0 CROSS J
33ee0 4f 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31  OIN tab2 AS cor1
33ef0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37  ..----..-26..-27
33f00 0d 0a 2d 33 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-38....onlyif 
33f10 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
33f20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
33f30 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
33f40 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
33f50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
33f60 6c 2d 31 34 37 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1473..SELECT +
33f70 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28 20   col2 * + CAST( 
33f80 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
33f90 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 41   * + tab2.col1 A
33fa0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
33fb0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
33fc0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
33fd0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
33fe0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
33ff0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34000 2d 31 34 37 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1473..SELECT + 
34010 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 20 28 20  col2 * + CAST ( 
34020 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
34030 29 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  ) * + tab2.col1 
34040 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
34050 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  2..----..NULL..N
34060 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
34070 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34080 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  LECT - col2 + + 
34090 63 6f 6c 32 20 2a 20 2b 20 28 20 2b 20 63 6f 6c  col2 * + ( + col
340a0 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  1 ) AS col0 FROM
340b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
340c0 2d 2d 2d 0d 0a 31 35 30 38 0d 0a 36 30 38 0d 0a  ---..1508..608..
340d0 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  810....query I r
340e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
340f0 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31  ISTINCT - - col1
34100 20 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46   * col0 * col0 F
34110 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
34120 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 35 0d 0a  ..----..118825..
34130 34 39 35 33 36 0d 0a 37 32 30 38 31 31 0d 0a 0d  49536..720811...
34140 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34150 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
34160 6f 6c 32 20 2a 20 2d 20 32 35 20 46 52 4f 4d 20  ol2 * - 25 FROM 
34170 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
34180 2d 2d 0d 0a 31 33 35 30 0d 0a 31 34 32 35 0d 0a  --..1350..1425..
34190 32 34 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  2400....onlyif m
341a0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
341b0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
341c0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
341d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
341e0 62 65 6c 2d 31 34 37 37 0d 0a 53 45 4c 45 43 54  bel-1477..SELECT
341f0 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f   ALL - - cor0.co
34200 6c 31 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20  l1 + col0 DIV - 
34210 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
34220 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
34230 2d 2d 2d 2d 0d 0a 31 36 0d 0a 33 30 0d 0a 35 38  ----..16..30..58
34240 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
34250 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
34260 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
34270 72 74 20 6c 61 62 65 6c 2d 31 34 37 37 0d 0a 53  rt label-1477..S
34280 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
34290 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2f  r0.col1 + col0 /
342a0 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
342b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
342c0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 33 30 0d  0..----..16..30.
342d0 0a 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .58....query I r
342e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
342f0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b  ol1 + - col0 * +
34300 20 36 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   64 AS col0 FROM
34310 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34320 2d 2d 2d 0d 0a 2d 31 36 36 0d 0a 2d 34 30 38 36  ---..-166..-4086
34330 0d 0a 2d 35 31 30 37 0d 0a 0d 0a 6f 6e 6c 79 69  ..-5107....onlyi
34340 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
34350 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
34360 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
34370 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
34380 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
34390 62 65 6c 2d 31 34 37 39 0d 0a 53 45 4c 45 43 54  bel-1479..SELECT
343a0 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
343b0 6c 32 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  l2 + CAST( NULL 
343c0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
343d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
343e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
343f0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
34400 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
34410 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
34420 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 39 0d 0a  ort label-1479..
34430 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34440 2b 20 2d 20 63 6f 6c 32 20 2b 20 43 41 53 54 20  + - col2 + CAST 
34450 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
34460 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  R ) AS col0 FROM
34470 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34480 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
34490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
344a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
344b0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
344c0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
344d0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
344e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34  or0..----..-1534
344f0 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a  ..-646..-837....
34500 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34510 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
34520 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol0 + col2 * col
34530 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
34540 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 39 0d  or0..----..2919.
34550 0a 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d 0a 6f  .3313..9296....o
34560 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
34570 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
34580 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
34590 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
345a0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 32 0d  sort label-1482.
345b0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b  .SELECT col0 + +
345c0 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30   col0 DIV + col0
345d0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
345e0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
345f0 0d 0a 32 35 0d 0a 33 36 0d 0a 39 30 0d 0a 0d 0a  ..25..36..90....
34600 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
34610 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
34620 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34630 61 62 65 6c 2d 31 34 38 32 0d 0a 53 45 4c 45 43  abel-1482..SELEC
34640 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20  T col0 + + col0 
34650 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  / + col0 AS col0
34660 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
34670 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36  r0..----..25..36
34680 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..90....onlyif m
34690 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
346a0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
346b0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
346c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
346d0 62 65 6c 2d 31 34 38 33 0d 0a 53 45 4c 45 43 54  bel-1483..SELECT
346e0 20 2d 20 63 6f 6c 31 20 44 49 56 20 28 20 63 6f   - col1 DIV ( co
346f0 72 30 2e 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c  r0.col0 ) AS col
34700 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
34710 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30  or0..----..-4..0
34720 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
34730 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
34740 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
34750 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 33  wsort label-1483
34760 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
34770 2f 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20  / ( cor0.col0 ) 
34780 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34790 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
347a0 0a 2d 34 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  .-4..0..0....onl
347b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
347c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
347d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
347e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
347f0 72 74 20 6c 61 62 65 6c 2d 31 34 38 34 0d 0a 53  rt label-1484..S
34800 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
34810 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f   * + col0 + - co
34820 6c 31 20 44 49 56 20 63 6f 6c 30 20 63 6f 6c 31  l1 DIV col0 col1
34830 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
34840 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  r0..----..-1040.
34850 0a 2d 36 34 30 0d 0a 2d 38 36 0d 0a 0d 0a 73 6b  .-640..-86....sk
34860 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
34870 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
34880 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
34890 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
348a0 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
348b0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
348c0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
348d0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 34  wsort label-1484
348e0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
348f0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d  ol1 * + col0 + -
34900 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 63 6f 6c   col1 / col0 col
34910 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
34920 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30  or0..----..-1040
34930 0d 0a 2d 36 34 30 0d 0a 2d 38 36 0d 0a 0d 0a 6f  ..-640..-86....o
34940 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
34950 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
34960 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
34970 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
34980 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34990 74 20 6c 61 62 65 6c 2d 31 34 38 35 0d 0a 53 45  t label-1485..SE
349a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
349b0 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20 4e  col1 + - CAST( N
349c0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
349d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
349e0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
349f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
34a00 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
34a10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34a20 6c 61 62 65 6c 2d 31 34 38 35 0d 0a 53 45 4c 45  label-1485..SELE
34a30 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
34a40 6c 31 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  l1 + - CAST ( NU
34a50 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
34a60 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
34a70 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
34a80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
34a90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
34aa0 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 72  or0.col1 * - cor
34ab0 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0.col0 FROM tab1
34ac0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34ad0 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
34ae0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
34af0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
34b00 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  INCT + col2 + co
34b10 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41  l2 * cor0.col0 A
34b20 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
34b30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36   cor0..----..216
34b40 0d 0a 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a  ..3705..7776....
34b50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34b60 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31  .SELECT - + col1
34b70 20 2a 20 2b 20 36 31 20 2a 20 2b 20 31 35 20 46   * + 61 * + 15 F
34b80 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
34b90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 39 35 0d 0a  ..----..-11895..
34ba0 2d 32 33 37 39 30 0d 0a 2d 39 31 35 30 0d 0a 0d  -23790..-9150...
34bb0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
34bc0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
34bd0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
34be0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
34bf0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
34c00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34c10 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  T + - col2 + - c
34c20 6f 6c 31 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20  ol1 * col0 col1 
34c30 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
34c40 2d 2d 2d 2d 0d 0a 2d 31 33 38 31 0d 0a 2d 32 34  ----..-1381..-24
34c50 34 0d 0a 2d 34 36 32 38 0d 0a 0d 0a 73 6b 69 70  4..-4628....skip
34c60 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
34c70 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
34c80 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
34c90 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
34ca0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
34cb0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
34cc0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 63   col0 * + col2 c
34cd0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
34ce0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
34cf0 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d  2..-3648..-7680.
34d00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34d10 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
34d20 4e 43 54 20 2b 20 35 39 20 2a 20 63 6f 6c 31 20  NCT + 59 * col1 
34d30 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
34d40 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
34d50 0a 31 35 33 34 0d 0a 35 39 30 0d 0a 37 36 37 0d  .1534..590..767.
34d60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34d70 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
34d80 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
34d90 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
34da0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
34db0 0d 0a 2d 31 34 35 36 0d 0a 2d 35 36 37 0d 0a 2d  ..-1456..-567..-
34dc0 38 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  830....query I r
34dd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
34de0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2a   col2 + + col2 *
34df0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
34e00 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
34e10 2d 2d 0d 0a 32 38 30 35 0d 0a 37 33 38 30 0d 0a  --..2805..7380..
34e20 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
34e30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
34e40 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
34e50 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46 52  col1 * + col2 FR
34e60 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
34e70 34 34 30 36 38 0d 0a 36 37 39 30 34 32 0d 0a 39  44068..679042..9
34e80 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
34e90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
34ea0 4c 4c 20 2b 20 2b 20 28 20 36 35 20 29 20 46 52  LL + + ( 65 ) FR
34eb0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
34ec0 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a 36 35 0d 0a 36  .----..65..65..6
34ed0 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
34ee0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
34ef0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
34f00 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
34f10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34f20 2d 31 34 39 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1496..SELECT DI
34f30 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
34f40 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 41 53  col1 DIV col0 AS
34f50 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
34f60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
34f70 0d 0a 32 0d 0a 32 32 35 0d 0a 0d 0a 73 6b 69 70  ..2..225....skip
34f80 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
34f90 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
34fa0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34fb0 2d 31 34 39 36 0d 0a 53 45 4c 45 43 54 20 44 49  -1496..SELECT DI
34fc0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20  STINCT + col1 * 
34fd0 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 41 53 20 63  col1 / col0 AS c
34fe0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
34ff0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
35000 32 0d 0a 32 32 35 0d 0a 0d 0a 71 75 65 72 79 20  2..225....query 
35010 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35020 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2b  T ALL + col1 * +
35030 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2d   col0 + + col2 -
35040 20 33 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53   34 FROM tab0 AS
35050 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36   cor0..----..206
35060 33 0d 0a 33 33 36 32 0d 0a 38 31 34 37 0d 0a 0d  3..3362..8147...
35070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35080 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 31 2e  ..SELECT + cor1.
35090 63 6f 6c 31 20 2b 20 36 36 20 41 53 20 63 6f 6c  col1 + 66 AS col
350a0 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
350b0 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  1 AS cor0, tab2 
350c0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
350d0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
350e0 20 74 6f 20 31 33 61 34 30 32 65 38 35 62 37 65   to 13a402e85b7e
350f0 34 65 37 30 33 30 66 38 34 34 30 66 63 33 66 65  4e7030f8440fc3fe
35100 37 39 38 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7984....skipif p
35110 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
35120 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
35130 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
35140 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
35150 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35160 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
35170 30 20 2a 20 2b 20 38 38 20 2d 20 2d 20 63 6f 6c  0 * + 88 - - col
35180 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  0 col0 FROM tab0
35190 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 33   cor0..----..213
351a0 36 0d 0a 33 31 31 35 0d 0a 37 39 32 31 0d 0a 0d  6..3115..7921...
351b0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
351c0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
351d0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
351e0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
351f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30  owsort label-150
35200 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  0..SELECT ALL - 
35210 31 35 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53  15 DIV - col2 AS
35220 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
35230 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
35240 0d 0a 30 0d 0a 31 35 0d 0a 0d 0a 73 6b 69 70 69  ..0..15....skipi
35250 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
35260 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
35270 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35280 31 35 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1500..SELECT ALL
35290 20 2d 20 31 35 20 2f 20 2d 20 63 6f 6c 32 20 41   - 15 / - col2 A
352a0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
352b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
352c0 30 0d 0a 30 0d 0a 31 35 0d 0a 0d 0a 71 75 65 72  0..0..15....quer
352d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
352e0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 35 32 20 46  ECT ALL - - 52 F
352f0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
35300 2d 2d 2d 0d 0a 35 32 0d 0a 35 32 0d 0a 35 32 0d  ---..52..52..52.
35310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35320 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 37 20  rt..SELECT - 37 
35330 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * - col1 FROM ta
35340 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
35350 0d 0a 33 37 30 0d 0a 34 38 31 0d 0a 39 36 32 0d  ..370..481..962.
35360 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35370 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28  rt..SELECT + - (
35380 20 2b 20 63 6f 6c 31 20 29 20 2a 20 2d 20 28 20   + col1 ) * - ( 
35390 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32  - col2 ) AS col2
353a0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
353b0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37  .----..-2838..-7
353c0 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72  462..-97....quer
353d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
353e0 45 43 54 20 41 4c 4c 20 39 32 20 2b 20 63 6f 6c  ECT ALL 92 + col
353f0 32 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20  2 + + tab0.col2 
35400 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
35410 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 32 35  0..----..158..25
35420 36 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  6..94....query I
35430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35440 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
35450 20 2a 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f   * - ( + cor0.co
35460 6c 32 20 29 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  l2 ) * col2 + co
35470 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  l0 * - col2 AS c
35480 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
35490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32   cor0..----..-22
354a0 37 38 38 0d 0a 2d 32 37 35 35 30 0d 0a 2d 34 31  788..-27550..-41
354b0 39 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  912....query I r
354c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
354d0 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  LL + cor0.col0 +
354e0 20 28 20 2b 20 38 33 20 29 20 2a 20 63 6f 6c 32   ( + 83 ) * col2
354f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
35500 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 33 36 0d 0a  r0..----..2236..
35510 32 32 34 38 0d 0a 33 32 33 33 0d 0a 0d 0a 73 6b  2248..3233....sk
35520 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
35530 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
35540 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
35550 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
35560 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
35570 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
35580 20 36 33 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   63 col1 FROM ta
35590 62 30 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b0, tab0 cor0, t
355a0 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
355b0 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
355c0 68 69 6e 67 20 74 6f 20 66 63 30 62 35 33 33 63  hing to fc0b533c
355d0 32 37 37 33 61 30 61 38 30 32 65 31 66 63 38 33  2773a0a802e1fc83
355e0 31 37 64 63 65 62 66 32 0d 0a 0d 0a 71 75 65 72  17dcebf2....quer
355f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35600 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a  ECT ALL - col2 *
35610 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30   + col1 + + col0
35620 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
35630 0d 0a 2d 31 31 36 38 0d 0a 2d 31 34 30 31 0d 0a  ..-1168..-1401..
35640 2d 35 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -506....skipif p
35650 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
35660 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
35670 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
35680 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
35690 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
356a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
356b0 54 20 39 38 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  T 98 + col2 * + 
356c0 74 61 62 32 2e 63 6f 6c 31 20 63 6f 6c 31 20 46  tab2.col1 col1 F
356d0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
356e0 31 36 33 32 0d 0a 37 34 34 0d 0a 39 33 35 0d 0a  1632..744..935..
356f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35700 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35710 43 54 20 33 39 20 2b 20 63 6f 6c 32 20 41 53 20  CT 39 + col2 AS 
35720 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
35730 2d 2d 2d 2d 0d 0a 31 33 35 0d 0a 39 33 0d 0a 39  ----..135..93..9
35740 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
35750 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
35760 6f 6c 30 20 2a 20 28 20 74 61 62 31 2e 63 6f 6c  ol0 * ( tab1.col
35770 32 20 29 20 2b 20 2d 20 74 61 62 31 2e 63 6f 6c  2 ) + - tab1.col
35780 30 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  0 * col1 FROM ta
35790 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 30 30 38 0d 0a  b1..----..3008..
357a0 36 36 34 30 0d 0a 38 34 0d 0a 0d 0a 71 75 65 72  6640..84....quer
357b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
357c0 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
357d0 2a 20 2b 20 38 38 20 46 52 4f 4d 20 74 61 62 31  * + 88 FROM tab1
357e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
357f0 34 37 35 32 0d 0a 35 30 31 36 0d 0a 38 34 34 38  4752..5016..8448
35800 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35810 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
35820 2b 20 63 6f 6c 31 20 2a 20 31 32 20 46 52 4f 4d  + col1 * 12 FROM
35830 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
35840 2d 2d 2d 0d 0a 31 30 33 32 0d 0a 31 30 39 32 0d  ---..1032..1092.
35850 0a 31 31 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1164....skipif 
35860 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
35870 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
35880 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
35890 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
358a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
358b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
358c0 6c 31 20 2a 20 2d 20 39 30 20 2b 20 2d 20 33 30  l1 * - 90 + - 30
358d0 20 2b 20 63 6f 6c 30 20 2a 20 36 30 20 63 6f 6c   + col0 * 60 col
358e0 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
358f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 30 30  or0..----..-2400
35900 0d 0a 2d 36 36 30 0d 0a 33 31 38 30 0d 0a 0d 0a  ..-660..3180....
35910 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
35920 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
35930 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
35940 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
35950 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 35  wsort label-1515
35960 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
35970 39 37 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53 54  97 - col1 * CAST
35980 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  ( col1 AS SIGNED
35990 20 29 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63   ) DIV col1 AS c
359a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
359b0 2d 2d 2d 0d 0a 32 32 34 32 0d 0a 33 32 39 38 0d  ---..2242..3298.
359c0 0a 38 35 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8542....skipif 
359d0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
359e0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
359f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
35a00 31 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  15..SELECT col0 
35a10 2a 20 39 37 20 2d 20 63 6f 6c 31 20 2a 20 43 41  * 97 - col1 * CA
35a20 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54  ST ( col1 AS INT
35a30 45 47 45 52 20 29 20 2f 20 63 6f 6c 31 20 41 53  EGER ) / col1 AS
35a40 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
35a50 0a 2d 2d 2d 2d 0d 0a 32 32 34 32 0d 0a 33 32 39  .----..2242..329
35a60 38 0d 0a 38 35 34 32 0d 0a 0d 0a 71 75 65 72 79  8..8542....query
35a70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35a80 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
35a90 2d 20 63 6f 6c 32 20 29 20 2d 20 2d 20 74 61 62  - col2 ) - - tab
35aa0 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  1.col2 FROM tab1
35ab0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31 34  ..----..108..114
35ac0 0d 0a 31 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..192....onlyif 
35ad0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
35ae0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
35af0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
35b00 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
35b10 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
35b20 6c 2d 31 35 31 37 0d 0a 53 45 4c 45 43 54 20 2b  l-1517..SELECT +
35b30 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
35b40 49 47 4e 45 44 20 29 20 2b 20 35 35 20 2d 20 2d  IGNED ) + 55 - -
35b50 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 28   tab2.col2 * + (
35b60 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20   col0 ) AS col2 
35b70 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
35b80 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
35b90 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
35ba0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
35bb0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
35bc0 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 37 0d 0a  ort label-1517..
35bd0 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20  SELECT + CAST ( 
35be0 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
35bf0 29 20 2b 20 35 35 20 2d 20 2d 20 74 61 62 32 2e  ) + 55 - - tab2.
35c00 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 30 20  col2 * + ( col0 
35c10 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
35c20 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab2..----..NULL.
35c30 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
35c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35c50 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35c60 32 33 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  23 - col0 FROM t
35c70 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  ab0..----..-1..-
35c80 31 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79  12..-66....query
35c90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35ca0 43 54 20 2d 20 33 36 20 2b 20 2b 20 63 6f 6c 32  CT - 36 + + col2
35cb0 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 72 30   * col0 - - cor0
35cc0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
35cd0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
35ce0 0a 2d 2d 2d 2d 0d 0a 31 36 30 0d 0a 32 30 37 30  .----..160..2070
35cf0 0d 0a 33 30 34 35 0d 0a 0d 0a 71 75 65 72 79 20  ..3045....query 
35d00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35d10 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
35d20 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  0 * - cor0.col0 
35d30 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * - col2 FROM ta
35d40 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
35d50 0d 0a 31 33 32 33 0d 0a 31 35 38 31 38 34 0d 0a  ..1323..158184..
35d60 32 33 37 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20  237158....query 
35d70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35d80 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63  T DISTINCT - ( c
35d90 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b  ol2 ) * + col2 +
35da0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
35db0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 35 0d 0a 2d 35  .----..-1365..-5
35dc0 39 38 0d 0a 2d 37 32 32 0d 0a 0d 0a 71 75 65 72  98..-722....quer
35dd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35de0 45 43 54 20 44 49 53 54 49 4e 43 54 20 39 35 20  ECT DISTINCT 95 
35df0 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
35e00 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 36 34  b2..----..36..64
35e10 0d 0a 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..78....onlyif m
35e20 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
35e30 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
35e40 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
35e50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35e60 62 65 6c 2d 31 35 32 33 0d 0a 53 45 4c 45 43 54  bel-1523..SELECT
35e70 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f   ALL - col1 * co
35e80 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  l0 + - col2 + co
35e90 6c 30 20 44 49 56 20 2d 20 74 61 62 30 2e 63 6f  l0 DIV - tab0.co
35ea0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
35eb0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 39  tab0..----..-209
35ec0 38 0d 0a 2d 33 33 39 37 0d 0a 2d 38 31 38 32 0d  8..-3397..-8182.
35ed0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
35ee0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
35ef0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35f00 74 20 6c 61 62 65 6c 2d 31 35 32 33 0d 0a 53 45  t label-1523..SE
35f10 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
35f20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20  * col0 + - col2 
35f30 2b 20 63 6f 6c 30 20 2f 20 2d 20 74 61 62 30 2e  + col0 / - tab0.
35f40 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
35f50 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
35f60 30 39 38 0d 0a 2d 33 33 39 37 0d 0a 2d 38 31 38  098..-3397..-818
35f70 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
35f80 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
35f90 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
35fa0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
35fb0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
35fc0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
35fd0 32 34 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  24..SELECT CAST(
35fe0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
35ff0 29 20 2b 20 34 20 2b 20 63 6f 6c 31 20 2a 20 74  ) + 4 + col1 * t
36000 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  ab2.col2 AS col2
36010 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
36020 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
36030 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
36040 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
36050 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
36060 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32 34 0d  sort label-1524.
36070 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e  .SELECT CAST ( N
36080 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
36090 20 2b 20 34 20 2b 20 63 6f 6c 31 20 2a 20 74 61   + 4 + col1 * ta
360a0 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20  b2.col2 AS col2 
360b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
360c0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
360d0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
360e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
360f0 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b  TINCT - col0 * +
36100 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f   col2 + col0 FRO
36110 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
36120 2d 2d 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d 31 39 35  ----..-182..-195
36130 30 0d 0a 2d 32 39 32 33 0d 0a 0d 0a 71 75 65 72  0..-2923....quer
36140 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36150 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
36160 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( - col1 ) * co
36170 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
36180 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
36190 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37  --..1040..640..7
361a0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
361b0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
361c0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
361d0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
361e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
361f0 2d 31 35 32 37 0d 0a 53 45 4c 45 43 54 20 41 4c  -1527..SELECT AL
36200 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  L - - cor0.col0 
36210 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  DIV - col1 FROM 
36220 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
36230 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 73 6b  .-6..-6..0....sk
36240 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
36250 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
36260 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
36270 65 6c 2d 31 35 32 37 0d 0a 53 45 4c 45 43 54 20  el-1527..SELECT 
36280 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL - - cor0.col
36290 30 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  0 / - col1 FROM 
362a0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
362b0 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 71 75  .-6..-6..0....qu
362c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
362d0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
362e0 20 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 30   + col1 * ( col0
362f0 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) * + col1 FROM
36300 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36310 2d 2d 2d 0d 0a 31 37 37 35 32 38 0d 0a 33 32 39  ---..177528..329
36320 33 35 30 0d 0a 37 33 37 30 39 38 0d 0a 0d 0a 71  350..737098....q
36330 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36340 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36350 2d 20 2b 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20  - + col0 - col0 
36360 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
36370 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
36380 32 38 0d 0a 2d 31 36 30 0d 0a 2d 36 0d 0a 0d 0a  28..-160..-6....
36390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
363a0 0a 53 45 4c 45 43 54 20 2d 20 31 36 20 2a 20 2d  .SELECT - 16 * -
363b0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63   cor0.col2 + + c
363c0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
363d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
363e0 2d 2d 2d 0d 0a 31 34 30 31 0d 0a 35 31 0d 0a 35  ---..1401..51..5
363f0 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  52....skipif pos
36400 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
36410 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
36420 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
36430 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
36440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36450 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36460 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  - col0 * cor0.co
36470 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
36480 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
36490 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39  .-35..-7298..-79
364a0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
364b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
364c0 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 28  ol2 - + col0 * (
364d0 20 31 37 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 28   17 * col2 + - (
364e0 20 2b 20 28 20 63 6f 6c 30 20 29 20 29 20 29 20   + ( col0 ) ) ) 
364f0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
36500 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
36510 0a 2d 31 31 36 30 36 33 0d 0a 2d 31 32 38 35 35  .-116063..-12855
36520 0d 0a 36 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..631....query I
36530 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36540 20 2b 20 2b 20 39 34 20 2a 20 2b 20 63 6f 6c 31   + + 94 * + col1
36550 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63   + col0 * cor0.c
36560 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
36570 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 31 30   cor0..----..310
36580 33 0d 0a 34 36 30 30 0d 0a 37 35 37 34 0d 0a 0d  3..4600..7574...
36590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
365a0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
365b0 2a 20 32 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  * 20 FROM tab2..
365c0 2d 2d 2d 2d 0d 0a 2d 31 31 38 30 0d 0a 2d 33 34  ----..-1180..-34
365d0 30 0d 0a 2d 36 32 30 0d 0a 0d 0a 71 75 65 72 79  0..-620....query
365e0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
365f0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
36600 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col2 * col0 * - 
36610 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 30 20  ( col2 ) + col0 
36620 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
36630 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 36 30 0d 0a  0..----..26160..
36640 35 39 38 35 32 35 0d 0a 37 30 0d 0a 0d 0a 71 75  598525..70....qu
36650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36660 45 4c 45 43 54 20 2d 20 39 20 2b 20 63 6f 6c 31  ELECT - 9 + col1
36670 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
36680 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
36690 2d 0d 0a 2d 31 30 36 0d 0a 2d 32 38 34 37 0d 0a  -..-106..-2847..
366a0 2d 37 34 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -7471....query I
366b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
366c0 20 41 4c 4c 20 2b 20 33 20 2b 20 2d 20 63 6f 6c   ALL + 3 + - col
366d0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
366e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a  or0..----..-21..
366f0 2d 33 32 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72  -32..-86....quer
36700 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36710 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
36720 20 31 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   12 FROM tab1..-
36730 2d 2d 2d 0d 0a 31 32 30 0d 0a 31 35 36 0d 0a 33  ---..120..156..3
36740 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  12....onlyif mys
36750 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
36760 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
36770 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
36780 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
36790 6c 2d 31 35 33 39 0d 0a 53 45 4c 45 43 54 20 2d  l-1539..SELECT -
367a0 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 44 49 56   col2 + col1 DIV
367b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
367c0 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 36 0d  .----..-23..-26.
367d0 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-38....skipif m
367e0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
367f0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36800 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33  owsort label-153
36810 39 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  9..SELECT - col2
36820 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 46   + col1 / col0 F
36830 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
36840 2d 32 33 0d 0a 2d 32 36 0d 0a 2d 33 38 0d 0a 0d  -23..-26..-38...
36850 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
36860 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
36870 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
36880 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
36890 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34  owsort label-154
368a0 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  0..SELECT - col2
368b0 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   DIV col0 + col2
368c0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
368d0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 32 36  b2..----..24..26
368e0 0d 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..38....skipif m
368f0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36900 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36910 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34  owsort label-154
36920 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  0..SELECT - col2
36930 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41   / col0 + col2 A
36940 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
36950 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 32 36 0d 0a  ..----..24..26..
36960 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
36970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 20  wsort..SELECT 4 
36980 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
36990 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
369a0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
369b0 68 61 73 68 69 6e 67 20 74 6f 20 36 66 65 63 39  hashing to 6fec9
369c0 36 35 62 36 30 62 39 38 38 35 63 34 61 66 37 33  65b60b9885c4af73
369d0 65 38 35 34 32 32 63 66 64 39 62 0d 0a 0d 0a 71  e85422cfd9b....q
369e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
369f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
36a00 2d 20 2b 20 63 6f 6c 31 20 2a 20 35 35 20 41 53  - + col1 * 55 AS
36a10 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
36a20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
36a30 34 37 33 30 0d 0a 2d 35 30 30 35 0d 0a 2d 35 33  4730..-5005..-53
36a40 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
36a50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
36a60 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
36a70 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20  ( col2 + col1 * 
36a80 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32  col1 ) FROM tab2
36a90 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36aa0 2d 31 32 34 32 36 0d 0a 2d 32 36 36 37 36 0d 0a  -12426..-26676..
36ab0 2d 39 31 31 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  -91182....onlyif
36ac0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
36ad0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
36ae0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
36af0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
36b00 6c 61 62 65 6c 2d 31 35 34 34 0d 0a 53 45 4c 45  label-1544..SELE
36b10 43 54 20 41 4c 4c 20 2b 20 2b 20 33 38 20 44 49  CT ALL + + 38 DI
36b20 56 20 34 37 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  V 47 + cor0.col1
36b30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
36b40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33  r0..----..10..13
36b50 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..26....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 34  owsort label-154
36b90 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  4..SELECT ALL + 
36ba0 2b 20 33 38 20 2f 20 34 37 20 2b 20 63 6f 72 30  + 38 / 47 + cor0
36bb0 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20  .col1 FROM tab1 
36bc0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
36bd0 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c  0..13..26....onl
36be0 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
36bf0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
36c00 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
36c10 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
36c20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
36c30 6c 61 62 65 6c 2d 31 35 34 35 0d 0a 53 45 4c 45  label-1545..SELE
36c40 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
36c50 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49  ST( NULL AS DECI
36c60 4d 41 4c 20 29 20 2d 20 28 20 63 6f 6c 31 20 29  MAL ) - ( col1 )
36c70 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
36c80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36c90 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
36ca0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
36cb0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
36cc0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36cd0 35 34 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  545..SELECT DIST
36ce0 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55  INCT + CAST ( NU
36cf0 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2d 20 28  LL AS REAL ) - (
36d00 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20   col1 ) AS col2 
36d10 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
36d20 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
36d30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36d40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
36d50 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  T - col2 * cor0.
36d60 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col0 + col2 FROM
36d70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36d80 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37 32 31 36 0d  ---..-34..-7216.
36d90 0a 2d 37 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-759....skipif 
36da0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
36db0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
36dc0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
36dd0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
36de0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36df0 74 0d 0a 53 45 4c 45 43 54 20 35 37 20 2b 20 2b  t..SELECT 57 + +
36e00 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 63   col0 * col0 * c
36e10 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52  or0.col2 col2 FR
36e20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
36e30 0a 2d 2d 2d 2d 0d 0a 31 32 38 32 0d 0a 31 39 30  .----..1282..190
36e40 36 35 0d 0a 36 34 39 35 37 39 0d 0a 0d 0a 71 75  65..649579....qu
36e50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36e60 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
36e70 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63   col2 + col2 + c
36e80 6f 6c 31 20 2a 20 2b 20 33 33 20 46 52 4f 4d 20  ol1 * + 33 FROM 
36e90 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36ea0 2d 2d 0d 0a 32 38 33 38 0d 0a 33 30 30 33 0d 0a  --..2838..3003..
36eb0 33 32 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3201....query I 
36ec0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36ed0 41 4c 4c 20 2d 20 28 20 28 20 63 6f 6c 32 20 29  ALL - ( ( col2 )
36ee0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
36ef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
36f00 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72  -33..-82....quer
36f10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36f20 45 43 54 20 2b 20 33 20 2d 20 63 6f 6c 32 20 46  ECT + 3 - col2 F
36f30 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
36f40 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 34  ..----..-23..-24
36f50 0d 0a 2d 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-35....query I
36f60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36f70 20 2b 20 63 6f 6c 31 20 2b 20 39 32 20 2d 20 63   + col1 + 92 - c
36f80 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
36f90 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
36fa0 0d 0a 31 31 36 0d 0a 33 30 0d 0a 37 33 0d 0a 0d  ..116..30..73...
36fb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36fc0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
36fd0 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  1 + col2 * - col
36fe0 31 20 2a 20 2d 20 28 20 36 30 20 2b 20 2b 20 63  1 * - ( 60 + + c
36ff0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
37000 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
37010 2d 2d 0d 0a 31 38 32 36 30 35 0d 0a 34 39 37 35  --..182605..4975
37020 39 0d 0a 37 36 31 39 38 0d 0a 0d 0a 71 75 65 72  9..76198....quer
37030 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37040 45 43 54 20 2d 20 2d 20 36 30 20 2b 20 63 6f 72  ECT - - 60 + cor
37050 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  0.col0 FROM tab2
37060 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37070 31 33 38 0d 0a 31 33 39 0d 0a 36 37 0d 0a 0d 0a  138..139..67....
37080 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
37090 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
370a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
370b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
370c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 34  wsort label-1554
370d0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 36  ..SELECT - ( - 6
370e0 30 20 29 20 2b 20 63 6f 6c 32 20 44 49 56 20 36  0 ) + col2 DIV 6
370f0 37 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  7 - col2 AS col2
37100 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
37110 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 32 37 0d 0a  .----..-21..27..
37120 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  59....skipif mys
37130 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
37140 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
37150 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 35 34 0d  sort label-1554.
37160 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 36 30  .SELECT - ( - 60
37170 20 29 20 2b 20 63 6f 6c 32 20 2f 20 36 37 20 2d   ) + col2 / 67 -
37180 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
37190 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
371a0 2d 2d 0d 0a 2d 32 31 0d 0a 32 37 0d 0a 35 39 0d  --..-21..27..59.
371b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
371c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
371d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
371e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
371f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37200 35 35 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  555..SELECT + co
37210 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 31  l2 DIV cor0.col1
37220 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
37230 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
37240 0d 0a 35 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66  ..5..7....skipif
37250 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
37260 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
37270 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37280 35 35 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  555..SELECT + co
37290 6c 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 41  l2 / cor0.col1 A
372a0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
372b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   cor0..----..2..
372c0 35 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5..7....query I 
372d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
372e0 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 31 34 20  DISTINCT + + 14 
372f0 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
37300 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
37310 35 30 0d 0a 2d 36 36 0d 0a 31 31 0d 0a 0d 0a 73  50..-66..11....s
37320 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
37330 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
37340 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
37350 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
37360 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
37370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37380 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63  ALL + + col0 * c
37390 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c  ol1 * + col0 col
373a0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
373b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a  or0..----..234..
373c0 34 30 39 36 30 0d 0a 38 33 32 30 30 0d 0a 0d 0a  40960..83200....
373d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
373e0 0a 53 45 4c 45 43 54 20 2b 20 35 31 20 2b 20 2d  .SELECT + 51 + -
373f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
37400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 0d  cor0..----..-31.
37410 0a 31 38 0d 0a 35 30 0d 0a 0d 0a 71 75 65 72 79  .18..50....query
37420 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37430 43 54 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63  CT col2 * cor0.c
37440 6f 6c 30 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31  ol0 + + ( + col1
37450 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
37460 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
37470 2d 2d 0d 0a 31 38 38 0d 0a 33 36 35 38 0d 0a 37  --..188..3658..7
37480 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  693....query I r
37490 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
374a0 49 53 54 49 4e 43 54 20 2b 20 36 36 20 2a 20 63  ISTINCT + 66 * c
374b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
374c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   cor0..----..112
374d0 32 0d 0a 32 30 34 36 0d 0a 33 38 39 34 0d 0a 0d  2..2046..3894...
374e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
374f0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
37500 2b 20 63 6f 6c 32 20 2b 20 2d 20 34 37 20 2a 20  + col2 + - 47 * 
37510 2d 20 31 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 14 AS col1 FRO
37520 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
37530 2d 2d 2d 2d 0d 0a 36 35 31 0d 0a 36 37 34 0d 0a  ----..651..674..
37540 37 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  709....query I r
37550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
37560 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a  ISTINCT - col1 *
37570 20 2b 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 31   + col1 + ( col1
37580 20 29 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) + col1 FROM t
37590 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
375a0 2d 0d 0a 2d 31 34 33 0d 0a 2d 36 32 34 0d 0a 2d  -..-143..-624..-
375b0 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  80....onlyif mys
375c0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
375d0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
375e0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
375f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
37600 6c 2d 31 35 36 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1563..SELECT +
37610 20 63 6f 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31   col0 DIV - col1
37620 20 2b 20 34 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + 4 col2 FROM t
37630 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
37640 2d 0d 0a 2d 32 0d 0a 2d 32 0d 0a 34 0d 0a 0d 0a  -..-2..-2..4....
37650 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
37660 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
37670 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
37680 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
37690 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
376a0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
376b0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
376c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
376d0 36 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  63..SELECT + col
376e0 30 20 2f 20 2d 20 63 6f 6c 31 20 2b 20 34 20 63  0 / - col1 + 4 c
376f0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
37700 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d   cor0..----..-2.
37710 0a 2d 32 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20  .-2..4....query 
37720 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37730 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33 30 20  T DISTINCT + 30 
37740 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 39 30 20  * - col1 + - 90 
37750 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37760 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 32 30 0d 0a  0..----..-1020..
37770 2d 31 38 36 30 0d 0a 2d 36 30 30 0d 0a 0d 0a 71  -1860..-600....q
37780 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
37790 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20  SELECT - + col1 
377a0 2a 20 2d 20 38 35 20 41 53 20 63 6f 6c 32 20 46  * - 85 AS col2 F
377b0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
377c0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 35 0d 0a 32 36  ..----..1445..26
377d0 33 35 0d 0a 35 30 31 35 0d 0a 0d 0a 73 6b 69 70  35..5015....skip
377e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
377f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
37800 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37810 43 54 20 2d 20 63 6f 6c 32 20 2a 20 43 41 53 54  CT - col2 * CAST
37820 20 28 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20   ( col2 AS REAL 
37830 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
37840 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
37850 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39  -2916..-3249..-9
37860 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  216....query I r
37870 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
37880 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 31 20 2b 20  LL + col0 * 1 + 
37890 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  + col2 + + col0 
378a0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
378b0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39  0..----..182..19
378c0 36 0d 0a 34 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  6..41....onlyif 
378d0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
378e0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
378f0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
37900 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
37910 61 62 65 6c 2d 31 35 36 38 0d 0a 53 45 4c 45 43  abel-1568..SELEC
37920 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 32 20  T ALL tab2.col2 
37930 44 49 56 20 2b 20 34 31 20 63 6f 6c 31 20 46 52  DIV + 41 col1 FR
37940 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
37950 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
37960 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
37970 20 38 62 37 35 31 33 36 62 32 62 35 31 63 37 37   8b75136b2b51c77
37980 33 34 35 63 30 33 38 30 34 65 63 31 63 64 61 35  345c03804ec1cda5
37990 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  c....skipif post
379a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
379b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
379c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
379d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
379e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
379f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
37a00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37a10 65 6c 2d 31 35 36 38 0d 0a 53 45 4c 45 43 54 20  el-1568..SELECT 
37a20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 32 20 2f 20  ALL tab2.col2 / 
37a30 2b 20 34 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74  + 41 col1 FROM t
37a40 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
37a50 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
37a60 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62 37  s hashing to 8b7
37a70 35 31 33 36 62 32 62 35 31 63 37 37 33 34 35 63  5136b2b51c77345c
37a80 30 33 38 30 34 65 63 31 63 64 61 35 63 0d 0a 0d  03804ec1cda5c...
37a90 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
37aa0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
37ab0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
37ac0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
37ad0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
37ae0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37af0 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 32 31 20  T + + col2 * 21 
37b00 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
37b10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
37b20 32 32 0d 0a 32 31 0d 0a 36 39 33 0d 0a 0d 0a 6f  22..21..693....o
37b30 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
37b40 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
37b50 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
37b60 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
37b70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 30 0d  sort label-1570.
37b80 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30  .SELECT + + cor0
37b90 2e 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32  .col1 DIV - col2
37ba0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
37bb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
37bc0 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
37bd0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
37be0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
37bf0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
37c00 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
37c10 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
37c20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
37c30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37c40 74 20 6c 61 62 65 6c 2d 31 35 37 30 0d 0a 53 45  t label-1570..SE
37c50 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  LECT + + cor0.co
37c60 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 63 6f 6c 32  l1 / - col2 col2
37c70 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
37c80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
37c90 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
37ca0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
37cb0 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
37cc0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
37cd0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
37ce0 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d 0a 37 39  -..1225..576..79
37cf0 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  21....query I ro
37d00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 39  wsort..SELECT 99
37d10 20 2b 20 63 6f 6c 31 20 2a 20 28 20 39 35 20 29   + col1 * ( 95 )
37d20 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
37d30 0d 0a 38 32 36 39 0d 0a 38 37 34 34 0d 0a 39 33  ..8269..8744..93
37d40 31 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  14....onlyif mys
37d50 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
37d60 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
37d70 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
37d80 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
37d90 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
37da0 35 37 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  573..SELECT col2
37db0 20 2a 20 2b 20 43 41 53 54 28 20 63 6f 6c 31 20   * + CAST( col1 
37dc0 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20  AS SIGNED ) + - 
37dd0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
37de0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
37df0 2d 0d 0a 32 38 31 34 0d 0a 36 32 0d 0a 37 33 37  -..2814..62..737
37e00 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
37e10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
37e20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
37e30 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 33 0d 0a  ort label-1573..
37e40 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b 20  SELECT col2 * + 
37e50 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49  CAST ( col1 AS I
37e60 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c  NTEGER ) + - col
37e70 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
37e80 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
37e90 32 38 31 34 0d 0a 36 32 0d 0a 37 33 37 33 0d 0a  2814..62..7373..
37ea0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37eb0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
37ec0 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  col2 * col2 * - 
37ed0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
37ee0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
37ef0 2d 2d 2d 2d 0d 0a 31 35 37 34 36 34 0d 0a 31 38  ----..157464..18
37f00 35 31 39 33 0d 0a 38 38 34 37 33 36 0d 0a 0d 0a  5193..884736....
37f10 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
37f20 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
37f30 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
37f40 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
37f50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 35  wsort label-1575
37f60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
37f70 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e  T - col1 + cor0.
37f80 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 63 6f  col1 DIV col2 co
37f90 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
37fa0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d  cor0..----..-84.
37fb0 0a 2d 39 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  .-90..0....skipi
37fc0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
37fd0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
37fe0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
37ff0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
38000 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
38010 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
38020 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
38030 72 74 20 6c 61 62 65 6c 2d 31 35 37 35 0d 0a 53  rt label-1575..S
38040 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
38050 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
38060 31 20 2f 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  1 / col2 col1 FR
38070 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
38080 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39 30 0d  .----..-84..-90.
38090 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
380a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
380b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
380c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
380d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
380e0 6c 2d 31 35 37 36 0d 0a 53 45 4c 45 43 54 20 2d  l-1576..SELECT -
380f0 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f   - col2 DIV + co
38100 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
38110 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
38120 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a  --..0..1..18....
38130 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
38140 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
38150 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
38160 61 62 65 6c 2d 31 35 37 36 0d 0a 53 45 4c 45 43  abel-1576..SELEC
38170 54 20 2d 20 2d 20 63 6f 6c 32 20 2f 20 2b 20 63  T - - col2 / + c
38180 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
38190 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
381a0 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d  ---..0..1..18...
381b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
381c0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 31 39 20  ..SELECT - ( 19 
381d0 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
381e0 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
381f0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
38200 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 33 39  s hashing to 339
38210 63 39 64 36 32 31 34 33 62 66 32 66 37 35 36 36  c9d62143bf2f7566
38220 62 38 39 61 31 62 35 36 65 65 65 62 34 0d 0a 0d  b89a1b56eeeb4...
38230 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38240 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 63  ..SELECT - ( - c
38250 6f 6c 32 20 29 20 2d 20 2b 20 28 20 28 20 63 6f  ol2 ) - + ( ( co
38260 6c 30 20 29 20 29 20 2a 20 63 6f 6c 30 20 2a 20  l0 ) ) * col0 * 
38270 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
38280 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
38290 32 38 38 0d 0a 34 31 30 31 37 0d 0a 38 33 32 39  288..41017..8329
382a0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
382b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
382c0 20 37 39 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63   79 * + col1 + c
382d0 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  or0.col2 * col2 
382e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
382f0 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  0 cor0..----..13
38300 39 31 33 0d 0a 37 36 36 34 0d 0a 37 38 38 33 0d  913..7664..7883.
38310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
38320 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33  rt..SELECT + - 3
38330 39 20 2a 20 39 36 20 46 52 4f 4d 20 74 61 62 30  9 * 96 FROM tab0
38340 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab1 cor0..---
38350 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
38360 69 6e 67 20 74 6f 20 31 37 32 38 66 31 39 33 34  ing to 1728f1934
38370 65 64 65 36 37 38 66 34 62 37 63 39 64 35 66 34  ede678f4b7c9d5f4
38380 34 61 63 66 31 66 34 0d 0a 0d 0a 6f 6e 6c 79 69  4acf1f4....onlyi
38390 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
383a0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
383b0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
383c0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
383d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
383e0 62 65 6c 2d 31 35 38 31 0d 0a 53 45 4c 45 43 54  bel-1581..SELECT
383f0 20 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53   CAST( col1 AS S
38400 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 41  IGNED ) * col1 A
38410 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
38420 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32  ..----..7396..82
38430 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a 73 6b 69 70  81..9409....skip
38440 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
38450 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
38460 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
38470 2d 31 35 38 31 0d 0a 53 45 4c 45 43 54 20 43 41  -1581..SELECT CA
38480 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54  ST ( col1 AS INT
38490 45 47 45 52 20 29 20 2a 20 63 6f 6c 31 20 41 53  EGER ) * col1 AS
384a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
384b0 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38  .----..7396..828
384c0 31 0d 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79  1..9409....query
384d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
384e0 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
384f0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
38500 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
38510 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
38520 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
38530 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
38540 30 39 64 38 61 39 31 32 64 65 31 62 38 61 62 37  09d8a912de1b8ab7
38550 36 32 65 35 66 66 62 65 30 32 38 63 65 39 39 65  62e5ffbe028ce99e
38560 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
38570 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
38580 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
38590 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
385a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
385b0 31 35 38 33 0d 0a 53 45 4c 45 43 54 20 63 6f 72  1583..SELECT cor
385c0 30 2e 63 6f 6c 32 20 44 49 56 20 34 34 20 46 52  0.col2 DIV 44 FR
385d0 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
385e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
385f0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
38600 20 31 34 66 63 66 61 36 63 31 31 31 39 38 38 39   14fcfa6c1119889
38610 33 30 37 33 30 34 39 64 39 34 32 36 32 38 33 32  3073049d94262832
38620 63 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  c....skipif mysq
38630 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
38640 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
38650 6f 72 74 20 6c 61 62 65 6c 2d 31 35 38 33 0d 0a  ort label-1583..
38660 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32  SELECT cor0.col2
38670 20 2f 20 34 34 20 46 52 4f 4d 20 74 61 62 32 2c   / 44 FROM tab2,
38680 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
38690 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
386a0 73 68 69 6e 67 20 74 6f 20 31 34 66 63 66 61 36  shing to 14fcfa6
386b0 63 31 31 31 39 38 38 39 33 30 37 33 30 34 39 64  c11198893073049d
386c0 39 34 32 36 32 38 33 32 63 0d 0a 0d 0a 71 75 65  94262832c....que
386d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
386e0 4c 45 43 54 20 41 4c 4c 20 63 6f 72 31 2e 63 6f  LECT ALL cor1.co
386f0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
38700 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
38710 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
38720 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
38730 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 37 38  s hashing to 778
38740 36 37 31 38 62 64 38 30 34 32 30 32 32 35 33 37  6718bd8042022537
38750 33 37 38 64 34 30 65 63 38 37 34 37 35 0d 0a 0d  378d40ec87475...
38760 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38770 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38780 54 20 2d 20 38 39 20 2a 20 2b 20 63 6f 6c 32 20  T - 89 * + col2 
38790 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
387a0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 38 30 36 0d 0a  1..----..-4806..
387b0 2d 35 30 37 33 0d 0a 2d 38 35 34 34 0d 0a 0d 0a  -5073..-8544....
387c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
387d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32  .SELECT ALL tab2
387e0 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52  .col2 AS col0 FR
387f0 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
38800 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31   cor0, tab0 cor1
38810 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
38820 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 30 66  s hashing to 40f
38830 64 38 63 63 30 64 65 39 32 65 61 36 38 64 37 33  d8cc0de92ea68d73
38840 36 33 34 63 32 64 38 66 37 35 62 66 35 0d 0a 0d  634c2d8f75bf5...
38850 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38860 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
38870 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  T - col2 + col0 
38880 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52  - col0 * col0 FR
38890 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
388a0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 31 0d 0a 2d 35  .----..-1191..-5
388b0 38 35 0d 0a 2d 37 39 31 34 0d 0a 0d 0a 6f 6e 6c  85..-7914....onl
388c0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
388d0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
388e0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
388f0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
38900 72 74 20 6c 61 62 65 6c 2d 31 35 38 38 0d 0a 53  rt label-1588..S
38910 45 4c 45 43 54 20 2b 20 33 37 20 2b 20 63 6f 6c  ELECT + 37 + col
38920 32 20 44 49 56 20 2d 20 36 20 46 52 4f 4d 20 74  2 DIV - 6 FROM t
38930 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
38940 2d 0d 0a 32 31 0d 0a 32 38 0d 0a 32 38 0d 0a 0d  -..21..28..28...
38950 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
38960 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
38970 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
38980 6c 61 62 65 6c 2d 31 35 38 38 0d 0a 53 45 4c 45  label-1588..SELE
38990 43 54 20 2b 20 33 37 20 2b 20 63 6f 6c 32 20 2f  CT + 37 + col2 /
389a0 20 2d 20 36 20 46 52 4f 4d 20 74 61 62 31 20 41   - 6 FROM tab1 A
389b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
389c0 0d 0a 32 38 0d 0a 32 38 0d 0a 0d 0a 73 6b 69 70  ..28..28....skip
389d0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
389e0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
389f0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
38a00 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
38a10 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
38a20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
38a30 54 49 4e 43 54 20 28 20 2d 20 63 6f 6c 30 20 29  TINCT ( - col0 )
38a40 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 35 38   * - col1 * - 58
38a50 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46   + + col0 col0 F
38a60 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
38a70 2d 31 32 35 37 39 0d 0a 2d 32 36 36 38 33 38 0d  -12579..-266838.
38a80 0a 2d 37 37 38 31 35 0d 0a 0d 0a 71 75 65 72 79  .-77815....query
38a90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38aa0 43 54 20 63 6f 6c 30 20 2a 20 31 37 20 41 53 20  CT col0 * 17 AS 
38ab0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
38ac0 2d 2d 2d 2d 0d 0a 31 35 31 33 0d 0a 34 30 38 0d  ----..1513..408.
38ad0 0a 35 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .595....skipif p
38ae0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
38af0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
38b00 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
38b10 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
38b20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38b30 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c  ..SELECT - ( col
38b40 32 20 29 20 2a 20 63 6f 6c 30 20 2d 20 2d 20 63  2 ) * col0 - - c
38b50 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol0 col0 FROM ta
38b60 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 0d 0a  b2..----..-182..
38b70 2d 31 39 35 30 0d 0a 2d 32 39 32 33 0d 0a 0d 0a  -1950..-2923....
38b80 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
38b90 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
38ba0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
38bb0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
38bc0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 39 32  wsort label-1592
38bd0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e  ..SELECT - cor1.
38be0 63 6f 6c 31 20 44 49 56 20 32 35 20 46 52 4f 4d  col1 DIV 25 FROM
38bf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
38c00 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53  OSS JOIN tab2 AS
38c10 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
38c20 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
38c30 20 63 63 64 37 37 65 32 37 37 30 64 35 61 38 33   ccd77e2770d5a83
38c40 34 65 35 39 63 31 36 37 34 64 65 66 61 38 38 66  4e59c1674defa88f
38c50 61 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d