sqllogictest
Hex Artifact Content
Not logged in

Artifact 915d02ee0a0466be7666f48f4312a4b1a5e420df:


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 41 4c 4c 20 35  rt..SELECT ALL 5
02e0: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
02f0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35  ab2..----..52..5
0300: 32 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  2..52....query I
0310: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0320: 20 28 20 74 61 62 32 2e 63 6f 6c 32 20 29 20 2a   ( tab2.col2 ) *
0330: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
0340: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
0350: 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d  .1534..646..837.
0360: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
0370: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
0380: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
0390: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
03a0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
03b0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
03c0: 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  + col2 + + col2 
03d0: 44 49 56 20 2d 20 32 20 46 52 4f 4d 20 74 61 62  DIV - 2 FROM tab
03e0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  1 cor0..----..-3
03f0: 32 0d 0a 2d 33 35 0d 0a 32 34 0d 0a 0d 0a 73 6b  2..-35..24....sk
0400: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
0410: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
0420: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
0430: 65 6c 2d 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63  el-2..SELECT - c
0440: 6f 6c 30 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63  ol0 + col2 + + c
0450: 6f 6c 32 20 2f 20 2d 20 32 20 46 52 4f 4d 20 74  ol2 / - 2 FROM t
0460: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
0470: 2d 33 32 0d 0a 2d 33 35 0d 0a 32 34 0d 0a 0d 0a  -32..-35..24....
0480: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
0490: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 31 32  .SELECT ALL - 12
04a0: 20 2a 20 2d 20 32 37 20 46 52 4f 4d 20 74 61 62   * - 27 FROM tab
04b0: 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
04c0: 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
04d0: 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
04e0: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 61 35  s hashing to 5a5
04f0: 35 37 39 38 33 36 64 65 32 37 64 65 64 39 35 66  579836de27ded95f
0500: 32 30 39 36 32 65 31 35 38 62 31 66 36 0d 0a 0d  20962e158b1f6...
0510: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0520: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
0530: 32 20 2a 20 63 6f 6c 31 20 2d 20 2d 20 38 35 20  2 * col1 - - 85 
0540: 2a 20 35 38 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 58 AS col1 FRO
0550: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
0560: 2d 0d 0a 35 35 30 30 0d 0a 36 31 37 38 0d 0a 36  -..5500..6178..6
0570: 33 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  334....query I r
0580: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
0590: 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32   + col2 + + col2
05a0: 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a   * col0 + col1 *
05b0: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
05c0: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  1 cor0..----..29
05d0: 35 31 0d 0a 33 30 0d 0a 36 35 34 34 0d 0a 0d 0a  51..30..6544....
05e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
05f0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
0600: 20 2d 20 35 33 20 41 53 20 63 6f 6c 32 20 46 52   - 53 AS col2 FR
0610: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
0620: 0a 2d 2d 2d 2d 0d 0a 2d 31 37 34 39 0d 0a 2d 34  .----..-1749..-4
0630: 33 34 36 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65 72  346..-53....quer
0640: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0650: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
0660: 20 2d 20 35 38 20 46 52 4f 4d 20 74 61 62 31 20   - 58 FROM tab1 
0670: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
0680: 31 35 30 38 0d 0a 2d 35 38 30 0d 0a 2d 37 35 34  1508..-580..-754
0690: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
06a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
06b0: 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2b 20  INCT - - col1 + 
06c0: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  + cor0.col2 * + 
06d0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
06e0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
06f0: 37 35 0d 0a 36 38 31 35 0d 0a 39 38 0d 0a 0d 0a  75..6815..98....
0700: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
0710: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
0720: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
0730: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
0740: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
0750: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
0760: 20 2b 20 36 37 20 63 6f 6c 31 20 46 52 4f 4d 20   + 67 col1 FROM 
0770: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
0780: 2d 2d 0d 0a 36 37 0d 0a 36 37 0d 0a 36 37 0d 0a  --..67..67..67..
0790: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
07a0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 37 32 20 41  t..SELECT + 72 A
07b0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
07c0: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
07d0: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
07e0: 61 73 68 69 6e 67 20 74 6f 20 39 30 36 62 36 33  ashing to 906b63
07f0: 63 39 61 64 62 37 64 39 61 63 37 33 35 35 63 61  c9adb7d9ac7355ca
0800: 62 37 31 61 32 35 66 63 34 39 0d 0a 0d 0a 71 75  b71a25fc49....qu
0810: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0820: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f  ELECT ALL + - co
0830: 6c 30 20 2b 20 2d 20 34 35 20 46 52 4f 4d 20 74  l0 + - 45 FROM t
0840: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
0850: 2d 0d 0a 2d 31 30 39 0d 0a 2d 31 32 35 0d 0a 2d  -..-109..-125..-
0860: 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  48....skipif pos
0870: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
0880: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
0890: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
08a0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
08b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
08c0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 28  SELECT ALL - + (
08d0: 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 72 30   col1 ) * + cor0
08e0: 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63  .col1 * - col2 c
08f0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
0900: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39   cor0..----..109
0910: 38 32 0d 0a 32 35 39 34 37 0d 0a 39 30 35 30 36  82..25947..90506
0920: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
0930: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
0940: 63 6f 6c 30 20 2b 20 2d 20 28 20 63 6f 6c 31 20  col0 + - ( col1 
0950: 2a 20 2b 20 36 34 20 2b 20 38 39 20 29 20 41 53  * + 64 + 89 ) AS
0960: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
0970: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
0980: 35 36 31 37 0d 0a 2d 36 30 30 32 0d 0a 2d 36 33  5617..-6002..-63
0990: 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  32....query I ro
09a0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
09b0: 4c 20 2b 20 2d 20 28 20 2d 20 31 32 20 29 20 2a  L + - ( - 12 ) *
09c0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
09d0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
09e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d 0a 36  0..----..1152..6
09f0: 34 38 0d 0a 36 38 34 0d 0a 0d 0a 6f 6e 6c 79 69  48..684....onlyi
0a00: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
0a10: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
0a20: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
0a30: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
0a40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
0a50: 62 65 6c 2d 31 35 0d 0a 53 45 4c 45 43 54 20 43  bel-15..SELECT C
0a60: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
0a70: 49 4d 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32  IMAL ) FROM tab2
0a80: 2c 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  , tab1, tab2 AS 
0a90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
0aa0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
0ab0: 20 31 36 62 65 38 38 36 38 61 31 65 36 66 34 65   16be8868a1e6f4e
0ac0: 38 38 35 30 35 30 39 66 39 33 32 37 61 66 65 39  8850509f9327afe9
0ad0: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
0ae0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
0af0: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
0b00: 6f 72 74 20 6c 61 62 65 6c 2d 31 35 0d 0a 53 45  ort label-15..SE
0b10: 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  LECT CAST ( NULL
0b20: 20 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20   AS REAL ) FROM 
0b30: 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 32  tab2, tab1, tab2
0b40: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
0b50: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
0b60: 67 20 74 6f 20 31 36 62 65 38 38 36 38 61 31 65  g to 16be8868a1e
0b70: 36 66 34 65 38 38 35 30 35 30 39 66 39 33 32 37  6f4e8850509f9327
0b80: 61 66 65 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  afe90....onlyif 
0b90: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
0ba0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
0bb0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
0bc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
0bd0: 61 62 65 6c 2d 31 36 0d 0a 53 45 4c 45 43 54 20  abel-16..SELECT 
0be0: 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c  ALL - col0 + col
0bf0: 30 20 44 49 56 20 74 61 62 30 2e 63 6f 6c 31 20  0 DIV tab0.col1 
0c00: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
0c10: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33  0..----..-24..-3
0c20: 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69 70 69 66  5..-89....skipif
0c30: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
0c40: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
0c50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
0c60: 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  6..SELECT ALL - 
0c70: 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 74 61  col0 + col0 / ta
0c80: 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  b0.col1 AS col0 
0c90: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
0ca0: 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a  .-24..-35..-89..
0cb0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0cc0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
0cd0: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   + + cor0.col2 *
0ce0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   - cor0.col1 AS 
0cf0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
0d00: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 34  or0..----..-1344
0d10: 0d 0a 2d 31 34 35 38 0d 0a 2d 36 32 37 0d 0a 0d  ..-1458..-627...
0d20: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
0d30: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
0d40: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
0d50: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
0d60: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
0d70: 6f 72 74 20 6c 61 62 65 6c 2d 31 38 0d 0a 53 45  ort label-18..SE
0d80: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20  LECT + col2 + - 
0d90: 63 6f 6c 30 20 2f 20 43 41 53 54 28 20 4e 55 4c  col0 / CAST( NUL
0da0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
0db0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
0dc0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
0dd0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
0de0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
0df0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
0e00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0e10: 74 20 6c 61 62 65 6c 2d 31 38 0d 0a 53 45 4c 45  t label-18..SELE
0e20: 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  CT + col2 + - co
0e30: 6c 30 20 2f 20 43 41 53 54 20 28 20 4e 55 4c 4c  l0 / CAST ( NULL
0e40: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
0e50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
0e60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
0e70: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
0e80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0e90: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 20 2b  rt..SELECT - 1 +
0ea0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
0eb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a  cor0..----..53..
0ec0: 35 36 0d 0a 39 35 0d 0a 0d 0a 71 75 65 72 79 20  56..95....query 
0ed0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0ee0: 54 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  T tab0.col0 AS c
0ef0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
0f00: 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
0f10: 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  0 AS cor1..----.
0f20: 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
0f30: 6e 67 20 74 6f 20 39 66 63 31 64 63 64 37 36 66  ng to 9fc1dcd76f
0f40: 65 61 66 34 33 65 35 63 35 64 63 30 36 30 61 30  eaf43e5c5dc060a0
0f50: 32 30 31 34 63 64 0d 0a 0d 0a 71 75 65 72 79 20  2014cd....query 
0f60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
0f70: 54 20 41 4c 4c 20 2b 20 34 34 20 2a 20 2d 20 36  T ALL + 44 * - 6
0f80: 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32   FROM tab0, tab2
0f90: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  , tab2 AS cor0..
0fa0: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
0fb0: 68 61 73 68 69 6e 67 20 74 6f 20 63 30 39 61 63  hashing to c09ac
0fc0: 35 65 65 35 64 31 39 66 36 36 38 30 61 38 35 63  5ee5d19f6680a85c
0fd0: 63 39 62 39 31 36 35 65 63 33 62 0d 0a 0d 0a 71  c9b9165ec3b....q
0fe0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0ff0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1000: 2d 20 34 36 20 2b 20 2d 20 28 20 2b 20 63 6f 6c  - 46 + - ( + col
1010: 31 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f  1 ) + + col1 FRO
1020: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  M tab2..----..-4
1030: 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
1040: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
1050: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
1060: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
1070: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
1080: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33  rowsort label-23
1090: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43  ..SELECT ALL - C
10a0: 41 53 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 53  AST( + col2 AS S
10b0: 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 41  IGNED ) + col0 A
10c0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
10d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d  ..----..-20..41.
10e0: 0a 35 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .52....skipif my
10f0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1100: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1110: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 0d 0a  wsort label-23..
1120: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
1130: 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20 49 4e  T ( + col2 AS IN
1140: 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 41  TEGER ) + col0 A
1150: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1160: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34 31 0d  ..----..-20..41.
1170: 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .52....query I r
1180: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1190: 49 53 54 49 4e 43 54 20 2b 20 37 37 20 41 53 20  ISTINCT + 77 AS 
11a0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
11b0: 2d 2d 2d 2d 0d 0a 37 37 0d 0a 0d 0a 71 75 65 72  ----..77....quer
11c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11d0: 45 43 54 20 2d 20 35 35 20 2a 20 63 6f 6c 30 20  ECT - 55 * col0 
11e0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
11f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 30 0d 0a  0..----..-1320..
1200: 2d 31 39 32 35 0d 0a 2d 34 38 39 35 0d 0a 0d 0a  -1925..-4895....
1210: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1220: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1230: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1240: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1250: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1260: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1270: 20 41 4c 4c 20 2d 20 63 6f 72 31 2e 63 6f 6c 30   ALL - cor1.col0
1280: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1290: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
12a0: 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
12b0: 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
12c0: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
12d0: 32 39 63 31 65 64 64 61 39 33 33 32 33 39 38 32  29c1edda93323982
12e0: 39 39 66 33 39 63 64 31 37 34 65 64 38 34 30 0d  99f39cd174ed840.
12f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1300: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1310: 4e 43 54 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29  NCT - ( + col0 )
1320: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
1330: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1340: 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37  .-1225..-576..-7
1350: 39 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  921....onlyif my
1360: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1370: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1380: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1390: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
13a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13b0: 32 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  28..SELECT DISTI
13c0: 4e 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  NCT + CAST( NULL
13d0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b   AS SIGNED ) * +
13e0: 20 36 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   63 AS col1 FROM
13f0: 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
1400: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
1410: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1420: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1430: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1440: 74 20 6c 61 62 65 6c 2d 32 38 0d 0a 53 45 4c 45  t label-28..SELE
1450: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41  CT DISTINCT + CA
1460: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
1470: 45 47 45 52 20 29 20 2a 20 2b 20 36 33 20 41 53  EGER ) * + 63 AS
1480: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
1490: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
14a0: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ---..NULL....onl
14b0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
14c0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
14d0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
14e0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
14f0: 72 74 20 6c 61 62 65 6c 2d 32 39 0d 0a 53 45 4c  rt label-29..SEL
1500: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
1510: 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  DIV + col1 AS co
1520: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
1530: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
1540: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
1550: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1560: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1570: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 39 0d 0a  wsort label-29..
1580: 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
1590: 6c 32 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63  l2 / + col1 AS c
15a0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
15b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
15c0: 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
15d0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15e0: 37 31 20 2a 20 2b 20 39 37 20 41 53 20 63 6f 6c  71 * + 97 AS col
15f0: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
1600: 2d 0d 0a 36 38 38 37 0d 0a 36 38 38 37 0d 0a 36  -..6887..6887..6
1610: 38 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  887....onlyif my
1620: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
1630: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
1640: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
1650: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1660: 65 6c 2d 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c  el-31..SELECT AL
1670: 4c 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20 2b 20  L tab1.col2 + + 
1680: 38 31 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20  81 DIV - col0 + 
1690: 2b 20 37 35 20 46 52 4f 4d 20 74 61 62 31 0d 0a  + 75 FROM tab1..
16a0: 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31 33 31 0d 0a  ----..102..131..
16b0: 31 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  170....skipif my
16c0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
16d0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
16e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 0d 0a  wsort label-31..
16f0: 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e  SELECT ALL tab1.
1700: 63 6f 6c 32 20 2b 20 2b 20 38 31 20 2f 20 2d 20  col2 + + 81 / - 
1710: 63 6f 6c 30 20 2b 20 2b 20 37 35 20 46 52 4f 4d  col0 + + 75 FROM
1720: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32   tab1..----..102
1730: 0d 0a 31 33 31 0d 0a 31 37 30 0d 0a 0d 0a 71 75  ..131..170....qu
1740: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1750: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
1760: 72 30 2e 63 6f 6c 31 20 2a 20 39 20 46 52 4f 4d  r0.col1 * 9 FROM
1770: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1780: 2d 2d 2d 0d 0a 2d 37 37 34 0d 0a 2d 38 31 39 0d  ---..-774..-819.
1790: 0a 2d 38 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49  .-873....query I
17a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17b0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a   DISTINCT col1 *
17c0: 20 2d 20 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20   - 1 + col1 * + 
17d0: 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 30 20 29 20  col2 + ( col0 ) 
17e0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
17f0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1800: 0a 31 33 31 35 0d 0a 31 33 38 31 0d 0a 36 32 34  .1315..1381..624
1810: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1820: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
1830: 31 34 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  14 * col0 FROM t
1840: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1850: 2d 0d 0a 2d 31 32 34 36 0d 0a 2d 33 33 36 0d 0a  -..-1246..-336..
1860: 2d 34 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -490....query I 
1870: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1880: 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  - col0 * + col2 
1890: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41 53  + col0 * col0 AS
18a0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
18b0: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 0d 0a 33 32 33  .----..-140..323
18c0: 39 0d 0a 34 30 35 36 0d 0a 0d 0a 6f 6e 6c 79 69  9..4056....onlyi
18d0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
18e0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
18f0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1900: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1910: 20 6c 61 62 65 6c 2d 33 36 0d 0a 53 45 4c 45 43   label-36..SELEC
1920: 54 20 2b 20 2d 20 38 20 44 49 56 20 63 6f 6c 31  T + - 8 DIV col1
1930: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1940: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
1950: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
1960: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
1970: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
1980: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
1990: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
19a0: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
19b0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
19c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19d0: 74 20 6c 61 62 65 6c 2d 33 36 0d 0a 53 45 4c 45  t label-36..SELE
19e0: 43 54 20 2b 20 2d 20 38 20 2f 20 63 6f 6c 31 20  CT + - 8 / col1 
19f0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1a00: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1a10: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
1a20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a30: 20 2d 20 63 6f 6c 31 20 2b 20 32 30 20 2d 20 63   - col1 + 20 - c
1a40: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
1a50: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
1a60: 0d 0a 2d 33 38 0d 0a 2d 36 35 0d 0a 0d 0a 6f 6e  ..-38..-65....on
1a70: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1a80: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1a90: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1aa0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1ab0: 6f 72 74 20 6c 61 62 65 6c 2d 33 38 0d 0a 53 45  ort label-38..SE
1ac0: 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 44 49  LECT + + col0 DI
1ad0: 56 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c  V - col1 - - col
1ae0: 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0 col1 FROM tab0
1af0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d   cor0..----..24.
1b00: 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69  .35..89....skipi
1b10: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1b20: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1b30: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1b40: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1b50: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
1b60: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1b70: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1b80: 72 74 20 6c 61 62 65 6c 2d 33 38 0d 0a 53 45 4c  rt label-38..SEL
1b90: 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 2d  ECT + + col0 / -
1ba0: 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 30 20 63   col1 - - col0 c
1bb0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
1bc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  r0..----..24..35
1bd0: 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..89....skipif p
1be0: 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1bf0: 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1c00: 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1c10: 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1c20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c30: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1c40: 32 20 2a 20 37 31 20 63 6f 6c 30 20 46 52 4f 4d  2 * 71 col0 FROM
1c50: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1c60: 2d 2d 2d 0d 0a 31 38 34 36 0d 0a 31 39 31 37 0d  ---..1846..1917.
1c70: 0a 32 36 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .2698....query I
1c80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c90: 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 28 20 28 20   - col0 + - ( ( 
1ca0: 2b 20 63 6f 6c 31 20 29 20 29 20 2d 20 2d 20 63  + col1 ) ) - - c
1cb0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
1cc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d  r0..----..-86..-
1cd0: 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  91..-97....query
1ce0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cf0: 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28 20  CT - col1 + + ( 
1d00: 2d 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  - col0 ) AS col1
1d10: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1d20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a  r0..----..-137..
1d30: 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c 79  -38..-96....only
1d40: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1d50: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1d60: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1d70: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1d80: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1d90: 61 62 65 6c 2d 34 32 0d 0a 53 45 4c 45 43 54 20  abel-42..SELECT 
1da0: 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ALL - cor0.col2 
1db0: 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
1dc0: 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
1dd0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1de0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1df0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1e00: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1e10: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1e20: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e30: 65 6c 2d 34 32 0d 0a 53 45 4c 45 43 54 20 41 4c  el-42..SELECT AL
1e40: 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  L - cor0.col2 * 
1e50: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
1e60: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 32  NTEGER ) AS col2
1e70: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1e80: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1e90: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
1ea0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
1eb0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
1ec0: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
1ed0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
1ee0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ef0: 20 6c 61 62 65 6c 2d 34 33 0d 0a 53 45 4c 45 43   label-43..SELEC
1f00: 54 20 63 6f 6c 30 20 2d 20 2b 20 43 41 53 54 28  T col0 - + CAST(
1f10: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
1f20: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
1f30: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1f40: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1f50: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
1f60: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1f70: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1f80: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33 0d 0a  wsort label-43..
1f90: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 2b 20  SELECT col0 - + 
1fa0: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
1fb0: 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31  NTEGER ) AS col1
1fc0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1fd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1fe0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  NULL..NULL....on
1ff0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2000: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2010: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2020: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2030: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2040: 20 6c 61 62 65 6c 2d 34 34 0d 0a 53 45 4c 45 43   label-44..SELEC
2050: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
2060: 32 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  2 * + CAST( NULL
2070: 20 41 53 20 53 49 47 4e 45 44 20 29 20 63 6f 6c   AS SIGNED ) col
2080: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2090: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
20a0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
20b0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
20c0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
20d0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
20e0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
20f0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2100: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2110: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2120: 2d 34 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -44..SELECT DIST
2130: 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  INCT - col2 * + 
2140: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2150: 4e 54 45 47 45 52 20 29 20 63 6f 6c 31 20 46 52  NTEGER ) col1 FR
2160: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2170: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
2180: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2190: 53 45 4c 45 43 54 20 2d 20 28 20 2d 20 37 32 20  SELECT - ( - 72 
21a0: 29 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  ) FROM tab0, tab
21b0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
21c0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
21d0: 67 20 74 6f 20 39 30 36 62 36 33 63 39 61 64 62  g to 906b63c9adb
21e0: 37 64 39 61 63 37 33 35 35 63 61 62 37 31 61 32  7d9ac7355cab71a2
21f0: 35 66 63 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49  5fc49....query I
2200: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2210: 20 2b 20 63 6f 6c 31 20 2b 20 35 20 46 52 4f 4d   + col1 + 5 FROM
2220: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2230: 2d 2d 2d 0d 0a 31 35 0d 0a 31 38 0d 0a 33 31 0d  ---..15..18..31.
2240: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2250: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
2260: 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 63   col0 * col2 + c
2270: 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
2280: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2290: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a  r0..----..-159..
22a0: 2d 33 35 38 34 0d 0a 2d 37 36 30 30 0d 0a 0d 0a  -3584..-7600....
22b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22c0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22d0: 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2b 20 63 6f   col1 + - ( + co
22e0: 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l0 ) AS col0 FRO
22f0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2300: 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a  ----..-54..-67..
2310: 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
2320: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2330: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20  STINCT - col2 + 
2340: 2d 20 39 34 20 2a 20 38 37 20 46 52 4f 4d 20 74  - 94 * 87 FROM t
2350: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2360: 2d 0d 0a 2d 38 32 33 32 0d 0a 2d 38 32 33 35 0d  -..-8232..-8235.
2370: 0a 2d 38 32 37 34 0d 0a 0d 0a 71 75 65 72 79 20  .-8274....query 
2380: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2390: 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d 20 63  T ALL col1 * - c
23a0: 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
23b0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
23c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  r0..----..-1040.
23d0: 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  .-640..-78....qu
23e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23f0: 45 4c 45 43 54 20 2b 20 33 34 20 2d 20 63 6f 6c  ELECT + 34 - col
2400: 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  1 FROM tab1 cor0
2410: 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 32 34 0d 0a  ..----..21..24..
2420: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2430: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
2440: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63   col0 * col0 + c
2450: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2460: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 34   cor0..----..614
2470: 33 0d 0a 36 32 35 38 0d 0a 38 30 0d 0a 0d 0a 71  3..6258..80....q
2480: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2490: 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
24a0: 2d 20 36 34 20 46 52 4f 4d 20 74 61 62 30 20 63  - 64 FROM tab0 c
24b0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a 32  or0..----..22..2
24c0: 37 0d 0a 33 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..33....onlyif 
24d0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
24e0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
24f0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2500: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2510: 61 62 65 6c 2d 35 34 0d 0a 53 45 4c 45 43 54 20  abel-54..SELECT 
2520: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 44 49  DISTINCT col0 DI
2530: 56 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  V ( col0 * col1 
2540: 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  ) FROM tab2 cor0
2550: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69  ..----..0....ski
2560: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2570: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2580: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2590: 6c 2d 35 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-54..SELECT DIS
25a0: 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20 28 20 63  TINCT col0 / ( c
25b0: 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20 46 52 4f  ol0 * col1 ) FRO
25c0: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
25d0: 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
25e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25f0: 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 28 20 2b  ALL + col2 + ( +
2600: 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
2610: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2620: 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d  0..----..52..54.
2630: 0a 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .76....onlyif my
2640: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2650: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2660: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2670: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2680: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2690: 35 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  56..SELECT ALL +
26a0: 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2f 20 63   col0 * col0 / c
26b0: 6f 6c 30 20 2b 20 2d 20 43 41 53 54 28 20 4e 55  ol0 + - CAST( NU
26c0: 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
26d0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
26e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
26f0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
2700: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2710: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2720: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2730: 72 74 20 6c 61 62 65 6c 2d 35 36 0d 0a 53 45 4c  rt label-56..SEL
2740: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a  ECT ALL + col0 *
2750: 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2b 20 2d   col0 / col0 + -
2760: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
2770: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
2780: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2790: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
27a0: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
27b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27c0: 53 45 4c 45 43 54 20 2b 20 34 20 2a 20 2b 20 39  SELECT + 4 * + 9
27d0: 36 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  6 + col0 FROM ta
27e0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
27f0: 0d 0a 33 39 31 0d 0a 34 36 32 0d 0a 34 36 33 0d  ..391..462..463.
2800: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2810: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2820: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2830: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2840: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2850: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 0d 0a  wsort label-58..
2860: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 43  SELECT ALL + - C
2870: 41 53 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53  AST( - col0 AS S
2880: 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 63  IGNED ) + col2 c
2890: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
28a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31   cor0..----..121
28b0: 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69  ..176..57....ski
28c0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
28d0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
28e0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
28f0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2900: 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
2910: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2920: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2930: 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 0d 0a 53  sort label-58..S
2940: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 43 41  ELECT ALL + - CA
2950: 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20 49  ST ( - col0 AS I
2960: 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32 20  NTEGER ) + col2 
2970: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2980: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
2990: 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75  1..176..57....qu
29a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
29b0: 45 4c 45 43 54 20 2d 20 2d 20 31 35 20 46 52 4f  ELECT - - 15 FRO
29c0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
29d0: 2d 0d 0a 31 35 0d 0a 31 35 0d 0a 31 35 0d 0a 0d  -..15..15..15...
29e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29f0: 0d 0a 53 45 4c 45 43 54 20 2b 20 39 35 20 41 53  ..SELECT + 95 AS
2a00: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2a10: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 35 0d 0a  cor0..----..95..
2a20: 39 35 0d 0a 39 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  95..95....onlyif
2a30: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
2a40: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
2a50: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
2a60: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
2a70: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2a80: 65 6c 2d 36 31 0d 0a 53 45 4c 45 43 54 20 44 49  el-61..SELECT DI
2a90: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20  STINCT + col1 + 
2aa0: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
2ab0: 47 4e 45 44 20 29 20 2d 20 63 6f 6c 30 20 46 52  GNED ) - col0 FR
2ac0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab0..----..N
2ad0: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
2ae0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2af0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2b00: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 0d 0a  wsort label-61..
2b10: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2b20: 2b 20 63 6f 6c 31 20 2b 20 43 41 53 54 20 28 20  + col1 + CAST ( 
2b30: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
2b40: 29 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) - col0 FROM ta
2b50: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b0..----..NULL..
2b60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2b70: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2b80: 43 54 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 63  CT tab0.col1 + c
2b90: 6f 6c 32 20 2a 20 63 6f 6c 30 20 2d 20 63 6f 6c  ol2 * col0 - col
2ba0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2bb0: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  ab0..----..35..7
2bc0: 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72  298..792....quer
2bd0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2be0: 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b  ECT ALL col2 * +
2bf0: 20 74 61 62 32 2e 63 6f 6c 32 20 2d 20 2b 20 63   tab2.col2 - + c
2c00: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
2c10: 2d 2d 2d 0d 0a 31 34 30 36 0d 0a 36 35 30 0d 0a  ---..1406..650..
2c20: 37 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  702....query I r
2c30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38  owsort..SELECT 8
2c40: 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  6 AS col1 FROM t
2c50: 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
2c60: 30 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d  0, tab0 cor1..--
2c70: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
2c80: 73 68 69 6e 67 20 74 6f 20 65 64 31 61 33 39 63  shing to ed1a39c
2c90: 32 37 35 32 63 61 33 37 32 33 36 30 32 65 34 61  2752ca3723602e4a
2ca0: 39 32 63 35 34 62 62 63 34 0d 0a 0d 0a 6f 6e 6c  92c54bbc4....onl
2cb0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2cc0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2cd0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2ce0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2cf0: 72 74 20 6c 61 62 65 6c 2d 36 35 0d 0a 53 45 4c  rt label-65..SEL
2d00: 45 43 54 20 2b 20 63 6f 6c 31 20 44 49 56 20 28  ECT + col1 DIV (
2d10: 20 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c   + col0 ) AS col
2d20: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2d30: 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 73 6b  -..0..0..4....sk
2d40: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2d50: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2d60: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d70: 65 6c 2d 36 35 0d 0a 53 45 4c 45 43 54 20 2b 20  el-65..SELECT + 
2d80: 63 6f 6c 31 20 2f 20 28 20 2b 20 63 6f 6c 30 20  col1 / ( + col0 
2d90: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
2da0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
2db0: 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .4....onlyif mys
2dc0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2dd0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2de0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2df0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e00: 6c 2d 36 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  l-66..SELECT ALL
2e10: 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30   col2 DIV - col0
2e20: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
2e30: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2e40: 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37  ..-35..-7298..-7
2e50: 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  93....skipif mys
2e60: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2e70: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2e80: 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 0d 0a 53  sort label-66..S
2e90: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f  ELECT ALL col2 /
2ea0: 20 2d 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a   - col0 - col2 *
2eb0: 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
2ec0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
2ed0: 32 39 38 0d 0a 2d 37 39 33 0d 0a 0d 0a 6f 6e 6c  298..-793....onl
2ee0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2ef0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2f00: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2f10: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2f20: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f30: 6c 61 62 65 6c 2d 36 37 0d 0a 53 45 4c 45 43 54  label-67..SELECT
2f40: 20 63 6f 6c 32 20 2b 20 43 41 53 54 28 20 2b 20   col2 + CAST( + 
2f50: 28 20 63 6f 6c 32 20 29 20 41 53 20 53 49 47 4e  ( col2 ) AS SIGN
2f60: 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  ED ) FROM tab2..
2f70: 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35 34 0d 0a 37 36  ----..52..54..76
2f80: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2f90: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2fa0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2fb0: 72 74 20 6c 61 62 65 6c 2d 36 37 0d 0a 53 45 4c  rt label-67..SEL
2fc0: 45 43 54 20 63 6f 6c 32 20 2b 20 43 41 53 54 20  ECT col2 + CAST 
2fd0: 28 20 2b 20 28 20 63 6f 6c 32 20 29 20 41 53 20  ( + ( col2 ) AS 
2fe0: 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
2ff0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a 35  ab2..----..52..5
3000: 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49  4..76....query I
3010: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
3020: 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 38 34 20 2b   - col0 * - 84 +
3030: 20 2d 20 38 31 20 2b 20 2d 20 63 6f 6c 32 20 2a   - 81 + - col2 *
3040: 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46 52 4f   col0 * col1 FRO
3050: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  M tab1..----..-3
3060: 31 31 38 35 0d 0a 2d 34 30 34 31 0d 0a 2d 39 33  1185..-4041..-93
3070: 32 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  201....query I r
3080: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
3090: 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 41 53   - ( + col2 ) AS
30a0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
30b0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
30c0: 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65  4..57..96....que
30d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30e0: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
30f0: 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  * + col0 + col2 
3100: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
3110: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
3120: 0a 2d 31 30 38 0d 0a 2d 33 35 39 31 0d 0a 2d 37  .-108..-3591..-7
3130: 35 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  584....onlyif my
3140: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
3150: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
3160: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
3170: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
3180: 65 6c 2d 37 31 0d 0a 53 45 4c 45 43 54 20 2d 20  el-71..SELECT - 
3190: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49  col1 + + col2 DI
31a0: 56 20 2b 20 38 37 20 46 52 4f 4d 20 74 61 62 30  V + 87 FROM tab0
31b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31c0: 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d  -86..-91..-97...
31d0: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
31e0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
31f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3200: 6c 61 62 65 6c 2d 37 31 0d 0a 53 45 4c 45 43 54  label-71..SELECT
3210: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   - col1 + + col2
3220: 20 2f 20 2b 20 38 37 20 46 52 4f 4d 20 74 61 62   / + 87 FROM tab
3230: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
3240: 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a  .-86..-91..-97..
3250: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3260: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
3270: 43 54 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20  CT ( + col1 ) * 
3280: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
3290: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
32a0: 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d  48..1404..570...
32b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32c0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c  ..SELECT + - col
32d0: 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 32  2 + - col1 * - 2
32e0: 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
32f0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
3300: 2d 0d 0a 32 33 33 0d 0a 32 38 31 0d 0a 37 30 30  -..233..281..700
3310: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
3320: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
3330: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
3340: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
3350: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
3360: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3370: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e  LECT ALL - cor0.
3380: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 31  col2 * col0 col1
3390: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
33a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d  r0..----..-35..-
33b0: 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 6f 6e  7298..-792....on
33c0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
33d0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
33e0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
33f0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
3400: 6f 72 74 20 6c 61 62 65 6c 2d 37 35 0d 0a 53 45  ort label-75..SE
3410: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
3420: 31 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56 20 36  1 + + col0 DIV 6
3430: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
3440: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3450: 2d 0d 0a 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69  -..1..2....skipi
3460: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
3470: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
3480: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3490: 37 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  75..SELECT DISTI
34a0: 4e 43 54 20 2b 20 31 20 2b 20 2b 20 63 6f 6c 30  NCT + 1 + + col0
34b0: 20 2f 20 36 32 20 41 53 20 63 6f 6c 30 20 46 52   / 62 AS col0 FR
34c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
34d0: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 0d 0a 6f  .----..1..2....o
34e0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
34f0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
3500: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
3510: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
3520: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36 0d 0a 53  sort label-76..S
3530: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b 20  ELECT ALL + ( + 
3540: 63 6f 6c 30 20 29 20 2d 20 63 6f 6c 32 20 44 49  col0 ) - col2 DI
3550: 56 20 35 30 20 46 52 4f 4d 20 74 61 62 31 20 41  V 50 FROM tab1 A
3560: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d  S cor0..----..2.
3570: 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69  .63..79....skipi
3580: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
3590: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
35a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
35b0: 37 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  76..SELECT ALL +
35c0: 20 28 20 2b 20 63 6f 6c 30 20 29 20 2d 20 63 6f   ( + col0 ) - co
35d0: 6c 32 20 2f 20 35 30 20 46 52 4f 4d 20 74 61 62  l2 / 50 FROM tab
35e0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
35f0: 0a 32 0d 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 71 75  .2..63..79....qu
3600: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
3610: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
3620: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46   col1 + + col0 F
3630: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3640: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36  ..----..132..286
3650: 32 0d 0a 37 35 35 31 0d 0a 0d 0a 71 75 65 72 79  2..7551....query
3660: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3670: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
3680: 20 2a 20 63 6f 6c 31 20 2d 20 28 20 63 6f 6c 32   * col1 - ( col2
3690: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
36a0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 35  cor0..----..2805
36b0: 0d 0a 37 33 38 30 0d 0a 39 36 0d 0a 0d 0a 71 75  ..7380..96....qu
36c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36d0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
36e0: 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 32   * cor0.col2 * 2
36f0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
3700: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
3710: 2d 0d 0a 31 31 39 37 30 0d 0a 32 36 32 30 38 0d  -..11970..26208.
3720: 0a 32 39 34 38 34 0d 0a 0d 0a 71 75 65 72 79 20  .29484....query 
3730: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3740: 54 20 41 4c 4c 20 37 36 20 2a 20 63 6f 6c 32 20  T ALL 76 * col2 
3750: 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
3760: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 32  b0..----..-21..2
3770: 34 32 32 0d 0a 36 31 34 31 0d 0a 0d 0a 71 75 65  422..6141....que
3780: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3790: 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20  LECT ALL - col1 
37a0: 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  + - col1 * + col
37b0: 32 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 + + col2 FROM 
37c0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
37d0: 2d 2d 0d 0a 2d 31 39 33 0d 0a 2d 32 38 39 31 0d  --..-193..-2891.
37e0: 0a 2d 37 34 37 31 0d 0a 0d 0a 71 75 65 72 79 20  .-7471....query 
37f0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3800: 54 20 2d 20 37 39 20 41 53 20 63 6f 6c 30 20 46  T - 79 AS col0 F
3810: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
3820: 2d 2d 2d 0d 0a 2d 37 39 0d 0a 2d 37 39 0d 0a 2d  ---..-79..-79..-
3830: 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
3840: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
3850: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20  + col1 * col0 + 
3860: 33 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  35 AS col2 FROM 
3870: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
3880: 2d 2d 0d 0a 2d 31 33 30 38 0d 0a 2d 31 38 32 0d  --..-1308..-182.
3890: 0a 2d 34 35 36 37 0d 0a 0d 0a 71 75 65 72 79 20  .-4567....query 
38a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38b0: 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63  T ALL col1 * + c
38c0: 6f 6c 31 20 2b 20 36 30 20 2a 20 2d 20 63 6f 72  ol1 + 60 * - cor
38d0: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  0.col1 FROM tab1
38e0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
38f0: 2d 35 30 30 0d 0a 2d 36 31 31 0d 0a 2d 38 38 34  -500..-611..-884
3900: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3910: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
3920: 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2d 20  INCT + + col2 - 
3930: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
3940: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
3950: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3960: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
3970: 32 20 2a 20 2d 20 37 36 20 41 53 20 63 6f 6c 31  2 * - 76 AS col1
3980: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
3990: 0d 0a 2d 34 31 30 34 0d 0a 2d 34 33 33 32 0d 0a  ..-4104..-4332..
39a0: 2d 37 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -7296....query I
39b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
39c0: 20 41 4c 4c 20 2b 20 28 20 74 61 62 31 2e 63 6f   ALL + ( tab1.co
39d0: 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a  l0 ) FROM tab1..
39e0: 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
39f0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
3a00: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
3a10: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
3a20: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
3a30: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
3a40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3a50: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74  ECT DISTINCT + t
3a60: 61 62 30 2e 63 6f 6c 31 20 63 6f 6c 30 20 46 52  ab0.col1 col0 FR
3a70: 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
3a80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   cor0..----..86.
3a90: 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69  .91..97....skipi
3aa0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
3ab0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
3ac0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
3ad0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
3ae0: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
3af0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
3b00: 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63 6f  cor0.col2 ) + co
3b10: 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
3b20: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
3b30: 0a 2d 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a  .-20..41..52....
3b40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
3b50: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
3b60: 20 2a 20 31 36 20 46 52 4f 4d 20 74 61 62 30 20   * 16 FROM tab0 
3b70: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 32  cor0..----..1312
3b80: 0d 0a 31 36 0d 0a 35 32 38 0d 0a 0d 0a 71 75 65  ..16..528....que
3b90: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3ba0: 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  LECT + col0 * co
3bb0: 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l0 * - col2 FROM
3bc0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
3bd0: 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 31 39 30  ---..-1225..-190
3be0: 30 38 0d 0a 2d 36 34 39 35 32 32 0d 0a 0d 0a 71  08..-649522....q
3bf0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3c00: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35 36 20  SELECT ALL - 56 
3c10: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  + col0 FROM tab2
3c20: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3c30: 2d 34 39 0d 0a 32 32 0d 0a 32 33 0d 0a 0d 0a 73  -49..22..23....s
3c40: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
3c50: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
3c60: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
3c70: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
3c80: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
3c90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
3ca0: 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20  - cor0.col0 * - 
3cb0: 31 33 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 30  13 + + col2 col0
3cc0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
3cd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a  r0..----..1040..
3ce0: 31 30 36 35 0d 0a 31 31 38 0d 0a 0d 0a 6f 6e 6c  1065..118....onl
3cf0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
3d00: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
3d10: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
3d20: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
3d30: 72 74 20 6c 61 62 65 6c 2d 39 34 0d 0a 53 45 4c  rt label-94..SEL
3d40: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b  ECT ALL - col2 +
3d50: 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30   col0 DIV + col0
3d60: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
3d70: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3d80: 0d 0a 2d 33 32 0d 0a 2d 38 31 0d 0a 30 0d 0a 0d  ..-32..-81..0...
3d90: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
3da0: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
3db0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3dc0: 6c 61 62 65 6c 2d 39 34 0d 0a 53 45 4c 45 43 54  label-94..SELECT
3dd0: 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 63 6f   ALL - col2 + co
3de0: 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63  l0 / + col0 AS c
3df0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
3e00: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32   cor0..----..-32
3e10: 0d 0a 2d 38 31 0d 0a 30 0d 0a 0d 0a 71 75 65 72  ..-81..0....quer
3e20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3e30: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
3e40: 20 32 36 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2b   26 * + col0 + +
3e50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
3e60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
3e70: 33 32 0d 0a 31 37 32 31 0d 0a 32 31 37 36 0d 0a  32..1721..2176..
3e80: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3e90: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
3ea0: 35 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  56 AS col1 FROM 
3eb0: 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
3ec0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
3ed0: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 63  es hashing to 9c
3ee0: 34 35 32 33 33 31 32 31 37 34 37 33 30 62 62 63  4523312174730bbc
3ef0: 35 32 35 62 39 39 37 37 61 61 39 39 66 61 0d 0a  525b9977aa99fa..
3f00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3f10: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
3f20: 63 6f 6c 32 20 2a 20 37 30 20 2b 20 63 6f 6c 30  col2 * 70 + col0
3f30: 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
3f40: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
3f50: 2d 0d 0a 2d 32 30 38 0d 0a 2d 33 34 32 0d 0a 31  -..-208..-342..1
3f60: 37 30 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  701....onlyif my
3f70: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
3f80: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
3f90: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
3fa0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
3fb0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
3fc0: 39 38 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  98..SELECT + CAS
3fd0: 54 28 20 2d 20 63 6f 6c 30 20 41 53 20 53 49 47  T( - col0 AS SIG
3fe0: 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b  NED ) * + col2 +
3ff0: 20 63 6f 6c 30 20 2a 20 2b 20 39 33 20 46 52 4f   col0 * + 93 FRO
4000: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
4010: 2d 2d 2d 2d 0d 0a 31 34 34 30 0d 0a 33 32 32 30  ----..1440..3220
4020: 0d 0a 39 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..979....skipif 
4030: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
4040: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
4050: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38  rowsort label-98
4060: 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20  ..SELECT + CAST 
4070: 28 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45  ( - col0 AS INTE
4080: 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2b  GER ) * + col2 +
4090: 20 63 6f 6c 30 20 2a 20 2b 20 39 33 20 46 52 4f   col0 * + 93 FRO
40a0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
40b0: 2d 2d 2d 2d 0d 0a 31 34 34 30 0d 0a 33 32 32 30  ----..1440..3220
40c0: 0d 0a 39 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..979....query I
40d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
40e0: 20 2b 20 28 20 37 34 20 2a 20 2d 20 63 6f 6c 32   + ( 74 * - col2
40f0: 20 2b 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 29   + + tab1.col1 )
4100: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
4110: 0d 0a 2d 33 39 37 30 0d 0a 2d 34 32 30 38 0d 0a  ..-3970..-4208..
4120: 2d 37 30 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -7091....query I
4130: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4140: 20 2b 20 34 35 20 46 52 4f 4d 20 74 61 62 31 2c   + 45 FROM tab1,
4150: 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
4160: 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
4170: 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75  1..----..81 valu
4180: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 61  es hashing to 8a
4190: 36 64 32 30 38 31 30 31 34 30 65 61 30 38 38 65  6d20810140ea088e
41a0: 38 65 30 66 64 37 34 66 66 62 38 33 33 39 0d 0a  8e0fd74ffb8339..
41b0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
41c0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 38 20 41  t..SELECT - 28 A
41d0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
41e0: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
41f0: 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
4200: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
4210: 73 68 69 6e 67 20 74 6f 20 65 61 63 30 30 61 39  shing to eac00a9
4220: 35 64 37 33 34 63 37 30 37 31 33 36 30 65 64 33  5d734c7071360ed3
4230: 39 32 63 33 66 33 39 62 63 0d 0a 0d 0a 71 75 65  92c3f39bc....que
4240: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4250: 4c 45 43 54 20 2d 20 39 36 20 2b 20 63 6f 72 30  LECT - 96 + cor0
4260: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c  .col0 FROM tab1,
4270: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
4280: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
4290: 73 68 69 6e 67 20 74 6f 20 35 36 35 36 64 63 33  shing to 5656dc3
42a0: 39 38 35 37 36 38 36 37 65 66 63 66 36 33 62 38  98576867efcf63b8
42b0: 65 32 64 37 35 30 66 61 35 0d 0a 0d 0a 71 75 65  e2d750fa5....que
42c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
42d0: 4c 45 43 54 20 28 20 35 37 20 29 20 2a 20 63 6f  LECT ( 57 ) * co
42e0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
42f0: 2d 2d 0d 0a 34 39 30 32 0d 0a 35 31 38 37 0d 0a  --..4902..5187..
4300: 35 35 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5529....query I 
4310: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
4320: 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 38 39 20  DISTINCT + + 89 
4330: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
4340: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4350: 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 0d 0a 31 37 31  ..----..122..171
4360: 0d 0a 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..90....onlyif m
4370: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
4380: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
4390: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
43a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
43b0: 62 65 6c 2d 31 30 35 0d 0a 53 45 4c 45 43 54 20  bel-105..SELECT 
43c0: 41 4c 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20 63  ALL + col0 DIV c
43d0: 6f 6c 30 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ol0 - col0 AS co
43e0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
43f0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 33  0..----..-23..-3
4400: 34 0d 0a 2d 38 38 0d 0a 0d 0a 73 6b 69 70 69 66  4..-88....skipif
4410: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
4420: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
4430: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
4440: 30 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  05..SELECT ALL +
4450: 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 2d 20 63   col0 / col0 - c
4460: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
4470: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
4480: 0d 0a 2d 32 33 0d 0a 2d 33 34 0d 0a 2d 38 38 0d  ..-23..-34..-88.
4490: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
44a0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
44b0: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 37 31 20  or0.col2 + + 71 
44c0: 2d 20 2b 20 39 32 20 46 52 4f 4d 20 74 61 62 32  - + 92 FROM tab2
44d0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
44e0: 31 37 0d 0a 35 0d 0a 36 0d 0a 0d 0a 6f 6e 6c 79  17..5..6....only
44f0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
4500: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
4510: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
4520: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
4530: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4540: 61 62 65 6c 2d 31 30 37 0d 0a 53 45 4c 45 43 54  abel-107..SELECT
4550: 20 41 4c 4c 20 2b 20 2b 20 43 41 53 54 28 20 4e   ALL + + CAST( N
4560: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
4570: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
4580: 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
4590: 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
45a0: 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
45b0: 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37  g to cd7a7901e47
45c0: 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31  c15155404aff0d21
45d0: 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20  6fe0b....skipif 
45e0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
45f0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
4600: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
4610: 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  7..SELECT ALL + 
4620: 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  + CAST ( NULL AS
4630: 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
4640: 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52 4f  tab1 AS cor0 CRO
4650: 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
4660: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
4670: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
4680: 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
4690: 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
46a0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
46b0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
46c0: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
46d0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
46e0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
46f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4700: 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 32 2e  LECT ALL + tab2.
4710: 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c 30  col0 * tab2.col0
4720: 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d   - tab2.col1 * -
4730: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 63   col1 * + col0 c
4740: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
4750: 2d 2d 2d 0d 0a 32 37 37 36 30 32 0d 0a 32 39 30  ---..277602..290
4760: 37 32 0d 0a 36 37 37 36 0d 0a 0d 0a 71 75 65 72  72..6776....quer
4770: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4780: 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63  ECT - + col2 * c
4790: 6f 6c 31 20 2b 20 2d 20 38 35 20 2d 20 63 6f 6c  ol1 + - 85 - col
47a0: 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  0 * col0 AS col2
47b0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
47c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 37 0d  r0..----..-1407.
47d0: 0a 2d 31 35 34 36 38 0d 0a 2d 33 34 39 39 0d 0a  .-15468..-3499..
47e0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
47f0: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
4800: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
4810: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
4820: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
4830: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 0d 0a  sort label-110..
4840: 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e  SELECT + CAST( N
4850: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
4860: 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 20 43  FROM tab2 cor0 C
4870: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41  ROSS JOIN tab1 A
4880: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
4890: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
48a0: 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
48b0: 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
48c0: 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  0b....skipif mys
48d0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
48e0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
48f0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 0d 0a  sort label-110..
4900: 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20  SELECT + CAST ( 
4910: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
4920: 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  ) FROM tab2 cor0
4930: 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31   CROSS JOIN tab1
4940: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
4950: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
4960: 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37 63   to cd7a7901e47c
4970: 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31 36  15155404aff0d216
4980: 66 65 30 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  fe0b....onlyif m
4990: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
49a0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
49b0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
49c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
49d0: 62 65 6c 2d 31 31 31 0d 0a 53 45 4c 45 43 54 20  bel-111..SELECT 
49e0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
49f0: 44 49 56 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20  DIV - tab0.col1 
4a00: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
4a10: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b  0..----..1....sk
4a20: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
4a30: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
4a40: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
4a50: 65 6c 2d 31 31 31 0d 0a 53 45 4c 45 43 54 20 44  el-111..SELECT D
4a60: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2f  ISTINCT - col1 /
4a70: 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20   - tab0.col1 AS 
4a80: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
4a90: 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  ----..1....query
4aa0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
4ab0: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20  CT DISTINCT - - 
4ac0: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
4ad0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
4ae0: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
4af0: 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab0 AS cor1..---
4b00: 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
4b10: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
4b20: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
4b30: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
4b40: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
4b50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33  owsort label-113
4b60: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4b70: 54 20 63 6f 6c 32 20 44 49 56 20 2b 20 39 30 20  T col2 DIV + 90 
4b80: 2b 20 31 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 11 AS col2 FRO
4b90: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
4ba0: 0d 0a 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..12....skipif m
4bb0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
4bc0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
4bd0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33  owsort label-113
4be0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4bf0: 54 20 63 6f 6c 32 20 2f 20 2b 20 39 30 20 2b 20  T col2 / + 90 + 
4c00: 31 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  11 AS col2 FROM 
4c10: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a  tab1..----..11..
4c20: 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  12....query I ro
4c30: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
4c40: 63 6f 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 32 20  col1 * - ( col2 
4c50: 29 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ) + + col0 + col
4c60: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
4c70: 2d 0d 0a 2d 32 37 32 38 0d 0a 2d 37 32 38 32 0d  -..-2728..-7282.
4c80: 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .35....query I r
4c90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
4ca0: 20 35 35 20 2a 20 2b 20 36 38 20 41 53 20 63 6f   55 * + 68 AS co
4cb0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
4cc0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4cd0: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
4ce0: 6e 67 20 74 6f 20 36 35 63 39 61 65 36 63 36 37  ng to 65c9ae6c67
4cf0: 62 63 31 66 66 65 62 30 64 31 32 66 31 61 32 65  bc1ffeb0d12f1a2e
4d00: 66 62 65 65 62 64 0d 0a 0d 0a 6f 6e 6c 79 69 66  fbeebd....onlyif
4d10: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
4d20: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
4d30: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
4d40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
4d50: 6c 61 62 65 6c 2d 31 31 36 0d 0a 53 45 4c 45 43  label-116..SELEC
4d60: 54 20 41 4c 4c 20 2d 20 74 61 62 30 2e 63 6f 6c  T ALL - tab0.col
4d70: 31 20 44 49 56 20 2b 20 34 34 20 2b 20 35 30 20  1 DIV + 44 + 50 
4d80: 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62  * + col2 * - tab
4d90: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
4da0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 36 32 30 32 0d  ..----..-336202.
4db0: 0a 2d 35 32 0d 0a 2d 35 34 34 35 31 0d 0a 0d 0a  .-52..-54451....
4dc0: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
4dd0: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
4de0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
4df0: 61 62 65 6c 2d 31 31 36 0d 0a 53 45 4c 45 43 54  abel-116..SELECT
4e00: 20 41 4c 4c 20 2d 20 74 61 62 30 2e 63 6f 6c 31   ALL - tab0.col1
4e10: 20 2f 20 2b 20 34 34 20 2b 20 35 30 20 2a 20 2b   / + 44 + 50 * +
4e20: 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 30 2e 63   col2 * - tab0.c
4e30: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
4e40: 2d 2d 2d 0d 0a 2d 33 33 36 32 30 32 0d 0a 2d 35  ---..-336202..-5
4e50: 32 0d 0a 2d 35 34 34 35 31 0d 0a 0d 0a 71 75 65  2..-54451....que
4e60: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4e70: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
4e80: 39 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  99 AS col2 FROM 
4e90: 74 61 62 31 2c 20 74 61 62 31 20 63 6f 72 30 2c  tab1, tab1 cor0,
4ea0: 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
4eb0: 2d 2d 2d 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72  ---..-99....quer
4ec0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4ed0: 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT + - cor0.col
4ee0: 32 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  2 + - col2 AS co
4ef0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
4f00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34  cor0..----..-164
4f10: 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65  ..-2..-66....que
4f20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4f30: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
4f40: 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 32 20  col0 * - ( col2 
4f50: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
4f60: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d  or0..----..-189.
4f70: 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d  .-2028..-3002...
4f80: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
4f90: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
4fa0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
4fb0: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
4fc0: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
4fd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
4fe0: 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  T + + col0 * - c
4ff0: 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 72 30 2e 63  ol2 + - ( cor0.c
5000: 6f 6c 30 20 29 20 2a 20 63 6f 72 30 2e 63 6f 6c  ol0 ) * cor0.col
5010: 31 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20  1 * - col2 col1 
5020: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
5030: 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 38 33 32 0d 0a  0..----..32832..
5040: 34 30 35 30 0d 0a 39 32 31 36 30 0d 0a 0d 0a 73  4050..92160....s
5050: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
5060: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
5070: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5080: 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
5090: 30 20 2a 20 43 41 53 54 20 28 20 2d 20 63 6f 6c  0 * CAST ( - col
50a0: 31 20 41 53 20 52 45 41 4c 20 29 20 2b 20 63 6f  1 AS REAL ) + co
50b0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
50c0: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
50d0: 0a 2d 35 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30  .-576..-75..-960
50e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
50f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5100: 49 4e 43 54 20 36 38 20 2a 20 2b 20 63 6f 72 30  INCT 68 * + cor0
5110: 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c  .col2 FROM tab2,
5120: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
5130: 2d 2d 2d 0d 0a 31 37 36 38 0d 0a 31 38 33 36 0d  ---..1768..1836.
5140: 0a 32 35 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .2584....query I
5150: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5160: 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 28 20   ALL + col0 + ( 
5170: 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  cor0.col1 * col0
5180: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
5190: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38  cor0..----..2088
51a0: 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d 0a  ..3430..8188....
51b0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
51c0: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
51d0: 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52   - ( - col2 ) FR
51e0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
51f0: 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 31 0d 0a  --..-7..16..51..
5200: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5210: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
5220: 43 54 20 2d 20 33 30 20 46 52 4f 4d 20 74 61 62  CT - 30 FROM tab
5230: 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  1 cor0 CROSS JOI
5240: 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
5250: 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 0d 0a 71 75 65  ----..-30....que
5260: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5270: 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31  LECT - tab1.col1
5280: 20 2a 20 2d 20 28 20 2d 20 37 20 29 20 46 52 4f   * - ( - 7 ) FRO
5290: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
52a0: 38 32 0d 0a 2d 37 30 0d 0a 2d 39 31 0d 0a 0d 0a  82..-70..-91....
52b0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
52c0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
52d0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
52e0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
52f0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 0d  wsort label-127.
5300: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56  .SELECT col2 DIV
5310: 20 28 20 35 34 20 2a 20 2b 20 63 6f 6c 31 20 29   ( 54 * + col1 )
5320: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
5330: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b0..----..0..0..
5340: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
5350: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
5360: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
5370: 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 0d 0a 53  ort label-127..S
5380: 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 28 20 35  ELECT col2 / ( 5
5390: 34 20 2a 20 2b 20 63 6f 6c 31 20 29 20 41 53 20  4 * + col1 ) AS 
53a0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
53b0: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
53c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
53d0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
53e0: 54 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20 2b 20  T tab1.col0 + + 
53f0: 28 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  ( - col2 ) AS co
5400: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
5410: 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d  --..-16..-51..7.
5420: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5430: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
5440: 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 35 33 20 2b   + col2 + - 53 +
5450: 20 2b 20 31 38 20 2a 20 2d 20 63 6f 6c 30 20 46   + 18 * - col0 F
5460: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
5470: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 34 38 0d 0a 2d  ..----..-1148..-
5480: 31 33 39 37 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65  1397..-53....que
5490: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
54a0: 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  LECT - + col1 * 
54b0: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
54c0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
54d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
54e0: 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39  64..-3395..-8099
54f0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5500: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
5510: 2b 20 74 61 62 32 2e 63 6f 6c 32 20 29 20 2a 20  + tab2.col2 ) * 
5520: 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
5530: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
5540: 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d  444..-676..-729.
5550: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5560: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 34 20  rt..SELECT - 34 
5570: 2d 20 2d 20 32 30 20 46 52 4f 4d 20 74 61 62 32  - - 20 FROM tab2
5580: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 34  ..----..-14..-14
5590: 0d 0a 2d 31 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-14....skipif 
55a0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
55b0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
55c0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
55d0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
55e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
55f0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
5600: 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 31  l1 + + col2 col1
5610: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
5620: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37  r0..----..28..47
5630: 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..83....query I 
5640: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5650: 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e  - col0 * + cor0.
5660: 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col1 + col1 * + 
5670: 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  ( + col0 ) * col
5680: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
5690: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
56a0: 2d 0d 0a 31 31 35 30 35 30 0d 0a 34 39 36 39 31  -..115050..49691
56b0: 0d 0a 35 36 34 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..5642....onlyif
56c0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
56d0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
56e0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
56f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5700: 6c 61 62 65 6c 2d 31 33 35 0d 0a 53 45 4c 45 43  label-135..SELEC
5710: 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 34 30 20  T + col0 DIV 40 
5720: 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  + - col1 AS col1
5730: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
5740: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d  r0..----..-16..-
5750: 33 31 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70 69  31..-58....skipi
5760: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
5770: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
5780: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5790: 31 33 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  135..SELECT + co
57a0: 6c 30 20 2f 20 34 30 20 2b 20 2d 20 63 6f 6c 31  l0 / 40 + - col1
57b0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
57c0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
57d0: 0d 0a 2d 31 36 0d 0a 2d 33 31 0d 0a 2d 35 38 0d  ..-16..-31..-58.
57e0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
57f0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
5800: 20 2d 20 36 38 20 46 52 4f 4d 20 74 61 62 32 2c   - 68 FROM tab2,
5810: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
5820: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
5830: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
5840: 36 66 62 62 61 37 64 62 35 62 63 63 62 35 33 33  6fbba7db5bccb533
5850: 61 33 35 61 61 35 31 32 35 61 32 33 31 66 38 38  a35aa5125a231f88
5860: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5870: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
5880: 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  l1 * col2 * col2
5890: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
58a0: 0a 2d 2d 2d 2d 0d 0a 31 31 39 38 30 38 0d 0a 33  .----..119808..3
58b0: 32 34 39 30 0d 0a 37 35 38 31 36 0d 0a 0d 0a 6f  2490..75816....o
58c0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
58d0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
58e0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
58f0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
5900: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 0d 0a  sort label-138..
5910: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
5920: 2b 20 2d 20 32 39 20 2d 20 63 6f 6c 31 20 44 49  + - 29 - col1 DI
5930: 56 20 2b 20 35 38 20 46 52 4f 4d 20 74 61 62 30  V + 58 FROM tab0
5940: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5950: 2d 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -30....skipif my
5960: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
5970: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
5980: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 38 0d  wsort label-138.
5990: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
59a0: 20 2b 20 2d 20 32 39 20 2d 20 63 6f 6c 31 20 2f   + - 29 - col1 /
59b0: 20 2b 20 35 38 20 46 52 4f 4d 20 74 61 62 30 20   + 58 FROM tab0 
59c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
59d0: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
59e0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
59f0: 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20  STINCT col1 * - 
5a00: 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  col1 + cor0.col2
5a10: 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   * col1 AS col0 
5a20: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
5a30: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 0d 0a 2d  0..----..-124..-
5a40: 31 39 34 37 0d 0a 33 35 37 0d 0a 0d 0a 6f 6e 6c  1947..357....onl
5a50: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
5a60: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
5a70: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
5a80: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
5a90: 72 74 20 6c 61 62 65 6c 2d 31 34 30 0d 0a 53 45  rt label-140..SE
5aa0: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 28 20  LECT + col2 + ( 
5ab0: 35 30 20 29 20 44 49 56 20 63 6f 72 30 2e 63 6f  50 ) DIV cor0.co
5ac0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
5ad0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a  cor0..----..34..
5ae0: 35 31 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66  51..82....skipif
5af0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
5b00: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
5b10: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
5b20: 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  40..SELECT + col
5b30: 32 20 2b 20 28 20 35 30 20 29 20 2f 20 63 6f 72  2 + ( 50 ) / cor
5b40: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
5b50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5b60: 33 34 0d 0a 35 31 0d 0a 38 32 0d 0a 0d 0a 6f 6e  34..51..82....on
5b70: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
5b80: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
5b90: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
5ba0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
5bb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
5bc0: 20 6c 61 62 65 6c 2d 31 34 31 0d 0a 53 45 4c 45   label-141..SELE
5bd0: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  CT + col2 * col1
5be0: 20 2b 20 2d 20 43 41 53 54 28 20 2b 20 37 33 20   + - CAST( + 73 
5bf0: 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
5c00: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
5c10: 2d 2d 2d 0d 0a 31 31 37 35 0d 0a 31 33 33 31 0d  ---..1175..1331.
5c20: 0a 34 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .497....skipif m
5c30: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
5c40: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
5c50: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31  owsort label-141
5c60: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
5c70: 2a 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 20  * col1 + - CAST 
5c80: 28 20 2b 20 37 33 20 41 53 20 49 4e 54 45 47 45  ( + 73 AS INTEGE
5c90: 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  R ) AS col2 FROM
5ca0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 37   tab1..----..117
5cb0: 35 0d 0a 31 33 33 31 0d 0a 34 39 37 0d 0a 0d 0a  5..1331..497....
5cc0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
5cd0: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
5ce0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
5cf0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
5d00: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 32 0d  wsort label-142.
5d10: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 35 20 44  .SELECT ALL 25 D
5d20: 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20  IV cor0.col0 AS 
5d30: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20  col2 FROM tab2, 
5d40: 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
5d50: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
5d60: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
5d70: 61 33 35 61 64 39 34 31 63 62 31 38 37 38 66 62  a35ad941cb1878fb
5d80: 38 37 30 38 32 61 63 32 31 65 61 38 32 34 31 0d  87082ac21ea8241.
5d90: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
5da0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
5db0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
5dc0: 74 20 6c 61 62 65 6c 2d 31 34 32 0d 0a 53 45 4c  t label-142..SEL
5dd0: 45 43 54 20 41 4c 4c 20 32 35 20 2f 20 63 6f 72  ECT ALL 25 / cor
5de0: 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
5df0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20  ROM tab2, tab0, 
5e00: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
5e10: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
5e20: 73 68 69 6e 67 20 74 6f 20 30 61 33 35 61 64 39  shing to 0a35ad9
5e30: 34 31 63 62 31 38 37 38 66 62 38 37 30 38 32 61  41cb1878fb87082a
5e40: 63 32 31 65 61 38 32 34 31 0d 0a 0d 0a 71 75 65  c21ea8241....que
5e50: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
5e60: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  LECT + col2 * - 
5e70: 63 6f 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30 20  col2 + ( - col0 
5e80: 2a 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  * - col1 ) FROM 
5e90: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
5ea0: 2d 2d 0d 0a 2d 31 30 31 0d 0a 2d 35 31 32 0d 0a  --..-101..-512..
5eb0: 33 39 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  3926....query I 
5ec0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5ed0: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
5ee0: 6c 32 20 2b 20 38 31 20 2b 20 2b 20 63 6f 72 30  l2 + 81 + + cor0
5ef0: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
5f00: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
5f10: 2d 2d 0d 0a 2d 36 35 36 31 0d 0a 2d 39 37 35 0d  --..-6561..-975.
5f20: 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .81....query I r
5f30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
5f40: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b  ISTINCT - col2 +
5f50: 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   + col2 * - col2
5f60: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
5f70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 38 32 0d  r0..----..-1482.
5f80: 0a 2d 37 30 32 0d 0a 2d 37 35 36 0d 0a 0d 0a 71  .-702..-756....q
5f90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5fa0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 34  SELECT ALL + - 4
5fb0: 37 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  7 * + cor0.col2 
5fc0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
5fd0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
5fe0: 0a 2d 31 35 35 31 0d 0a 2d 33 38 35 34 0d 0a 2d  .-1551..-3854..-
5ff0: 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  47....query I ro
6000: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
6010: 33 35 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 72 30  35 * col1 + cor0
6020: 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41  .col1 * + col1 A
6030: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
6040: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6050: 32 30 34 36 0d 0a 35 35 34 36 0d 0a 38 38 34 0d  2046..5546..884.
6060: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
6070: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
6080: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
6090: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
60a0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
60b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
60c0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
60d0: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 63   col1 * + col0 c
60e0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
60f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34   cor0..----..104
6100: 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75  0..640..78....qu
6110: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6120: 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  ELECT - - cor0.c
6130: 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 + cor0.col1 
6140: 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  - + col1 AS col2
6150: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
6160: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32  .----..1..33..82
6170: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6180: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
6190: 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 36 39  tab0.col0 * - 69
61a0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
61b0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35 36 0d  b0..----..-1656.
61c0: 0a 2d 32 34 31 35 0d 0a 2d 36 31 34 31 0d 0a 0d  .-2415..-6141...
61d0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
61e0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
61f0: 31 20 2a 20 2d 20 33 35 20 41 53 20 63 6f 6c 32  1 * - 35 AS col2
6200: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
6210: 0d 0a 2d 31 30 38 35 0d 0a 2d 32 30 36 35 0d 0a  ..-1085..-2065..
6220: 2d 35 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -595....query I 
6230: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
6240: 2b 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 31 2e  + col1 * - tab1.
6250: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col0 * - col0 AS
6260: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
6270: 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39 36  .----..234..4096
6280: 30 0d 0a 38 33 32 30 30 0d 0a 0d 0a 71 75 65 72  0..83200....quer
6290: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
62a0: 45 43 54 20 41 4c 4c 20 2d 20 35 35 20 2a 20 2b  ECT ALL - 55 * +
62b0: 20 63 6f 6c 32 20 2d 20 2b 20 31 30 20 41 53 20   col2 - + 10 AS 
62c0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
62d0: 2d 2d 2d 2d 0d 0a 2d 31 38 32 35 0d 0a 2d 34 35  ----..-1825..-45
62e0: 32 30 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72 79  20..-65....query
62f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6300: 43 54 20 44 49 53 54 49 4e 43 54 20 35 32 20 2d  CT DISTINCT 52 -
6310: 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 36 30 20 46   - col2 * - 60 F
6320: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
6330: 2d 31 39 32 38 0d 0a 2d 34 38 36 38 0d 0a 2d 38  -1928..-4868..-8
6340: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6350: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
6360: 34 34 20 2d 20 2d 20 74 61 62 30 2e 63 6f 6c 30  44 - - tab0.col0
6370: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
6380: 0d 0a 31 33 33 0d 0a 36 38 0d 0a 37 39 0d 0a 0d  ..133..68..79...
6390: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
63a0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
63b0: 54 20 37 37 20 2a 20 31 20 46 52 4f 4d 20 74 61  T 77 * 1 FROM ta
63c0: 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
63d0: 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 0d 0a 6f 6e  ..----..77....on
63e0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
63f0: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
6400: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
6410: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
6420: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6430: 20 6c 61 62 65 6c 2d 31 35 37 0d 0a 53 45 4c 45   label-157..SELE
6440: 43 54 20 43 41 53 54 28 20 34 33 20 41 53 20 53  CT CAST( 43 AS S
6450: 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 31 20 2b  IGNED ) * col1 +
6460: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   - col1 * col2 F
6470: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
6480: 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 33 0d 0a 34 39  ..----..1003..49
6490: 36 0d 0a 38 35 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..85....skipif 
64a0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
64b0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
64c0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
64d0: 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  7..SELECT CAST (
64e0: 20 34 33 20 41 53 20 49 4e 54 45 47 45 52 20 29   43 AS INTEGER )
64f0: 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31   * col1 + - col1
6500: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
6510: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
6520: 0a 31 30 30 33 0d 0a 34 39 36 0d 0a 38 35 0d 0a  .1003..496..85..
6530: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
6540: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
6550: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
6560: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
6570: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
6580: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6590: 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20  CT ALL + + col0 
65a0: 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  * + col2 col2 FR
65b0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
65c0: 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d  .----..35..7298.
65d0: 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .792....query I 
65e0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
65f0: 44 49 53 54 49 4e 43 54 20 35 30 20 2a 20 63 6f  DISTINCT 50 * co
6600: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
6610: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 30 0d  cor0..----..350.
6620: 0a 33 39 30 30 0d 0a 33 39 35 30 0d 0a 0d 0a 71  .3900..3950....q
6630: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6640: 53 45 4c 45 43 54 20 34 37 20 41 53 20 63 6f 6c  SELECT 47 AS col
6650: 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
6660: 0d 0a 2d 2d 2d 2d 0d 0a 34 37 0d 0a 34 37 0d 0a  ..----..47..47..
6670: 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  47....query I ro
6680: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
6690: 33 34 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  34 FROM tab0, ta
66a0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
66b0: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
66c0: 6e 67 20 74 6f 20 31 31 34 36 64 31 35 39 66 30  ng to 1146d159f0
66d0: 62 39 62 34 33 37 38 61 38 62 37 33 38 62 39 36  b9b4378a8b738b96
66e0: 33 66 37 30 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  3f7039....onlyif
66f0: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
6700: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
6710: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
6720: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6730: 6c 61 62 65 6c 2d 31 36 32 0d 0a 53 45 4c 45 43  label-162..SELEC
6740: 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 44 49 56  T ALL - col1 DIV
6750: 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   + ( col0 ) FROM
6760: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d   tab1..----..-8.
6770: 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
6780: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
6790: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
67a0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
67b0: 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  2..SELECT ALL - 
67c0: 63 6f 6c 31 20 2f 20 2b 20 28 20 63 6f 6c 30 20  col1 / + ( col0 
67d0: 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
67e0: 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  -..-8..0..0....q
67f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6800: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
6810: 63 6f 6c 32 20 2b 20 28 20 37 36 20 2b 20 63 6f  col2 + ( 76 + co
6820: 6c 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l2 ) AS col1 FRO
6830: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab2..----..12
6840: 38 0d 0a 31 33 30 0d 0a 31 35 32 0d 0a 0d 0a 71  8..130..152....q
6850: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
6860: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20  SELECT - col1 - 
6870: 28 20 32 37 20 2a 20 63 6f 6c 30 20 29 20 41 53  ( 27 * col0 ) AS
6880: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
6890: 0a 2d 2d 2d 2d 0d 0a 2d 32 31 35 30 0d 0a 2d 32  .----..-2150..-2
68a0: 31 36 35 0d 0a 2d 32 32 30 0d 0a 0d 0a 6f 6e 6c  165..-220....onl
68b0: 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
68c0: 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
68d0: 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
68e0: 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
68f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
6900: 6c 61 62 65 6c 2d 31 36 35 0d 0a 53 45 4c 45 43  label-165..SELEC
6910: 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28  T DISTINCT CAST(
6920: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
6930: 29 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  ) * cor0.col2 AS
6940: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
6950: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
6960: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
6970: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
6980: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
6990: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
69a0: 6c 2d 31 36 35 0d 0a 53 45 4c 45 43 54 20 44 49  l-165..SELECT DI
69b0: 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 4e 55  STINCT CAST ( NU
69c0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
69d0: 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  * cor0.col2 AS c
69e0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
69f0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
6a00: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  -..NULL....onlyi
6a10: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
6a20: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
6a30: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
6a40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6a50: 20 6c 61 62 65 6c 2d 31 36 36 0d 0a 53 45 4c 45   label-166..SELE
6a60: 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f  CT - col1 DIV co
6a70: 6c 31 20 2b 20 2d 20 33 34 20 46 52 4f 4d 20 74  l1 + - 34 FROM t
6a80: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
6a90: 2d 0d 0a 2d 33 35 0d 0a 2d 33 35 0d 0a 2d 33 35  -..-35..-35..-35
6aa0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
6ab0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
6ac0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
6ad0: 72 74 20 6c 61 62 65 6c 2d 31 36 36 0d 0a 53 45  rt label-166..SE
6ae0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63 6f  LECT - col1 / co
6af0: 6c 31 20 2b 20 2d 20 33 34 20 46 52 4f 4d 20 74  l1 + - 34 FROM t
6b00: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
6b10: 2d 0d 0a 2d 33 35 0d 0a 2d 33 35 0d 0a 2d 33 35  -..-35..-35..-35
6b20: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
6b30: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
6b40: 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l1 * - cor0.col2
6b50: 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32   + col1 * - col2
6b60: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   + cor0.col2 * c
6b70: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
6b80: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
6b90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  r0..----..1534..
6ba0: 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72  646..837....quer
6bb0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6bc0: 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
6bd0: 31 20 2d 20 38 32 20 46 52 4f 4d 20 74 61 62 32  1 - 82 FROM tab2
6be0: 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab0 cor0..---
6bf0: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
6c00: 69 6e 67 20 74 6f 20 32 62 34 64 32 61 31 61 39  ing to 2b4d2a1a9
6c10: 66 32 66 66 36 34 65 36 61 39 63 36 38 37 30 38  f2ff64e6a9c68708
6c20: 37 61 32 39 31 64 32 0d 0a 0d 0a 71 75 65 72 79  7a291d2....query
6c30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6c40: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
6c50: 2e 63 6f 6c 30 20 2a 20 2b 20 28 20 39 36 20 29  .col0 * + ( 96 )
6c60: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
6c70: 62 31 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41  b1, tab0, tab1 A
6c80: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
6c90: 38 0d 0a 36 31 34 34 0d 0a 37 36 38 30 0d 0a 0d  8..6144..7680...
6ca0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
6cb0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
6cc0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
6cd0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
6ce0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 30  owsort label-170
6cf0: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
6d00: 44 49 56 20 37 35 20 46 52 4f 4d 20 74 61 62 32  DIV 75 FROM tab2
6d10: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
6d20: 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69  -1..-1..0....ski
6d30: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
6d40: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
6d50: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
6d60: 6c 2d 31 37 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-170..SELECT - 
6d70: 63 6f 6c 30 20 2f 20 37 35 20 46 52 4f 4d 20 74  col0 / 75 FROM t
6d80: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
6d90: 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a  -..-1..-1..0....
6da0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6db0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
6dc0: 6f 6c 32 20 2a 20 2d 20 39 31 20 41 53 20 63 6f  ol2 * - 91 AS co
6dd0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
6de0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 31  cor0..----..-491
6df0: 34 0d 0a 2d 35 31 38 37 0d 0a 2d 38 37 33 36 0d  4..-5187..-8736.
6e00: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6e10: 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
6e20: 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  + col0 * - col2 
6e30: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
6e40: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 0d 0a 2d 37  0..----..-34..-7
6e50: 32 31 36 0d 0a 2d 37 35 39 0d 0a 0d 0a 71 75 65  216..-759....que
6e60: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
6e70: 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20  LECT - - col0 * 
6e80: 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31  cor0.col0 * col1
6e90: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
6ea0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
6eb0: 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38 33  ..234..40960..83
6ec0: 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  200....query I r
6ed0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34  owsort..SELECT 4
6ee0: 38 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  8 + col2 * col1 
6ef0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
6f00: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 36 0d 0a 31  0..----..1296..1
6f10: 34 35 32 0d 0a 36 31 38 0d 0a 0d 0a 73 6b 69 70  452..618....skip
6f20: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
6f30: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
6f40: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
6f50: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
6f60: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
6f70: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
6f80: 20 2b 20 35 33 20 29 20 2a 20 63 6f 6c 31 20 63   + 53 ) * col1 c
6f90: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
6fa0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
6fb0: 37 38 0d 0a 2d 35 33 30 0d 0a 2d 36 38 39 0d 0a  78..-530..-689..
6fc0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6fd0: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38 37 20 2b  t..SELECT + 87 +
6fe0: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
6ff0: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 37 0d 0a  1..----..23..7..
7000: 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  84....onlyif mys
7010: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
7020: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
7030: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
7040: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
7050: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
7060: 37 37 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  77..SELECT CAST(
7070: 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
7080: 29 20 2b 20 32 33 20 41 53 20 63 6f 6c 32 20 46  ) + 23 AS col2 F
7090: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
70a0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
70b0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
70c0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
70d0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
70e0: 72 74 20 6c 61 62 65 6c 2d 31 37 37 0d 0a 53 45  rt label-177..SE
70f0: 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c  LECT CAST ( NULL
7100: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
7110: 32 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  23 AS col2 FROM 
7120: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
7130: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
7140: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
7150: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
7160: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
7170: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
7180: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 38 0d  wsort label-178.
7190: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
71a0: 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 72 30 2e  col1 DIV - cor0.
71b0: 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col2 + + col2 AS
71c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
71d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
71e0: 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69  4..57..96....ski
71f0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
7200: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
7210: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7220: 6c 2d 31 37 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-178..SELECT AL
7230: 4c 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 63  L - + col1 / - c
7240: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  or0.col2 + + col
7250: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
7260: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
7270: 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
7280: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
7290: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
72a0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
72b0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
72c0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
72d0: 6f 72 74 20 6c 61 62 65 6c 2d 31 37 39 0d 0a 53  ort label-179..S
72e0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
72f0: 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20 53   CAST( col0 AS S
7300: 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 46  IGNED ) * col0 F
7310: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
7320: 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d 0a 36 34  ..----..4096..64
7330: 30 30 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  00..9....skipif 
7340: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
7350: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
7360: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37  rowsort label-17
7370: 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
7380: 43 54 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 30  CT + CAST ( col0
7390: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
73a0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
73b0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30  S cor0..----..40
73c0: 39 36 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71  96..6400..9....q
73d0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
73e0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
73f0: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  - cor0.col2 + + 
7400: 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col1 * - col1 FR
7410: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
7420: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 37 0d 0a 2d 32 36  .----..-157..-26
7430: 35 0d 0a 2d 37 33 30 0d 0a 0d 0a 71 75 65 72 79  5..-730....query
7440: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7450: 43 54 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31  CT col0 * - col1
7460: 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   + - col2 FROM t
7470: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36  ab1..----..-1136
7480: 0d 0a 2d 31 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a  ..-132..-697....
7490: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
74a0: 0a 53 45 4c 45 43 54 20 2d 20 38 34 20 2b 20 2d  .SELECT - 84 + -
74b0: 20 35 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   54 AS col1 FROM
74c0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab2..----..-13
74d0: 38 0d 0a 2d 31 33 38 0d 0a 2d 31 33 38 0d 0a 0d  8..-138..-138...
74e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
74f0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
7500: 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col0 + - tab1.co
7510: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
7520: 2d 2d 0d 0a 2d 31 37 0d 0a 34 30 38 36 0d 0a 36  --..-17..4086..6
7530: 33 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  387....query I r
7540: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
7550: 4c 4c 20 2d 20 2d 20 31 35 20 41 53 20 63 6f 6c  LL - - 15 AS col
7560: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
7570: 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 31 35 0d 0a  ..----..15..15..
7580: 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  15....query I ro
7590: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
75a0: 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e  + col1 + + cor0.
75b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
75c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
75d0: 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72  ..26..52....quer
75e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
75f0: 45 43 54 20 2b 20 36 31 20 41 53 20 63 6f 6c 30  ECT + 61 AS col0
7600: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
7610: 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 36 31 0d 0a 36  .----..61..61..6
7620: 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  1....skipif post
7630: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
7640: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
7650: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
7660: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
7670: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
7680: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
7690: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 63   col2 + + col0 c
76a0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
76b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
76c0: 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72  ..41..52....quer
76d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
76e0: 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
76f0: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 28  ol0 * + col2 + (
7700: 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 30   col0 ) * + col0
7710: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
7720: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7730: 0d 0a 2d 32 31 36 0d 0a 31 31 39 30 0d 0a 36 32  ..-216..1190..62
7740: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
7750: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
7760: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b   + cor0.col0 + +
7770: 20 63 6f 6c 32 20 2a 20 2b 20 37 38 20 46 52 4f   col2 * + 78 FRO
7780: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
7790: 2d 0d 0a 31 31 33 0d 0a 32 35 39 38 0d 0a 36 34  -..113..2598..64
77a0: 38 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  85....skipif pos
77b0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
77c0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
77d0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
77e0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
77f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7800: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7810: 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  + col2 + + cor0.
7820: 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 30 20  col2 * + ( col0 
7830: 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  ) col2 FROM tab1
7840: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7850: 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37 37 36 0d  216..3705..7776.
7860: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7870: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
7880: 4e 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b  NCT + - col2 * +
7890: 20 63 6f 6c 32 20 2b 20 2d 20 37 36 20 2a 20 63   col2 + - 76 * c
78a0: 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
78b0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
78c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 38 38  r0..----..-13488
78d0: 0d 0a 2d 32 36 36 31 0d 0a 2d 32 39 31 33 0d 0a  ..-2661..-2913..
78e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
78f0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
7900: 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  - ( + cor0.col1 
7910: 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
7920: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39  or0..----..86..9
7930: 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  1..97....query I
7940: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7950: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
7960: 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
7970: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
7980: 0a 31 36 32 32 34 0d 0a 33 36 35 30 34 0d 0a 35  .16224..36504..5
7990: 37 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  700....query I r
79a0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
79b0: 20 63 6f 6c 32 20 2a 20 2d 20 74 61 62 31 2e 63   col2 * - tab1.c
79c0: 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f  ol0 - - col1 FRO
79d0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38  M tab1..----..18
79e0: 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d  8..3658..7693...
79f0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
7a00: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
7a10: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
7a20: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
7a30: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 35  owsort label-195
7a40: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 20 44  ..SELECT ALL 2 D
7a50: 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV - col0 FROM t
7a60: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
7a70: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
7a80: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
7a90: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
7aa0: 73 6f 72 74 20 6c 61 62 65 6c 2d 31 39 35 0d 0a  sort label-195..
7ab0: 53 45 4c 45 43 54 20 41 4c 4c 20 32 20 2f 20 2d  SELECT ALL 2 / -
7ac0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
7ad0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
7ae0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7af0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
7b00: 43 54 20 2b 20 2d 20 35 36 20 2a 20 2d 20 63 6f  CT + - 56 * - co
7b10: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
7b20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 32 0d  cor0..----..392.
7b30: 0a 34 33 36 38 0d 0a 34 34 32 34 0d 0a 0d 0a 71  .4368..4424....q
7b40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7b50: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 35 20  SELECT ALL - 85 
7b60: 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * - col2 AS col2
7b70: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
7b80: 0a 2d 2d 2d 2d 0d 0a 34 35 39 30 0d 0a 34 38 34  .----..4590..484
7b90: 35 0d 0a 38 31 36 30 0d 0a 0d 0a 71 75 65 72 79  5..8160....query
7ba0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7bb0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38 37  CT DISTINCT + 87
7bc0: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
7bd0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
7be0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 31 36  0..----..165..16
7bf0: 36 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  6..94....query I
7c00: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
7c10: 20 44 49 53 54 49 4e 43 54 20 63 6f 72 31 2e 63   DISTINCT cor1.c
7c20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
7c30: 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
7c40: 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
7c50: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33  or1..----..1..33
7c60: 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..82....query I 
7c70: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7c80: 41 4c 4c 20 2d 20 63 6f 6c 32 20 2d 20 2d 20 63  ALL - col2 - - c
7c90: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
7ca0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
7cb0: 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37  ---..-16..-51..7
7cc0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
7cd0: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
7ce0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
7cf0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
7d00: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
7d10: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 31  owsort label-201
7d20: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
7d30: 32 20 2f 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  2 / - CAST( NULL
7d40: 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2b 20   AS DECIMAL ) + 
7d50: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
7d60: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
7d70: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
7d80: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
7d90: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
7da0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
7db0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7dc0: 32 30 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  201..SELECT + + 
7dd0: 63 6f 6c 32 20 2f 20 2d 20 43 41 53 54 20 28 20  col2 / - CAST ( 
7de0: 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b  NULL AS REAL ) +
7df0: 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   + col1 * col2 F
7e00: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
7e10: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
7e20: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
7e30: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
7e40: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
7e50: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
7e60: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
7e70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
7e80: 61 62 65 6c 2d 32 30 32 0d 0a 53 45 4c 45 43 54  abel-202..SELECT
7e90: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31   DISTINCT + col1
7ea0: 20 2b 20 2d 20 28 20 63 6f 72 30 2e 63 6f 6c 32   + - ( cor0.col2
7eb0: 20 29 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20   ) - - col0 * + 
7ec0: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
7ed0: 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
7ee0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7ef0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
7f00: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
7f10: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
7f20: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30 32  owsort label-202
7f30: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
7f40: 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20 63  T + col1 + - ( c
7f50: 6f 72 30 2e 63 6f 6c 32 20 29 20 2d 20 2d 20 63  or0.col2 ) - - c
7f60: 6f 6c 30 20 2a 20 2b 20 43 41 53 54 20 28 20 4e  ol0 * + CAST ( N
7f70: 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
7f80: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
7f90: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
7fa0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7fb0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d  t..SELECT col0 -
7fc0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f   col1 * col0 FRO
7fd0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
7fe0: 2d 2d 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d 37 35 0d  ----..-576..-75.
7ff0: 0a 2d 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-960....query I
8000: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8010: 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2b 20   ALL + + col0 + 
8020: 2b 20 37 36 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 76 AS col2 FRO
8030: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
8040: 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 31 31 0d 0a  ----..100..111..
8050: 31 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  165....query I r
8060: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
8070: 4c 4c 20 63 6f 6c 32 20 2b 20 28 20 2d 20 30 20  LL col2 + ( - 0 
8080: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
8090: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
80a0: 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
80b0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
80c0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
80d0: 6f 6c 32 20 2b 20 32 39 20 41 53 20 63 6f 6c 31  ol2 + 29 AS col1
80e0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
80f0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 35  r0..----..-4..-5
8100: 33 0d 0a 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  3..28....query I
8110: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8120: 20 2d 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   - - col1 + - co
8130: 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
8140: 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
8150: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
8160: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8170: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
8180: 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 * cor0.col2 
8190: 2b 20 32 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 25 AS col1 FRO
81a0: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
81b0: 2d 2d 2d 2d 0d 0a 31 32 37 33 0d 0a 31 34 32 39  ----..1273..1429
81c0: 0d 0a 35 39 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..595....query I
81d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
81e0: 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2a 20   ALL + + col1 * 
81f0: 32 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  26 AS col1 FROM 
8200: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
8210: 0a 31 35 33 34 0d 0a 34 34 32 0d 0a 38 30 36 0d  .1534..442..806.
8220: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8230: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
8240: 20 38 37 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f   87 * col2 AS co
8250: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
8260: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 39  cor0..----..-469
8270: 38 0d 0a 2d 34 39 35 39 0d 0a 2d 38 33 35 32 0d  8..-4959..-8352.
8280: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
8290: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 39  rt..SELECT + + 9
82a0: 34 20 2a 20 2b 20 34 30 20 2b 20 2b 20 63 6f 6c  4 * + 40 + + col
82b0: 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
82c0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
82d0: 2d 0d 0a 33 37 36 37 0d 0a 33 38 33 38 0d 0a 33  -..3767..3838..3
82e0: 38 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  839....skipif po
82f0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
8300: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
8310: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
8320: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
8330: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8340: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
8350: 20 36 20 2a 20 2d 20 32 32 20 63 6f 6c 30 20 46   6 * - 22 col0 F
8360: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
8370: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 0d 0a  ..----..-132....
8380: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
8390: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
83a0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
83b0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
83c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 31 33 0d  wsort label-213.
83d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
83e0: 6c 31 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c 31  l1 * col2 - col1
83f0: 20 44 49 56 20 28 20 2b 20 63 6f 6c 32 20 2a 20   DIV ( + col2 * 
8400: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  + cor0.col2 + + 
8410: 63 6f 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 31 20  col2 * + ( col1 
8420: 29 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ) ) FROM tab0 AS
8430: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   cor0..----..283
8440: 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 73  8..7462..97....s
8450: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
8460: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
8470: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
8480: 62 65 6c 2d 32 31 33 0d 0a 53 45 4c 45 43 54 20  bel-213..SELECT 
8490: 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ALL + col1 * col
84a0: 32 20 2d 20 63 6f 6c 31 20 2f 20 28 20 2b 20 63  2 - col1 / ( + c
84b0: 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
84c0: 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 28  2 + + col2 * + (
84d0: 20 63 6f 6c 31 20 29 20 29 20 46 52 4f 4d 20 74   col1 ) ) FROM t
84e0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
84f0: 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39  -..2838..7462..9
8500: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
8510: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
8520: 54 49 4e 43 54 20 2b 20 32 20 2b 20 2b 20 38 33  TINCT + 2 + + 83
8530: 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
8540: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8550: 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
8560: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
8570: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 46 52  STINCT + col2 FR
8580: 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
8590: 54 20 63 6f 6c 32 20 3e 3d 20 4e 55 4c 4c 0d 0a  T col2 >= NULL..
85a0: 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ----....onlyif m
85b0: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
85c0: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
85d0: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
85e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
85f0: 62 65 6c 2d 32 31 36 0d 0a 53 45 4c 45 43 54 20  bel-216..SELECT 
8600: 63 6f 6c 32 20 44 49 56 20 2b 20 74 61 62 31 2e  col2 DIV + tab1.
8610: 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30 20 63 6f  col0 - - col0 co
8620: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
8630: 2d 2d 0d 0a 32 31 0d 0a 36 34 0d 0a 38 31 0d 0a  --..21..64..81..
8640: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
8650: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
8660: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
8670: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
8680: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
8690: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
86a0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
86b0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
86c0: 32 31 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  216..SELECT col2
86d0: 20 2f 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2d   / + tab1.col0 -
86e0: 20 2d 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   - col0 col2 FRO
86f0: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31  M tab1..----..21
8700: 0d 0a 36 34 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72  ..64..81....quer
8710: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8720: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
8730: 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 * col2 FROM 
8740: 74 61 62 30 20 57 48 45 52 45 20 28 20 4e 55 4c  tab0 WHERE ( NUL
8750: 4c 20 29 20 3e 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d  L ) >= NULL..---
8760: 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  -....onlyif mysq
8770: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
8780: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
8790: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
87a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
87b0: 2d 32 31 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -218..SELECT - c
87c0: 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20 2d 20 2d  ol2 DIV col2 - -
87d0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
87e0: 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39  .----..53..56..9
87f0: 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
8800: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
8810: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
8820: 6f 72 74 20 6c 61 62 65 6c 2d 32 31 38 0d 0a 53  ort label-218..S
8830: 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2f 20 63  ELECT - col2 / c
8840: 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32 20 46 52 4f  ol2 - - col2 FRO
8850: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 33  M tab1..----..53
8860: 0d 0a 35 36 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70  ..56..95....skip
8870: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
8880: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
8890: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
88a0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
88b0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
88c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
88d0: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 63 6f 6c   col1 * col1 col
88e0: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
88f0: 2d 0d 0a 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36  -..289..3481..96
8900: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
8910: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
8920: 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30   + col2 + + col0
8930: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
8940: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31  b1..----..121..1
8950: 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  76..57....query 
8960: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8970: 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  T cor0.col0 + - 
8980: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
8990: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
89a0: 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36  ----..-23..54..6
89b0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
89c0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
89d0: 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20  1.col0 * col0 * 
89e0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
89f0: 2d 2d 2d 2d 0d 0a 32 36 32 31 34 34 0d 0a 32 37  ----..262144..27
8a00: 0d 0a 35 31 32 30 30 30 0d 0a 0d 0a 71 75 65 72  ..512000....quer
8a10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8a20: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
8a30: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 2d  ol0 * + col1 * -
8a40: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
8a50: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 30 39 37 0d 0a  .----..-106097..
8a60: 2d 31 35 31 39 0d 0a 2d 33 35 38 39 35 36 0d 0a  -1519..-358956..
8a70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8a80: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
8a90: 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 31   + + col1 + col1
8aa0: 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   * col1 * + col0
8ab0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
8ac0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33 37 0d  b1..----..13437.
8ad0: 0a 32 30 30 30 0d 0a 36 33 35 33 0d 0a 0d 0a 71  .2000..6353....q
8ae0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8af0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
8b00: 74 61 62 32 2e 63 6f 6c 30 20 2b 20 2d 20 63 6f  tab2.col0 + - co
8b10: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
8b20: 2d 2d 0d 0a 2d 34 37 0d 0a 32 36 0d 0a 33 0d 0a  --..-47..26..3..
8b30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8b40: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
8b50: 43 54 20 63 6f 6c 32 20 2b 20 2d 20 74 61 62 31  CT col2 + - tab1
8b60: 2e 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f  .col0 - col0 FRO
8b70: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  M tab1..----..-6
8b80: 34 0d 0a 2d 37 31 0d 0a 34 38 0d 0a 0d 0a 71 75  4..-71..48....qu
8b90: 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
8ba0: 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
8bb0: 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 2b 20  ab2 WHERE NOT + 
8bc0: 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  col2 + col2 + co
8bd0: 6c 31 20 49 4e 20 28 20 2d 20 74 61 62 32 2e 63  l1 IN ( - tab2.c
8be0: 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76  ol2 )..----..9 v
8bf0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
8c00: 20 61 64 30 35 62 35 39 34 32 34 30 30 64 35 65   ad05b5942400d5e
8c10: 37 61 32 31 62 33 32 33 62 33 64 61 36 35 61 34  7a21b323b3da65a4
8c20: 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
8c30: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
8c40: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b  ol2 * - col1 + +
8c50: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
8c60: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
8c70: 31 32 33 35 0d 0a 2d 31 33 37 38 0d 0a 2d 35 36  1235..-1378..-56
8c80: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
8c90: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
8ca0: 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ab1.col1 * - col
8cb0: 31 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  1 + + col1 * - c
8cc0: 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
8cd0: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   tab1..----..-54
8ce0: 30 0d 0a 2d 38 37 31 0d 0a 35 39 38 0d 0a 0d 0a  0..-871..598....
8cf0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
8d00: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
8d10: 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 2d   + tab1.col2 * -
8d20: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
8d30: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33 36 0d 0a  .----..-207936..
8d40: 2d 37 33 37 32 38 30 0d 0a 2d 38 37 34 38 0d 0a  -737280..-8748..
8d50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8d60: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
8d70: 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   * col1 + + col2
8d80: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
8d90: 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39 38 38  ..327..3507..988
8da0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
8db0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
8dc0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
8dd0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
8de0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8df0: 32 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  232..SELECT ALL 
8e00: 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  + col2 DIV col0 
8e10: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + - col0 AS col2
8e20: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
8e30: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 37  r0..----..-4..-7
8e40: 38 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66  8..-79....skipif
8e50: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
8e60: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
8e70: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8e80: 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  32..SELECT ALL +
8e90: 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 2d   col2 / col0 + -
8ea0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
8eb0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
8ec0: 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 37 38 0d 0a  .----..-4..-78..
8ed0: 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -79....query I r
8ee0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
8ef0: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
8f00: 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   - col1 + + col2
8f10: 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   - + col1 AS col
8f20: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
8f30: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 34 0d  or0..----..1364.
8f40: 0a 32 31 33 0d 0a 34 35 36 39 0d 0a 0d 0a 71 75  .213..4569....qu
8f50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
8f60: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
8f70: 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   + col1 + - col0
8f80: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
8f90: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8fa0: 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d  .-3..-64..-80...
8fb0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
8fc0: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
8fd0: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
8fe0: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
8ff0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 35  owsort label-235
9000: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
9010: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63   col2 + col0 * c
9020: 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 41 53 20  ol0 DIV col0 AS 
9030: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
9040: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
9050: 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 73 6b  4..117..34....sk
9060: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
9070: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
9080: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
9090: 65 6c 2d 32 33 35 0d 0a 53 45 4c 45 43 54 20 41  el-235..SELECT A
90a0: 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63 6f  LL - - col2 + co
90b0: 6c 30 20 2a 20 63 6f 6c 30 20 2f 20 63 6f 6c 30  l0 * col0 / col0
90c0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
90d0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
90e0: 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a  ..104..117..34..
90f0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
9100: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
9110: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
9120: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
9130: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
9140: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9150: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20  CT ALL - col0 + 
9160: 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20 46  cor0.col2 col0 F
9170: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
9180: 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36 0d 0a  ..----..-7..16..
9190: 35 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  51....skipif pos
91a0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
91b0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
91c0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
91d0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
91e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
91f0: 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32  SELECT tab2.col2
9200: 20 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   * col2 * + col0
9210: 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 63 6f 6c   + tab2.col1 col
9220: 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
9230: 2d 0d 0a 31 31 34 30 39 33 0d 0a 35 31 33 34 0d  -..114093..5134.
9240: 0a 35 32 37 38 37 0d 0a 0d 0a 71 75 65 72 79 20  .52787....query 
9250: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9260: 54 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2d 20  T tab2.col1 * - 
9270: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52  col2 + - col0 FR
9280: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
9290: 31 36 31 32 0d 0a 2d 37 32 35 0d 0a 2d 38 34 34  1612..-725..-844
92a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
92b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
92c0: 4c 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 57 48  L * FROM tab0 WH
92d0: 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20 2d 20  ERE NULL IN ( - 
92e0: 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col1 )..----....
92f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9300: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
9310: 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2b   col1 * col1 * +
9320: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
9330: 0a 2d 2d 2d 2d 0d 0a 31 37 37 35 32 38 0d 0a 33  .----..177528..3
9340: 32 39 33 35 30 0d 0a 37 33 37 30 39 38 0d 0a 0d  29350..737098...
9350: 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
9360: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
9370: 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20  NCT * FROM tab0 
9380: 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20 28 20  WHERE NULL IN ( 
9390: 2b 20 74 61 62 30 2e 63 6f 6c 31 20 29 0d 0a 2d  + tab0.col1 )..-
93a0: 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ---....onlyif my
93b0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
93c0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
93d0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
93e0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
93f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
9400: 32 34 32 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  242..SELECT + co
9410: 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l1 * CAST( NULL 
9420: 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f  AS DECIMAL ) FRO
9430: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
9440: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
9450: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
9460: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
9470: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
9480: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 34 32 0d  wsort label-242.
9490: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
94a0: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
94b0: 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32  REAL ) FROM tab2
94c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
94d0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
94e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
94f0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
9500: 32 20 2a 20 28 20 32 34 20 29 20 41 53 20 63 6f  2 * ( 24 ) AS co
9510: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
9520: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 39 36  cor0..----..1296
9530: 0d 0a 31 33 36 38 0d 0a 32 33 30 34 0d 0a 0d 0a  ..1368..2304....
9540: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9550: 0a 53 45 4c 45 43 54 20 2b 20 31 32 20 41 53 20  .SELECT + 12 AS 
9560: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20  col0 FROM tab0, 
9570: 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
9580: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r0..----..27 val
9590: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37  ues hashing to 7
95a0: 30 32 34 37 38 63 35 33 63 61 66 32 66 37 65 62  02478c53caf2f7eb
95b0: 62 39 66 66 66 39 36 64 38 30 30 66 35 61 36 0d  b9fff96d800f5a6.
95c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
95d0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
95e0: 20 31 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   10 AS col0 FROM
95f0: 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
9600: 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
9610: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
9620: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 62  es hashing to bb
9630: 37 66 37 35 34 61 37 61 30 35 36 65 36 36 35 31  7f754a7a056e6651
9640: 35 35 65 64 35 32 61 36 33 66 35 62 63 30 0d 0a  55ed52a63f5bc0..
9650: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9660: 74 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 32  t..SELECT ( col2
9670: 20 2b 20 36 37 20 29 20 46 52 4f 4d 20 74 61 62   + 67 ) FROM tab
9680: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 39 33  2..----..105..93
9690: 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..94....query I 
96a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
96b0: 41 4c 4c 20 2d 20 2d 20 33 31 20 2b 20 63 6f 6c  ALL - - 31 + col
96c0: 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  1 * - col1 FROM 
96d0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
96e0: 2d 2d 0d 0a 2d 31 33 38 0d 0a 2d 36 34 35 0d 0a  --..-138..-645..
96f0: 2d 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -69....query I r
9700: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34  owsort..SELECT 4
9710: 36 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  6 + - cor0.col1 
9720: 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
9730: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
9740: 0d 0a 2d 31 34 38 38 0d 0a 2d 36 30 30 0d 0a 2d  ..-1488..-600..-
9750: 37 39 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  791....onlyif my
9760: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
9770: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
9780: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
9790: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
97a0: 65 6c 2d 32 34 39 0d 0a 53 45 4c 45 43 54 20 2b  el-249..SELECT +
97b0: 20 63 6f 6c 30 20 44 49 56 20 2d 20 31 35 20 41   col0 DIV - 15 A
97c0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
97d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 2d 35 0d 0a  ..----..-4..-5..
97e0: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
97f0: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
9800: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
9810: 6f 72 74 20 6c 61 62 65 6c 2d 32 34 39 0d 0a 53  ort label-249..S
9820: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2d  ELECT + col0 / -
9830: 20 31 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   15 AS col2 FROM
9840: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d   tab1..----..-4.
9850: 0a 2d 35 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5..0....onlyif
9860: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
9870: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
9880: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
9890: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
98a0: 6c 61 62 65 6c 2d 32 35 30 0d 0a 53 45 4c 45 43  label-250..SELEC
98b0: 54 20 63 6f 6c 31 20 44 49 56 20 36 35 20 41 53  T col1 DIV 65 AS
98c0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
98d0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
98e0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
98f0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
9900: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9910: 20 6c 61 62 65 6c 2d 32 35 30 0d 0a 53 45 4c 45   label-250..SELE
9920: 43 54 20 63 6f 6c 31 20 2f 20 36 35 20 41 53 20  CT col1 / 65 AS 
9930: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
9940: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
9950: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9960: 0d 0a 53 45 4c 45 43 54 20 36 20 41 53 20 63 6f  ..SELECT 6 AS co
9970: 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
9980: 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30  b1 AS cor0, tab0
9990: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
99a0: 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
99b0: 67 20 74 6f 20 66 31 65 38 66 30 31 39 39 66 33  g to f1e8f0199f3
99c0: 37 31 34 65 65 38 66 63 63 32 34 63 65 30 63 63  714ee8fcc24ce0cc
99d0: 33 65 61 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49  3ea04....query I
99e0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
99f0: 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 63 6f   DISTINCT - ( co
9a00: 72 30 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74  r0.col2 ) FROM t
9a10: 61 62 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab0 cor0 CROSS J
9a20: 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31  OIN tab0 AS cor1
9a30: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d  ..----..-1..-33.
9a40: 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
9a50: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9a60: 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  - cor0.col1 + + 
9a70: 33 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  33 AS col0 FROM 
9a80: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
9a90: 2d 2d 0d 0a 32 30 0d 0a 32 33 0d 0a 37 0d 0a 0d  --..20..23..7...
9aa0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9ab0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
9ac0: 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c  ol2 * col2 - col
9ad0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
9ae0: 2d 0d 0a 2d 31 34 38 32 0d 0a 2d 37 30 32 0d 0a  -..-1482..-702..
9af0: 2d 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -756....query I 
9b00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9b10: 2b 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 32 2e  + col0 * - tab2.
9b20: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
9b30: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
9b40: 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32  343..-217..-4602
9b50: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9b60: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
9b70: 63 6f 6c 30 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col0 + - tab1.co
9b80: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
9b90: 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20 28  tab1 WHERE NOT (
9ba0: 20 4e 55 4c 4c 20 29 20 3e 3d 20 4e 55 4c 4c 0d   NULL ) >= NULL.
9bb0: 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
9bc0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9bd0: 20 44 49 53 54 49 4e 43 54 20 28 20 63 6f 6c 31   DISTINCT ( col1
9be0: 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20   ) + + col1 + - 
9bf0: 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab1.col1 AS col
9c00: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
9c10: 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d  -..10..13..26...
9c20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9c30: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
9c40: 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  1 * - col1 + - c
9c50: 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
9c60: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
9c70: 2d 2d 2d 0d 0a 2d 31 35 37 0d 0a 2d 32 36 35 0d  ---..-157..-265.
9c80: 0a 2d 37 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-730....query I
9c90: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
9ca0: 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + - col0 * + co
9cb0: 6c 30 20 2b 20 2d 20 31 31 20 2a 20 63 6f 72 30  l0 + - 11 * cor0
9cc0: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
9cd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
9ce0: 31 35 32 32 0d 0a 2d 32 32 39 32 0d 0a 2d 38 39  1522..-2292..-89
9cf0: 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
9d00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
9d10: 33 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  3 + cor0.col2 * 
9d20: 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  + col1 + + col1 
9d30: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
9d40: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 30 0d 0a 36  0..----..1590..6
9d50: 36 30 0d 0a 38 36 35 0d 0a 0d 0a 71 75 65 72 79  60..865....query
9d60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
9d70: 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  CT + - col0 * co
9d80: 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l1 + + col0 FROM
9d90: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
9da0: 2d 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d 37 35 0d 0a  ---..-576..-75..
9db0: 2d 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -960....query I 
9dc0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9dd0: 2b 20 63 6f 6c 30 20 2b 20 2d 20 28 20 30 20 29  + col0 + - ( 0 )
9de0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
9df0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
9e00: 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a  ..24..35..89....
9e10: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
9e20: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
9e30: 63 6f 6c 31 20 2a 20 2d 20 36 35 20 41 53 20 63  col1 * - 65 AS c
9e40: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
9e50: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35   cor0..----..-55
9e60: 39 30 0d 0a 2d 35 39 31 35 0d 0a 2d 36 33 30 35  90..-5915..-6305
9e70: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
9e80: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
9e90: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
9ea0: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
9eb0: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
9ec0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9ed0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
9ee0: 6c 31 20 2a 20 28 20 63 6f 6c 31 20 29 20 63 6f  l1 * ( col1 ) co
9ef0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
9f00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39 36  cor0..----..7396
9f10: 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d 0a  ..8281..9409....
9f20: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
9f30: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
9f40: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
9f50: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
9f60: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 35 0d  wsort label-265.
9f70: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56  .SELECT col2 DIV
9f80: 20 39 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53   91 FROM tab2 AS
9f90: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
9fa0: 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
9fb0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
9fc0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
9fd0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36 35  owsort label-265
9fe0: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20  ..SELECT col2 / 
9ff0: 39 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  91 FROM tab2 AS 
a000: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
a010: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
a020: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
a030: 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2a  ISTINCT + col1 *
a040: 20 2d 20 31 33 20 46 52 4f 4d 20 74 61 62 32 20   - 13 FROM tab2 
a050: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
a060: 32 32 31 0d 0a 2d 34 30 33 0d 0a 2d 37 36 37 0d  221..-403..-767.
a070: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
a080: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
a090: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
a0a0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
a0b0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
a0c0: 36 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  67..SELECT ALL -
a0d0: 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 37 31   - col1 DIV + 71
a0e0: 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
a0f0: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
a100: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33  or0..----..25..3
a110: 36 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  6..90....skipif 
a120: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
a130: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
a140: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 36  rowsort label-26
a150: 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
a160: 2d 20 63 6f 6c 31 20 2f 20 2b 20 37 31 20 2b 20  - col1 / + 71 + 
a170: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
a180: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
a190: 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a  ..----..25..36..
a1a0: 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  90....onlyif mys
a1b0: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
a1c0: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
a1d0: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
a1e0: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
a1f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
a200: 36 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  68..SELECT + col
a210: 31 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  1 + + CAST( NULL
a220: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
a230: 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
a240: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
a250: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
a260: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
a270: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
a280: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
a290: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a2a0: 20 6c 61 62 65 6c 2d 32 36 38 0d 0a 53 45 4c 45   label-268..SELE
a2b0: 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41  CT + col1 + + CA
a2c0: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
a2d0: 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20  EGER ) * - col2 
a2e0: 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
a2f0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
a300: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
a310: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
a320: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a330: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
a340: 6f 6c 32 20 2b 20 2d 20 38 34 20 46 52 4f 4d 20  ol2 + - 84 FROM 
a350: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
a360: 2d 2d 0d 0a 2d 32 37 0d 0a 2d 33 30 0d 0a 31 32  --..-27..-30..12
a370: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
a380: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
a390: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
a3a0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
a3b0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a3c0: 32 37 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  270..SELECT DIST
a3d0: 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 2b 20  INCT col2 DIV + 
a3e0: 28 20 31 38 20 29 20 46 52 4f 4d 20 74 61 62 30  ( 18 ) FROM tab0
a3f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a400: 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69  0..1..4....skipi
a410: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
a420: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
a430: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
a440: 32 37 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  270..SELECT DIST
a450: 49 4e 43 54 20 63 6f 6c 32 20 2f 20 2b 20 28 20  INCT col2 / + ( 
a460: 31 38 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  18 ) FROM tab0 A
a470: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
a480: 0a 31 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..4....query I
a490: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a4a0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   + cor0.col2 * -
a4b0: 20 38 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   85 AS col0 FROM
a4c0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
a4d0: 2d 2d 2d 0d 0a 2d 34 35 39 30 0d 0a 2d 34 38 34  ---..-4590..-484
a4e0: 35 0d 0a 2d 38 31 36 30 0d 0a 0d 0a 71 75 65 72  5..-8160....quer
a4f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
a500: 45 43 54 20 41 4c 4c 20 2d 20 33 30 20 41 53 20  ECT ALL - 30 AS 
a510: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
a520: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
a530: 30 0d 0a 2d 33 30 0d 0a 2d 33 30 0d 0a 0d 0a 71  0..-30..-30....q
a540: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
a550: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
a560: 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  2 * col2 + col2 
a570: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
a580: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
a590: 0a 31 34 38 32 0d 0a 37 30 32 0d 0a 37 35 36 0d  .1482..702..756.
a5a0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
a5b0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
a5c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a5d0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  t..SELECT - CAST
a5e0: 20 28 20 35 33 20 41 53 20 52 45 41 4c 20 29 20   ( 53 AS REAL ) 
a5f0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a600: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
a610: 0a 2d 35 33 0d 0a 2d 35 33 0d 0a 2d 35 33 0d 0a  .-53..-53..-53..
a620: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a630: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
a640: 43 54 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f  CT + ( - cor0.co
a650: 6c 32 20 29 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  l2 ) * col0 + + 
a660: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
a670: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
a680: 2d 0d 0a 2d 31 35 39 0d 0a 2d 33 35 38 34 0d 0a  -..-159..-3584..
a690: 2d 37 36 30 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  -7600....skipif 
a6a0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
a6b0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
a6c0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
a6d0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
a6e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a6f0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
a700: 43 54 20 2b 20 32 35 20 63 6f 6c 31 20 46 52 4f  CT + 25 col1 FRO
a710: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
a720: 2d 2d 2d 2d 0d 0a 32 35 0d 0a 0d 0a 6f 6e 6c 79  ----..25....only
a730: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
a740: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
a750: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
a760: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
a770: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
a780: 61 62 65 6c 2d 32 37 37 0d 0a 53 45 4c 45 43 54  abel-277..SELECT
a790: 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 43 41   DISTINCT - + CA
a7a0: 53 54 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  ST( + col0 AS SI
a7b0: 47 4e 45 44 20 29 20 63 6f 6c 31 20 46 52 4f 4d  GNED ) col1 FROM
a7c0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
a7d0: 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37  ---..-7..-78..-7
a7e0: 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  9....skipif post
a7f0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
a800: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
a810: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
a820: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
a830: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
a840: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
a850: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a860: 65 6c 2d 32 37 37 0d 0a 53 45 4c 45 43 54 20 44  el-277..SELECT D
a870: 49 53 54 49 4e 43 54 20 2d 20 2b 20 43 41 53 54  ISTINCT - + CAST
a880: 20 28 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54   ( + col0 AS INT
a890: 45 47 45 52 20 29 20 63 6f 6c 31 20 46 52 4f 4d  EGER ) col1 FROM
a8a0: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
a8b0: 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37  ---..-7..-78..-7
a8c0: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
a8d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
a8e0: 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   - + col2 + - co
a8f0: 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72 30  l2 + col0 * cor0
a900: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
a910: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
a920: 0a 2d 2d 2d 2d 0d 0a 31 39 39 38 0d 0a 33 33 39  .----..1998..339
a930: 33 0d 0a 37 39 33 35 0d 0a 0d 0a 71 75 65 72 79  3..7935....query
a940: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a950: 43 54 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30  CT col1 * + col0
a960: 20 2b 20 35 34 20 41 53 20 63 6f 6c 30 20 46 52   + 54 AS col0 FR
a970: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
a980: 0a 2d 2d 2d 2d 0d 0a 31 33 39 37 0d 0a 32 37 31  .----..1397..271
a990: 0d 0a 34 36 35 36 0d 0a 0d 0a 71 75 65 72 79 20  ..4656....query 
a9a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a9b0: 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32 20 2a  T ALL - - col2 *
a9c0: 20 63 6f 6c 30 20 2d 20 63 6f 6c 30 20 41 53 20   col0 - col0 AS 
a9d0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
a9e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a  or0..----..182..
a9f0: 31 39 35 30 0d 0a 32 39 32 33 0d 0a 0d 0a 71 75  1950..2923....qu
aa00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
aa10: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
aa20: 20 63 6f 6c 30 20 29 20 2d 20 63 6f 72 30 2e 63   col0 ) - cor0.c
aa30: 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol2 * col2 FROM 
aa40: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
aa50: 2d 2d 0d 0a 2d 32 39 31 33 0d 0a 2d 33 31 38 35  --..-2913..-3185
aa60: 0d 0a 2d 39 31 33 36 0d 0a 0d 0a 71 75 65 72 79  ..-9136....query
aa70: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
aa80: 43 54 20 2d 20 33 35 20 46 52 4f 4d 20 74 61 62  CT - 35 FROM tab
aa90: 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  1, tab1 AS cor0,
aaa0: 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
aab0: 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
aac0: 61 73 68 69 6e 67 20 74 6f 20 36 64 39 36 37 62  ashing to 6d967b
aad0: 33 62 61 63 32 65 30 31 61 30 33 31 38 38 36 35  3bac2e01a0318865
aae0: 66 36 38 32 66 39 61 39 37 62 0d 0a 0d 0a 71 75  f682f9a97b....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 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
ab10: 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  2 + + cor0.col1 
ab20: 2a 20 39 36 20 46 52 4f 4d 20 74 61 62 32 20 41  * 96 FROM tab2 A
ab30: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
ab40: 39 34 0d 0a 32 39 34 39 0d 0a 35 36 33 38 0d 0a  94..2949..5638..
ab50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ab60: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
ab70: 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 28 20  col0 * col2 + ( 
ab80: 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  - col1 + + col0 
ab90: 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
aba0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
abb0: 2d 0d 0a 2d 32 30 30 39 0d 0a 2d 32 31 33 0d 0a  -..-2009..-213..
abc0: 2d 32 39 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -2940....query I
abd0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
abe0: 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b   - col2 * col2 +
abf0: 20 2d 20 28 20 63 6f 6c 31 20 29 20 41 53 20 63   - ( col1 ) AS c
ac00: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
ac10: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 35 0d  r0..----..-1175.
ac20: 0a 2d 36 38 31 35 0d 0a 2d 39 38 0d 0a 0d 0a 71  .-6815..-98....q
ac30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ac40: 53 45 4c 45 43 54 20 41 4c 4c 20 34 39 20 41 53  SELECT ALL 49 AS
ac50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c   col2 FROM tab2,
ac60: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
ac70: 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
ac80: 73 68 69 6e 67 20 74 6f 20 63 62 34 30 37 38 33  shing to cb40783
ac90: 63 30 66 66 66 37 32 65 38 38 30 32 63 64 66 30  c0fff72e8802cdf0
aca0: 36 38 32 65 37 63 62 35 35 0d 0a 0d 0a 73 6b 69  682e7cb55....ski
acb0: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
acc0: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
acd0: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
ace0: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
acf0: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
ad00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
ad10: 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 38 31 20  L + col0 + + 81 
ad20: 2a 20 38 34 20 63 6f 6c 31 20 46 52 4f 4d 20 74  * 84 col1 FROM t
ad30: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ad40: 2d 0d 0a 36 38 30 37 0d 0a 36 38 36 38 0d 0a 36  -..6807..6868..6
ad50: 38 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  884....query I r
ad60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
ad70: 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30   + col2 + + cor0
ad80: 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
ad90: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
ada0: 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a  .----..-21..33..
adb0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
adc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
add0: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a   col2 + - col0 *
ade0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
adf0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
ae00: 32 32 0d 0a 2d 36 30 35 38 0d 0a 2d 36 32 30 33  22..-6058..-6203
ae10: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ae20: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
ae30: 74 61 62 32 2e 63 6f 6c 31 20 2b 20 2d 20 74 61  tab2.col1 + - ta
ae40: 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b2.col2 FROM tab
ae50: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33  2..----..-21..33
ae60: 0d 0a 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..4....skipif po
ae70: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
ae80: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
ae90: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
aea0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
aeb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
aec0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
aed0: 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 63 6f 6c   + tab2.col2 col
aee0: 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
aef0: 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d  -..55..58..85...
af00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
af10: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
af20: 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b 20  T tab2.col0 * + 
af30: 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53  col1 + + col2 AS
af40: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
af50: 0a 2d 2d 2d 2d 0d 0a 31 33 38 31 0d 0a 32 34 34  .----..1381..244
af60: 0d 0a 34 36 32 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..4628....onlyif
af70: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
af80: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
af90: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
afa0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
afb0: 6c 61 62 65 6c 2d 32 39 33 0d 0a 53 45 4c 45 43  label-293..SELEC
afc0: 54 20 41 4c 4c 20 74 61 62 32 2e 63 6f 6c 31 20  T ALL tab2.col1 
afd0: 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20  * - tab2.col2 + 
afe0: 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32  tab2.col1 * col2
aff0: 20 44 49 56 20 2b 20 74 61 62 32 2e 63 6f 6c 31   DIV + tab2.col1
b000: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
b010: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36  .----..-1508..-6
b020: 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 73 6b 69 70  08..-810....skip
b030: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
b040: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
b050: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
b060: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
b070: 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
b080: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
b090: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
b0a0: 6f 72 74 20 6c 61 62 65 6c 2d 32 39 33 0d 0a 53  ort label-293..S
b0b0: 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63  ELECT ALL tab2.c
b0c0: 6f 6c 31 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c  ol1 * - tab2.col
b0d0: 32 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20  2 + tab2.col1 * 
b0e0: 63 6f 6c 32 20 2f 20 2b 20 74 61 62 32 2e 63 6f  col2 / + tab2.co
b0f0: 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l1 col2 FROM tab
b100: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a  2..----..-1508..
b110: 2d 36 30 38 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75  -608..-810....qu
b120: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b130: 45 4c 45 43 54 20 41 4c 4c 20 39 30 20 2b 20 63  ELECT ALL 90 + c
b140: 6f 6c 30 20 2a 20 2b 20 39 36 20 41 53 20 63 6f  ol0 * + 96 AS co
b150: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
b160: 2d 2d 0d 0a 37 35 37 38 0d 0a 37 36 32 0d 0a 37  --..7578..762..7
b170: 36 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  674....query I r
b180: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
b190: 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 31  ISTINCT - + cor1
b1a0: 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20  .col1 FROM tab0 
b1b0: 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
b1c0: 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  IN tab1 AS cor1.
b1d0: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
b1e0: 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-26....query I 
b1f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b200: 2b 20 28 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  + ( + col1 * col
b210: 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  1 ) AS col2 FROM
b220: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33 39   tab0..----..739
b230: 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a 0d  6..8281..9409...
b240: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b250: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
b260: 54 20 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f  T col0 * tab0.co
b270: 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63  l1 * - col2 AS c
b280: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
b290: 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36 34  ---..-3395..-664
b2a0: 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a 71  118..-68112....q
b2b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
b2c0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
b2d0: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  + - cor0.col2 + 
b2e0: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
b2f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b300: 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d  -55..-58..-85...
b310: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b320: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
b330: 6f 6c 31 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20  ol1 - + col2 AS 
b340: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
b350: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
b360: 30 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a  09..-67..-80....
b370: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
b380: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
b390: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
b3a0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
b3b0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
b3c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b3d0: 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
b3e0: 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30   * col1 + - cor0
b3f0: 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20  .col2 col1 FROM 
b400: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
b410: 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d 31 33 32 0d  --..-1136..-132.
b420: 0a 2d 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .-697....query I
b430: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b440: 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 32 31 20   tab0.col0 * 21 
b450: 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  + + col0 + + col
b460: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
b470: 2d 0d 0a 32 30 34 30 0d 0a 35 36 31 0d 0a 37 37  -..2040..561..77
b480: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
b490: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
b4a0: 54 49 4e 43 54 20 2b 20 28 20 2d 20 33 32 20 29  TINCT + ( - 32 )
b4b0: 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
b4c0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
b4d0: 0a 2d 35 38 0d 0a 2d 35 39 0d 0a 2d 37 30 0d 0a  .-58..-59..-70..
b4e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
b4f0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
b500: 28 20 2d 20 63 6f 6c 30 20 29 20 2b 20 2d 20 63  ( - col0 ) + - c
b510: 6f 6c 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 - col0 FROM 
b520: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35  tab0..----..-105
b530: 0d 0a 2d 32 36 37 0d 0a 2d 37 32 0d 0a 0d 0a 71  ..-267..-72....q
b540: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
b550: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
b560: 63 6f 6c 32 20 2b 20 2b 20 32 30 20 2d 20 2b 20  col2 + + 20 - + 
b570: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
b580: 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 31 33 0d 0a 32  ----..-14..13..2
b590: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
b5a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
b5b0: 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   - col0 + + col1
b5c0: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
b5d0: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38  2..----..-7..-78
b5e0: 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-79....query I
b5f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b600: 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2d 20   ALL ( col1 ) - 
b610: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
b620: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37  ..----..-54..-67
b630: 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..23....query I 
b640: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b650: 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63  DISTINCT - ( + c
b660: 6f 6c 32 20 2a 20 63 6f 6c 32 20 29 20 2b 20 63  ol2 * col2 ) + c
b670: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2d  ol1 * + col2 - -
b680: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
b690: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 30 39 0d 0a 2d 32  .----..-1509..-2
b6a0: 36 31 35 0d 0a 2d 37 38 38 38 0d 0a 0d 0a 71 75  615..-7888....qu
b6b0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b6c0: 45 4c 45 43 54 20 32 37 20 2b 20 63 6f 6c 32 20  ELECT 27 + col2 
b6d0: 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  - - col2 * - col
b6e0: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
b6f0: 2d 0d 0a 2d 33 35 36 34 0d 0a 2d 37 35 35 37 0d  -..-3564..-7557.
b700: 0a 2d 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-81....onlyif m
b710: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
b720: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
b730: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
b740: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
b750: 62 65 6c 2d 33 30 39 0d 0a 53 45 4c 45 43 54 20  bel-309..SELECT 
b760: 41 4c 4c 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a  ALL ( - col2 ) *
b770: 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 44 49 56   col1 - col1 DIV
b780: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
b790: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 35 0d 0a 2d 36  .----..-1535..-6
b7a0: 34 37 0d 0a 2d 38 33 38 0d 0a 0d 0a 73 6b 69 70  47..-838....skip
b7b0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
b7c0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
b7d0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b7e0: 2d 33 30 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -309..SELECT ALL
b7f0: 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 63 6f   ( - col2 ) * co
b800: 6c 31 20 2d 20 63 6f 6c 31 20 2f 20 63 6f 6c 31  l1 - col1 / col1
b810: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
b820: 0d 0a 2d 31 35 33 35 0d 0a 2d 36 34 37 0d 0a 2d  ..-1535..-647..-
b830: 38 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  838....query I r
b840: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
b850: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2d  ISTINCT - col0 -
b860: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
b870: 0a 2d 2d 2d 2d 0d 0a 2d 31 34 0d 0a 2d 31 35 36  .----..-14..-156
b880: 0d 0a 2d 31 35 38 0d 0a 0d 0a 71 75 65 72 79 20  ..-158....query 
b890: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b8a0: 54 20 2b 20 28 20 63 6f 6c 31 20 29 20 2d 20 63  T + ( col1 ) - c
b8b0: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
b8c0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   tab0..----..2..
b8d0: 36 32 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69 66  62..62....skipif
b8e0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
b8f0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
b900: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
b910: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
b920: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
b930: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 31 20  rt..SELECT + 11 
b940: 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  + col1 * col2 + 
b950: 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20  + col0 * + col2 
b960: 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  * col0 col2 FROM
b970: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 33   tab0..----..133
b980: 33 0d 0a 32 31 38 35 37 0d 0a 36 35 36 39 39 35  3..21857..656995
b990: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
b9a0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
b9b0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
b9c0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
b9d0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b9e0: 33 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  313..SELECT ALL 
b9f0: 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  + ( col2 ) + col
ba00: 32 20 44 49 56 20 2d 20 63 6f 6c 32 20 46 52 4f  2 DIV - col2 FRO
ba10: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab0..----..0.
ba20: 0a 33 32 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69  .32..81....skipi
ba30: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
ba40: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
ba50: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
ba60: 33 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  313..SELECT ALL 
ba70: 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  + ( col2 ) + col
ba80: 32 20 2f 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 / - col2 FROM 
ba90: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 33  tab0..----..0..3
baa0: 32 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  2..81....query I
bab0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
bac0: 20 36 38 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20   68 * cor0.col1 
bad0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
bae0: 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
baf0: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
bb00: 68 61 73 68 69 6e 67 20 74 6f 20 32 35 62 63 32  hashing to 25bc2
bb10: 36 66 65 33 35 30 31 36 62 35 34 62 61 64 63 64  6fe35016b54badcd
bb20: 36 39 62 65 62 33 39 36 62 66 35 0d 0a 0d 0a 71  69beb396bf5....q
bb30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
bb40: 53 45 4c 45 43 54 20 34 34 20 46 52 4f 4d 20 74  SELECT 44 FROM t
bb50: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
bb60: 34 34 0d 0a 34 34 0d 0a 34 34 0d 0a 0d 0a 6f 6e  44..44..44....on
bb70: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
bb80: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
bb90: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
bba0: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
bbb0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
bbc0: 20 6c 61 62 65 6c 2d 33 31 36 0d 0a 53 45 4c 45   label-316..SELE
bbd0: 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53  CT CAST( NULL AS
bbe0: 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f 6c 30   SIGNED ) + col0
bbf0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
bc00: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
bc10: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
bc20: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
bc30: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
bc40: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31 36 0d 0a  sort label-316..
bc50: 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55  SELECT CAST ( NU
bc60: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
bc70: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
bc80: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
bc90: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
bca0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
bcb0: 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63  ECT + col2 + - c
bcc0: 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2b 20 63  ol1 * col1 * + c
bcd0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
bce0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
bcf0: 39 34 34 0d 0a 2d 32 35 39 32 30 0d 0a 2d 39 30  944..-25920..-90
bd00: 34 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  480....query I r
bd10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
bd20: 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 72  or0.col2 + - cor
bd30: 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  0.col0 * - col1 
bd40: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
bd50: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d 0a 33  0..----..2097..3
bd60: 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71 75 65  396..8181....que
bd70: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
bd80: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
bd90: 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  - col1 + + col1 
bda0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
bdb0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
bdc0: 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71  .20..26..52....q
bdd0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
bde0: 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63 6f  SELECT col0 + co
bdf0: 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l2 * + col1 FROM
be00: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
be10: 0d 0a 31 33 32 38 0d 0a 31 34 30 37 0d 0a 36 33  ..1328..1407..63
be20: 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
be30: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
be40: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
be50: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
be60: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
be70: 2d 33 32 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -321..SELECT - -
be80: 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 44 49 56   col0 + col0 DIV
be90: 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
bea0: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  0 cor0..----..24
beb0: 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70  ..35..89....skip
bec0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
bed0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
bee0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
bef0: 2d 33 32 31 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -321..SELECT - -
bf00: 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f 20 2d   col0 + col0 / -
bf10: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
bf20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
bf30: 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20  35..89....query 
bf40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
bf50: 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 2d  T ALL + col1 * -
bf60: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
bf70: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
bf80: 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d  --..-1040..-640.
bf90: 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-78....query I 
bfa0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
bfb0: 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72  + + col0 * + cor
bfc0: 30 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  0.col2 + - col0 
bfd0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
bfe0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 0d 0a 33 35  0..----..159..35
bff0: 38 34 0d 0a 37 36 30 30 0d 0a 0d 0a 71 75 65 72  84..7600....quer
c000: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c010: 45 43 54 20 41 4c 4c 20 2d 20 32 33 20 2a 20 2d  ECT ALL - 23 * -
c020: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
c030: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
c040: 2d 2d 0d 0a 31 36 31 0d 0a 31 37 39 34 0d 0a 31  --..161..1794..1
c050: 38 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  817....query I r
c060: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
c070: 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2b  ISTINCT col1 + +
c080: 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63   col0 * + cor0.c
c090: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
c0a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38   cor0..----..188
c0b0: 0d 0a 33 36 35 38 0d 0a 37 36 39 33 0d 0a 0d 0a  ..3658..7693....
c0c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
c0d0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
c0e0: 6f 6c 31 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol1 * col2 * col
c0f0: 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  2 + - col0 AS co
c100: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
c110: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 31 37  cor0..----..6117
c120: 39 35 0d 0a 36 32 0d 0a 39 33 36 33 30 0d 0a 0d  95..62..93630...
c130: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c140: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
c150: 54 20 2b 20 37 36 20 2b 20 2d 20 63 6f 72 30 2e  T + 76 + - cor0.
c160: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
c170: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38  S cor0..----..38
c180: 0d 0a 34 39 0d 0a 35 30 0d 0a 0d 0a 6f 6e 6c 79  ..49..50....only
c190: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
c1a0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
c1b0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
c1c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
c1d0: 74 20 6c 61 62 65 6c 2d 33 32 38 0d 0a 53 45 4c  t label-328..SEL
c1e0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37  ECT DISTINCT + 7
c1f0: 38 20 44 49 56 20 63 6f 6c 31 20 63 6f 6c 30 20  8 DIV col1 col0 
c200: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
c210: 0a 33 0d 0a 36 0d 0a 37 0d 0a 0d 0a 73 6b 69 70  .3..6..7....skip
c220: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
c230: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
c240: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
c250: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
c260: 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
c270: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
c280: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
c290: 6f 72 74 20 6c 61 62 65 6c 2d 33 32 38 0d 0a 53  ort label-328..S
c2a0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
c2b0: 20 37 38 20 2f 20 63 6f 6c 31 20 63 6f 6c 30 20   78 / col1 col0 
c2c0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
c2d0: 0a 33 0d 0a 36 0d 0a 37 0d 0a 0d 0a 71 75 65 72  .3..6..7....quer
c2e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c2f0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 20 2a  ECT DISTINCT 8 *
c300: 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f   tab1.col0 AS co
c310: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
c320: 2d 2d 0d 0a 32 34 0d 0a 35 31 32 0d 0a 36 34 30  --..24..512..640
c330: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c340: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 30 20 2a  ort..SELECT 10 *
c350: 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   - col1 AS col0 
c360: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
c370: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 30 0d 0a 2d  0..----..-170..-
c380: 33 31 30 0d 0a 2d 35 39 30 0d 0a 0d 0a 71 75 65  310..-590....que
c390: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
c3a0: 4c 45 43 54 20 41 4c 4c 20 2d 20 38 31 20 41 53  LECT ALL - 81 AS
c3b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
c3c0: 0a 2d 2d 2d 2d 0d 0a 2d 38 31 0d 0a 2d 38 31 0d  .----..-81..-81.
c3d0: 0a 2d 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-81....onlyif m
c3e0: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
c3f0: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
c400: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
c410: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
c420: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
c430: 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -332..SELECT ALL
c440: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
c450: 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 30 20 46  IGNED ) * col0 F
c460: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
c470: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
c480: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
c490: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
c4a0: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
c4b0: 72 74 20 6c 61 62 65 6c 2d 33 33 32 0d 0a 53 45  rt label-332..SE
c4c0: 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20  LECT ALL CAST ( 
c4d0: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
c4e0: 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) * col0 FROM ta
c4f0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
c500: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
c510: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
c520: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
c530: 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30   - col1 + - cor0
c540: 2e 63 6f 6c 31 20 2a 20 33 32 20 46 52 4f 4d 20  .col1 * 32 FROM 
c550: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
c560: 2d 2d 0d 0a 2d 31 30 32 33 0d 0a 2d 31 39 34 37  --..-1023..-1947
c570: 0d 0a 2d 35 36 31 0d 0a 0d 0a 71 75 65 72 79 20  ..-561....query 
c580: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c590: 54 20 44 49 53 54 49 4e 43 54 20 34 30 20 2b 20  T DISTINCT 40 + 
c5a0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 28 20  cor0.col2 * - ( 
c5b0: 2d 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  - col1 ) * + col
c5c0: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
c5d0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 33 35 0d  or0..----..3435.
c5e0: 0a 36 36 34 31 35 38 0d 0a 36 38 31 35 32 0d 0a  .664158..68152..
c5f0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
c600: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
c610: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
c620: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
c630: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33  rowsort label-33
c640: 35 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  5..SELECT col2 *
c650: 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 44   - col1 - col1 D
c660: 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c  IV - col2 AS col
c670: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
c680: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 36  or0..----..-2836
c690: 0d 0a 2d 37 34 36 31 0d 0a 30 0d 0a 0d 0a 73 6b  ..-7461..0....sk
c6a0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
c6b0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
c6c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c6d0: 65 6c 2d 33 33 35 0d 0a 53 45 4c 45 43 54 20 63  el-335..SELECT c
c6e0: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 63  ol2 * - col1 - c
c6f0: 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20  ol1 / - col2 AS 
c700: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
c710: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
c720: 38 33 36 0d 0a 2d 37 34 36 31 0d 0a 30 0d 0a 0d  836..-7461..0...
c730: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
c740: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
c750: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
c760: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
c770: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
c780: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
c790: 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 63  T ALL - col2 * c
c7a0: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol0 + - col0 col
c7b0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
c7c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 35 0d  or0..----..-165.
c7d0: 0a 2d 33 37 31 32 0d 0a 2d 37 37 36 30 0d 0a 0d  .-3712..-7760...
c7e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c7f0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
c800: 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 39 30  T cor0.col0 * 90
c810: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
c820: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
c830: 0d 0a 32 37 30 0d 0a 35 37 36 30 0d 0a 37 32 30  ..270..5760..720
c840: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
c850: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
c860: 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2d 20 28  TINCT col0 * - (
c870: 20 2d 20 32 35 20 29 20 2a 20 2d 20 63 6f 72 30   - 25 ) * - cor0
c880: 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
c890: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
c8a0: 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 31 35 32 31  --..-1225..-1521
c8b0: 30 30 0d 0a 2d 31 35 36 30 32 35 0d 0a 0d 0a 6f  00..-156025....o
c8c0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
c8d0: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
c8e0: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
c8f0: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
c900: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 39 0d 0a  sort label-339..
c910: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
c920: 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2b 20  cor0.col0 DIV + 
c930: 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
c940: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
c950: 2d 0d 0a 2d 32 34 0d 0a 2d 38 38 0d 0a 30 0d 0a  -..-24..-88..0..
c960: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
c970: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
c980: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c990: 20 6c 61 62 65 6c 2d 33 33 39 0d 0a 53 45 4c 45   label-339..SELE
c9a0: 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30  CT - col0 + cor0
c9b0: 2e 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 32 20 41  .col0 / + col2 A
c9c0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
c9d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
c9e0: 0d 0a 2d 38 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72  ..-88..0....quer
c9f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ca00: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
ca10: 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63  ol1 * col0 + - c
ca20: 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 * - cor0.col
ca30: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
ca40: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ca50: 2d 0d 0a 2d 37 30 0d 0a 31 33 32 36 0d 0a 32 30  -..-70..1326..20
ca60: 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
ca70: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
ca80: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
ca90: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
caa0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
cab0: 2d 33 34 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  -341..SELECT DIS
cac0: 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 44 49 56  TINCT + col1 DIV
cad0: 20 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   7 FROM tab1 AS 
cae0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
caf0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
cb00: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
cb10: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
cb20: 72 74 20 6c 61 62 65 6c 2d 33 34 31 0d 0a 53 45  rt label-341..SE
cb30: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
cb40: 63 6f 6c 31 20 2f 20 37 20 46 52 4f 4d 20 74 61  col1 / 7 FROM ta
cb50: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
cb60: 0d 0a 31 0d 0a 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..1..3....onlyif
cb70: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
cb80: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
cb90: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
cba0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
cbb0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
cbc0: 65 6c 2d 33 34 32 0d 0a 53 45 4c 45 43 54 20 2d  el-342..SELECT -
cbd0: 20 63 6f 6c 31 20 2a 20 43 41 53 54 28 20 63 6f   col1 * CAST( co
cbe0: 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  l1 AS SIGNED ) +
cbf0: 20 63 6f 6c 30 20 2a 20 33 20 46 52 4f 4d 20 74   col0 * 3 FROM t
cc00: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
cc10: 2d 0d 0a 2d 37 33 32 34 0d 0a 2d 38 30 31 34 0d  -..-7324..-8014.
cc20: 0a 2d 39 33 30 34 0d 0a 0d 0a 73 6b 69 70 69 66  .-9304....skipif
cc30: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
cc40: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
cc50: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
cc60: 34 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  42..SELECT - col
cc70: 31 20 2a 20 43 41 53 54 20 28 20 63 6f 6c 31 20  1 * CAST ( col1 
cc80: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
cc90: 6f 6c 30 20 2a 20 33 20 46 52 4f 4d 20 74 61 62  ol0 * 3 FROM tab
cca0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
ccb0: 0a 2d 37 33 32 34 0d 0a 2d 38 30 31 34 0d 0a 2d  .-7324..-8014..-
ccc0: 39 33 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9304....query I 
ccd0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
cce0: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 28  ALL - + col2 * (
ccf0: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b   + cor0.col2 ) +
cd00: 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 32 20 29   col2 * ( col2 )
cd10: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
cd20: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  b2 cor0..----..0
cd30: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
cd40: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
cd50: 54 20 41 4c 4c 20 63 6f 6c 31 20 2d 20 2d 20 63  T ALL col1 - - c
cd60: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
cd70: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
cd80: 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a 39 36  ---..137..38..96
cd90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
cda0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
cdb0: 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20 63  + col0 + + ( + c
cdc0: 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol2 ) FROM tab2 
cdd0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
cde0: 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 6f  04..117..34....o
cdf0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
ce00: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
ce10: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
ce20: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
ce30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ce40: 74 20 6c 61 62 65 6c 2d 33 34 36 0d 0a 53 45 4c  t label-346..SEL
ce50: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
ce60: 6f 6c 31 20 2f 20 43 41 53 54 28 20 4e 55 4c 4c  ol1 / CAST( NULL
ce70: 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
ce80: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
ce90: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
cea0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
ceb0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
cec0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
ced0: 74 20 6c 61 62 65 6c 2d 33 34 36 0d 0a 53 45 4c  t label-346..SEL
cee0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
cef0: 6f 6c 31 20 2f 20 43 41 53 54 20 28 20 4e 55 4c  ol1 / CAST ( NUL
cf00: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
cf10: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
cf20: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
cf30: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
cf40: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
cf50: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 37   cor0.col0 * + 7
cf60: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
cf70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 35 34  r0..----..49..54
cf80: 36 0d 0a 35 35 33 0d 0a 0d 0a 71 75 65 72 79 20  6..553....query 
cf90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
cfa0: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20  T DISTINCT col1 
cfb0: 2a 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  * - ( - cor0.col
cfc0: 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  1 ) FROM tab1 AS
cfd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
cfe0: 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75  ..169..676....qu
cff0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d000: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 37  ELECT DISTINCT 7
d010: 39 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  9 + + col0 * col
d020: 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
d030: 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
d040: 31 32 38 0d 0a 36 31 36 33 0d 0a 36 33 32 30 0d  128..6163..6320.
d050: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
d060: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
d070: 20 2d 20 36 32 20 2b 20 2d 20 63 6f 6c 32 20 46   - 62 + - col2 F
d080: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
d090: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 32 39 0d  ..----..-20..29.
d0a0: 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .61....onlyif my
d0b0: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
d0c0: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
d0d0: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
d0e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
d0f0: 65 6c 2d 33 35 31 0d 0a 53 45 4c 45 43 54 20 44  el-351..SELECT D
d100: 49 53 54 49 4e 43 54 20 38 39 20 2b 20 63 6f 6c  ISTINCT 89 + col
d110: 32 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20  2 DIV col2 FROM 
d120: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
d130: 2d 2d 0d 0a 39 30 0d 0a 0d 0a 73 6b 69 70 69 66  --..90....skipif
d140: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
d150: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
d160: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
d170: 35 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  51..SELECT DISTI
d180: 4e 43 54 20 38 39 20 2b 20 63 6f 6c 32 20 2f 20  NCT 89 + col2 / 
d190: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
d1a0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 30  S cor0..----..90
d1b0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d1c0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
d1d0: 63 6f 6c 31 20 2a 20 34 37 20 41 53 20 63 6f 6c  col1 * 47 AS col
d1e0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
d1f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 32  or0..----..-1222
d200: 0d 0a 2d 34 37 30 0d 0a 2d 36 31 31 0d 0a 0d 0a  ..-470..-611....
d210: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d220: 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e 63  .SELECT + tab0.c
d230: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
d240: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
d250: 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
d260: 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
d270: 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 64  es hashing to 2d
d280: 36 64 33 30 33 31 64 66 65 39 30 65 30 63 30 32  6d3031dfe90e0c02
d290: 64 62 31 33 61 61 36 33 39 39 33 62 66 64 0d 0a  db13aa63993bfd..
d2a0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
d2b0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d  t..SELECT col0 -
d2c0: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a   - col0 * col2 *
d2d0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
d2e0: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
d2f0: 33 33 30 0d 0a 31 35 38 32 36 32 0d 0a 32 33 37  330..158262..237
d300: 32 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  237....query I r
d310: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
d320: 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f 6c 32   col2 + ( + col2
d330: 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
d340: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
d350: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
d360: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
d370: 20 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2b 20   ( + col1 ) + + 
d380: 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
d390: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
d3a0: 2d 2d 2d 0d 0a 31 34 37 35 0d 0a 36 32 39 0d 0a  ---..1475..629..
d3b0: 38 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  806....onlyif my
d3c0: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
d3d0: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
d3e0: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
d3f0: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
d400: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d410: 33 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  357..SELECT DIST
d420: 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  INCT + - col0 * 
d430: 2d 20 32 31 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  - 21 + col1 * - 
d440: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
d450: 47 4e 45 44 20 29 20 2a 20 2b 20 32 33 20 2b 20  GNED ) * + 23 + 
d460: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f  cor0.col2 * - co
d470: 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
d480: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
d490: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
d4a0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
d4b0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
d4c0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
d4d0: 2d 33 35 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -357..SELECT DIS
d4e0: 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  TINCT + - col0 *
d4f0: 20 2d 20 32 31 20 2b 20 63 6f 6c 31 20 2a 20 2d   - 21 + col1 * -
d500: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
d510: 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 32 33  INTEGER ) * + 23
d520: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   + cor0.col2 * -
d530: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
d540: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
d550: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .----..NULL....q
d560: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
d570: 53 45 4c 45 43 54 20 2b 20 31 30 20 2a 20 2d 20  SELECT + 10 * - 
d580: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46 52  col0 + + col2 FR
d590: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
d5a0: 0a 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 37 35 32  .----..-43..-752
d5b0: 0d 0a 2d 37 35 34 0d 0a 0d 0a 71 75 65 72 79 20  ..-754....query 
d5c0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d5d0: 54 20 36 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  T 60 AS col2 FRO
d5e0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
d5f0: 2d 0d 0a 36 30 0d 0a 36 30 0d 0a 36 30 0d 0a 0d  -..60..60..60...
d600: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d610: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
d620: 20 28 20 63 6f 6c 31 20 29 20 2a 20 39 33 20 41   ( col1 ) * 93 A
d630: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
d640: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
d650: 37 39 39 38 0d 0a 38 34 36 33 0d 0a 39 30 32 31  7998..8463..9021
d660: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d670: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
d680: 49 4e 43 54 20 2b 20 35 38 20 2a 20 2b 20 63 6f  INCT + 58 * + co
d690: 6c 30 20 2b 20 35 35 20 46 52 4f 4d 20 74 61 62  l0 + 55 FROM tab
d6a0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
d6b0: 0a 34 35 37 39 0d 0a 34 36 31 0d 0a 34 36 33 37  .4579..461..4637
d6c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
d6d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
d6e0: 2b 20 2d 20 39 30 20 2b 20 2d 20 63 6f 6c 31 20  + - 90 + - col1 
d6f0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
d700: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 36 0d 0a 2d  0..----..-176..-
d710: 31 38 31 0d 0a 2d 31 38 37 0d 0a 0d 0a 71 75 65  181..-187....que
d720: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d730: 4c 45 43 54 20 28 20 2b 20 63 6f 6c 32 20 2a 20  LECT ( + col2 * 
d740: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 2a 20  col0 + + col0 * 
d750: 2b 20 74 61 62 31 2e 63 6f 6c 30 20 29 20 46 52  + tab1.col0 ) FR
d760: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
d770: 34 30 38 30 0d 0a 31 37 31 0d 0a 37 37 34 34 0d  4080..171..7744.
d780: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
d790: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
d7a0: 20 2b 20 38 30 20 29 20 41 53 20 63 6f 6c 30 20   + 80 ) AS col0 
d7b0: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
d7c0: 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
d7d0: 49 4e 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32  IN tab2..----..2
d7e0: 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
d7f0: 20 74 6f 20 36 64 64 35 30 33 38 62 65 37 31 64   to 6dd5038be71d
d800: 66 66 61 38 32 66 35 63 65 62 61 37 38 37 63 61  ffa82f5ceba787ca
d810: 61 62 39 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ab91....query I 
d820: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d830: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  col0 * + col0 + 
d840: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
d850: 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
d860: 2d 0d 0a 31 32 36 30 0d 0a 36 30 30 0d 0a 38 30  -..1260..600..80
d870: 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
d880: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
d890: 63 6f 6c 31 20 2b 20 2b 20 31 39 20 2a 20 2d 20  col1 + + 19 * - 
d8a0: 36 35 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  65 * col2 FROM t
d8b0: 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
d8c0: 2d 31 30 31 31 37 39 0d 0a 2d 31 31 33 38 0d 0a  -101179..-1138..
d8d0: 2d 34 30 36 36 39 0d 0a 0d 0a 71 75 65 72 79 20  -40669....query 
d8e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d8f0: 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  T - cor0.col2 + 
d900: 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
d910: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
d920: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31  ..----..-108..-1
d930: 31 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 71 75 65 72  14..-192....quer
d940: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d950: 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b  ECT - - col1 * +
d960: 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d 20 63   cor0.col1 - - c
d970: 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
d980: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
d990: 2d 2d 2d 0d 0a 31 36 34 0d 0a 32 34 39 0d 0a 36  ---..164..249..6
d9a0: 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
d9b0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
d9c0: 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f  STINCT col0 + co
d9d0: 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
d9e0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d  tab0..----..178.
d9f0: 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 73 6b 69 70 69  .48..70....skipi
da00: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
da10: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
da20: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
da30: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
da40: 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
da50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
da60: 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 63 6f  - col0 * col0 co
da70: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
da80: 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d  --..-1225..-576.
da90: 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20  .-7921....query 
daa0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
dab0: 54 20 2d 20 35 37 20 41 53 20 63 6f 6c 30 20 46  T - 57 AS col0 F
dac0: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41  ROM tab2, tab0 A
dad0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
dae0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
daf0: 6f 20 35 32 30 64 63 33 39 33 38 39 36 39 36 39  o 520dc393896969
db00: 65 30 32 61 37 32 61 62 36 63 35 64 39 32 31 32  e02a72ab6c5d9212
db10: 36 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  6b....query I ro
db20: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
db30: 4c 20 2b 20 34 36 20 41 53 20 63 6f 6c 31 20 46  L + 46 AS col1 F
db40: 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
db50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
db60: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
db70: 6f 20 33 31 38 31 38 63 39 64 34 64 33 32 35 65  o 31818c9d4d325e
db80: 62 32 34 38 37 33 35 63 39 37 63 62 31 64 63 65  b248735c97cb1dce
db90: 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  39....onlyif mys
dba0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
dbb0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
dbc0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
dbd0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
dbe0: 6c 2d 33 37 33 0d 0a 53 45 4c 45 43 54 20 63 6f  l-373..SELECT co
dbf0: 6c 30 20 2d 20 63 6f 6c 32 20 44 49 56 20 2b 20  l0 - col2 DIV + 
dc00: 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab0.col0 AS col
dc10: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
dc20: 2d 0d 0a 32 33 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..23..35..89...
dc30: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
dc40: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
dc50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
dc60: 6c 61 62 65 6c 2d 33 37 33 0d 0a 53 45 4c 45 43  label-373..SELEC
dc70: 54 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2f 20  T col0 - col2 / 
dc80: 2b 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  + tab0.col0 AS c
dc90: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
dca0: 2d 2d 2d 0d 0a 32 33 0d 0a 33 35 0d 0a 38 39 0d  ---..23..35..89.
dcb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
dcc0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
dcd0: 4e 43 54 20 34 31 20 2b 20 2b 20 63 6f 6c 31 20  NCT 41 + + col1 
dce0: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
dcf0: 0d 0a 2d 2d 2d 2d 0d 0a 37 34 33 37 0d 0a 38 33  ..----..7437..83
dd00: 32 32 0d 0a 39 34 35 30 0d 0a 0d 0a 71 75 65 72  22..9450....quer
dd10: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
dd20: 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT - + cor0.col
dd30: 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 + - cor0.col2 
dd40: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
dd50: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
dd60: 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a  -7..-78..-79....
dd70: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
dd80: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
dd90: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
dda0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
ddb0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
ddc0: 72 74 20 6c 61 62 65 6c 2d 33 37 36 0d 0a 53 45  rt label-376..SE
ddd0: 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
dde0: 6c 31 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20  l1 * CAST( NULL 
ddf0: 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f  AS SIGNED ) + co
de00: 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
de10: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
de20: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
de30: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
de40: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
de50: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
de60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 36  owsort label-376
de70: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
de80: 2d 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  - col1 * CAST ( 
de90: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
dea0: 29 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  ) + col2 AS col0
deb0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
dec0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
ded0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
dee0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
def0: 45 4c 45 43 54 20 41 4c 4c 20 32 35 20 41 53 20  ELECT ALL 25 AS 
df00: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
df10: 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
df20: 61 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor1..----..
df30: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
df40: 20 74 6f 20 35 32 35 61 35 35 64 35 65 64 32 32   to 525a55d5ed22
df50: 34 61 36 32 64 61 36 35 64 66 33 36 37 33 31 38  4a62da65df367318
df60: 38 31 61 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  81a7....onlyif m
df70: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
df80: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
df90: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
dfa0: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
dfb0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
dfc0: 2d 33 37 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -378..SELECT + c
dfd0: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol2 + + col1 * +
dfe0: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
dff0: 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 31  IGNED ) + - col1
e000: 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46   * - cor0.col1 F
e010: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
e020: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
e030: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
e040: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
e050: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
e060: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
e070: 2d 33 37 38 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -378..SELECT + c
e080: 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b  ol2 + + col1 * +
e090: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
e0a0: 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f  INTEGER ) + - co
e0b0: 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l1 * - cor0.col1
e0c0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
e0d0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
e0e0: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
e0f0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
e100: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
e110: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
e120: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
e130: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
e140: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
e150: 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 37   + cor0.col0 * 7
e160: 35 20 2a 20 38 39 20 63 6f 6c 31 20 46 52 4f 4d  5 * 89 col1 FROM
e170: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
e180: 2d 2d 2d 0d 0a 2d 34 36 37 32 35 0d 0a 2d 35 32  ---..-46725..-52
e190: 30 36 35 30 0d 0a 2d 35 32 37 33 32 35 0d 0a 0d  0650..-527325...
e1a0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e1b0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
e1c0: 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 35  ol1 * col0 + - 5
e1d0: 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  5 FROM tab1 AS c
e1e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 35  or0..----..23..5
e1f0: 38 35 0d 0a 39 38 35 0d 0a 0d 0a 71 75 65 72 79  85..985....query
e200: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e210: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
e220: 6c 30 20 2b 20 2d 20 35 31 20 2b 20 63 6f 6c 30  l0 + - 51 + col0
e230: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
e240: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
e250: 0d 0a 2d 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-51....query I
e260: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e270: 20 2b 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63 6f   + col2 + ( + co
e280: 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  l0 ) * col1 + + 
e290: 28 20 28 20 63 6f 6c 30 20 29 20 29 20 2a 20 63  ( ( col0 ) ) * c
e2a0: 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
e2b0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
e2c0: 36 31 30 32 0d 0a 32 36 37 33 0d 0a 34 36 32 31  6102..2673..4621
e2d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
e2e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
e2f0: 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  INCT - col0 * + 
e300: 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  ( col1 ) FROM ta
e310: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
e320: 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30  1343..-217..-460
e330: 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
e340: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
e350: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
e360: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
e370: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 43 41 53 54  cor0.col2 * CAST
e380: 20 28 20 63 6f 6c 31 20 41 53 20 52 45 41 4c 20   ( col1 AS REAL 
e390: 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ) * - col1 AS co
e3a0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
e3b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34  cor0..----..-244
e3c0: 30 36 38 0d 0a 2d 36 37 39 30 34 32 0d 0a 2d 39  068..-679042..-9
e3d0: 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
e3e0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
e3f0: 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 35 39 20 46   + col1 * + 59 F
e400: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
e410: 0d 0a 2d 2d 2d 2d 0d 0a 35 30 37 34 0d 0a 35 33  ..----..5074..53
e420: 36 39 0d 0a 35 37 32 33 0d 0a 0d 0a 71 75 65 72  69..5723....quer
e430: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e440: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
e450: 32 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63  2 * + col1 + - c
e460: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
e470: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 35 0d 0a  r0..----..1475..
e480: 36 32 39 0d 0a 38 30 36 0d 0a 0d 0a 6f 6e 6c 79  629..806....only
e490: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
e4a0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
e4b0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
e4c0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e4d0: 74 20 6c 61 62 65 6c 2d 33 38 37 0d 0a 53 45 4c  t label-387..SEL
e4e0: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2d  ECT ALL col1 + -
e4f0: 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 41   col0 DIV col0 A
e500: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
e510: 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 33 30 0d 0a  ..----..16..30..
e520: 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  58....skipif mys
e530: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
e540: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
e550: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 37 0d 0a  sort label-387..
e560: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
e570: 2b 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 30 20  + - col0 / col0 
e580: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
e590: 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 33 30 0d  2..----..16..30.
e5a0: 0a 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .58....skipif po
e5b0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
e5c0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
e5d0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
e5e0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
e5f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e600: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 35 39 20 63  .SELECT ALL 59 c
e610: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
e620: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
e630: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
e640: 69 6e 67 20 74 6f 20 61 39 62 39 39 36 36 64 37  ing to a9b9966d7
e650: 34 39 64 31 62 32 63 65 35 39 35 35 65 64 31 32  49d1b2ce5955ed12
e660: 33 39 34 66 39 62 63 0d 0a 0d 0a 71 75 65 72 79  394f9bc....query
e670: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e680: 43 54 20 41 4c 4c 20 2b 20 2d 20 32 31 20 2a 20  CT ALL + - 21 * 
e690: 39 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  93 AS col2 FROM 
e6a0: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
e6b0: 2d 2d 0d 0a 2d 31 39 35 33 0d 0a 2d 31 39 35 33  --..-1953..-1953
e6c0: 0d 0a 2d 31 39 35 33 0d 0a 0d 0a 6f 6e 6c 79 69  ..-1953....onlyi
e6d0: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
e6e0: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
e6f0: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
e700: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e710: 20 6c 61 62 65 6c 2d 33 39 30 0d 0a 53 45 4c 45   label-390..SELE
e720: 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 37  CT cor0.col2 * 7
e730: 33 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56 20 39  3 - + col2 DIV 9
e740: 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  5 FROM tab2 AS c
e750: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 38 0d  or0..----..1898.
e760: 0a 31 39 37 31 0d 0a 32 37 37 34 0d 0a 0d 0a 73  .1971..2774....s
e770: 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
e780: 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
e790: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e7a0: 62 65 6c 2d 33 39 30 0d 0a 53 45 4c 45 43 54 20  bel-390..SELECT 
e7b0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 37 33 20 2d  cor0.col2 * 73 -
e7c0: 20 2b 20 63 6f 6c 32 20 2f 20 39 35 20 46 52 4f   + col2 / 95 FRO
e7d0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
e7e0: 2d 2d 2d 2d 0d 0a 31 38 39 38 0d 0a 31 39 37 31  ----..1898..1971
e7f0: 0d 0a 32 37 37 34 0d 0a 0d 0a 71 75 65 72 79 20  ..2774....query 
e800: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e810: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
e820: 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20  * + col1 * col1 
e830: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
e840: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
e850: 32 32 38 36 39 0d 0a 32 37 31 35 34 34 0d 0a 36  22869..271544..6
e860: 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  754....onlyif my
e870: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
e880: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
e890: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
e8a0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e8b0: 65 6c 2d 33 39 32 0d 0a 53 45 4c 45 43 54 20 2b  el-392..SELECT +
e8c0: 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 44 49 56   col1 - col0 DIV
e8d0: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
e8e0: 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
e8f0: 2d 2d 0d 0a 31 32 0d 0a 32 35 0d 0a 39 0d 0a 0d  --..12..25..9...
e900: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
e910: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
e920: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
e930: 6c 61 62 65 6c 2d 33 39 32 0d 0a 53 45 4c 45 43  label-392..SELEC
e940: 54 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20  T + col1 - col0 
e950: 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  / col0 AS col0 F
e960: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
e970: 2d 2d 2d 0d 0a 31 32 0d 0a 32 35 0d 0a 39 0d 0a  ---..12..25..9..
e980: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e990: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  t..SELECT - cor0
e9a0: 2e 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20  .col1 - col2 AS 
e9b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
e9c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
e9d0: 35 0d 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a 71  5..-58..-85....q
e9e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e9f0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
ea00: 2d 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  - - col0 * col0 
ea10: 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2b 20 31  + col2 + - ( + 1
ea20: 38 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  8 ) AS col2 FROM
ea30: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
ea40: 2d 2d 2d 0d 0a 34 31 33 35 0d 0a 34 35 0d 0a 36  ---..4135..45..6
ea50: 34 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  478....query I r
ea60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
ea70: 4c 4c 20 36 31 20 2b 20 63 6f 6c 30 20 2b 20 63  LL 61 + col0 + c
ea80: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
ea90: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35   cor0..----..135
eaa0: 0d 0a 31 35 34 0d 0a 39 30 0d 0a 0d 0a 71 75 65  ..154..90....que
eab0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
eac0: 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 32 36 20  LECT ALL - + 26 
ead0: 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  + - cor0.col1 + 
eae0: 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
eaf0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
eb00: 2d 31 34 34 0d 0a 2d 36 30 0d 0a 2d 38 38 0d 0a  -144..-60..-88..
eb10: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
eb20: 74 0d 0a 53 45 4c 45 43 54 20 39 31 20 2b 20 2d  t..SELECT 91 + -
eb30: 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
eb40: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
eb50: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35 0d 0a  cor0..----..65..
eb60: 37 38 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20  78..81....query 
eb70: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
eb80: 54 20 41 4c 4c 20 2b 20 38 38 20 2b 20 63 6f 6c  T ALL + 88 + col
eb90: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
eba0: 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
ebb0: 31 35 32 0d 0a 31 36 38 0d 0a 39 31 0d 0a 0d 0a  152..168..91....
ebc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ebd0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
ebe0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   - cor0.col2 * +
ebf0: 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63   col2 + - cor0.c
ec00: 6f 6c 32 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 + col2 AS co
ec10: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
ec20: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
ec30: 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a  -1089..-6724....
ec40: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ec50: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
ec60: 39 35 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63  95 + + col1 AS c
ec70: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
ec80: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32   cor0..----..112
ec90: 0d 0a 31 32 36 0d 0a 31 35 34 0d 0a 0d 0a 71 75  ..126..154....qu
eca0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ecb0: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 38 20  ELECT ALL + + 8 
ecc0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
ecd0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 0d  2 cor0..----..8.
ece0: 0a 38 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .8..8....query I
ecf0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ed00: 20 32 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74   2 - col1 FROM t
ed10: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a  ab0..----..-84..
ed20: 2d 38 39 0d 0a 2d 39 35 0d 0a 0d 0a 71 75 65 72  -89..-95....quer
ed30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ed40: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 33  ECT DISTINCT - 3
ed50: 32 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  2 * + col0 * + c
ed60: 6f 6c 32 20 2b 20 39 32 20 2a 20 2b 20 63 6f 6c  ol2 + 92 * + col
ed70: 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  1 * - cor0.col2 
ed80: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
ed90: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
eda0: 0a 2d 31 33 34 33 35 32 0d 0a 2d 31 36 39 31 37  .-134352..-16917
edb0: 36 0d 0a 2d 33 36 30 35 37 36 0d 0a 0d 0a 6f 6e  6..-360576....on
edc0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
edd0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
ede0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
edf0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
ee00: 6f 72 74 20 6c 61 62 65 6c 2d 34 30 34 0d 0a 53  ort label-404..S
ee10: 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63  ELECT + col0 + c
ee20: 6f 6c 30 20 44 49 56 20 38 35 20 46 52 4f 4d 20  ol0 DIV 85 FROM 
ee30: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
ee40: 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
ee50: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
ee60: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
ee70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ee80: 6c 61 62 65 6c 2d 34 30 34 0d 0a 53 45 4c 45 43  label-404..SELEC
ee90: 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  T + col0 + col0 
eea0: 2f 20 38 35 20 46 52 4f 4d 20 74 61 62 31 20 41  / 85 FROM tab1 A
eeb0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  S cor0..----..3.
eec0: 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79  .64..80....query
eed0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
eee0: 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20  CT ALL col1 * + 
eef0: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
ef00: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
ef10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d  or0..----..1040.
ef20: 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72  .640..78....quer
ef30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ef40: 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  ECT + col2 * cor
ef50: 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46 52  0.col0 + col0 FR
ef60: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
ef70: 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32  .----..165..3712
ef80: 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7760....query 
ef90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
efa0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 37 31 20  T DISTINCT + 71 
efb0: 2a 20 63 6f 6c 32 20 2b 20 32 31 20 2a 20 37 35  * col2 + 21 * 75
efc0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
efd0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 34 32 31 0d 0a  r0..----..3421..
efe0: 33 34 39 32 0d 0a 34 32 37 33 0d 0a 0d 0a 71 75  3492..4273....qu
eff0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f000: 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63  ELECT col2 + - c
f010: 6f 6c 30 20 2a 20 2d 20 31 35 20 41 53 20 63 6f  ol0 * - 15 AS co
f020: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
f030: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 36  cor0..----..1196
f040: 0d 0a 31 32 32 33 0d 0a 31 33 32 0d 0a 0d 0a 6f  ..1223..132....o
f050: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
f060: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
f070: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
f080: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
f090: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f0a0: 74 20 6c 61 62 65 6c 2d 34 30 39 0d 0a 53 45 4c  t label-409..SEL
f0b0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
f0c0: 20 31 33 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 43   13 * + col2 * C
f0d0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
f0e0: 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f  NED ) + col0 FRO
f0f0: 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
f100: 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  -..NULL....skipi
f110: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
f120: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
f130: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f140: 34 30 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  409..SELECT DIST
f150: 49 4e 43 54 20 2d 20 2b 20 31 33 20 2a 20 2b 20  INCT - + 13 * + 
f160: 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 4e 55  col2 * CAST ( NU
f170: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
f180: 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
f190: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
f1a0: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
f1b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
f1c0: 20 2d 20 2b 20 34 36 20 41 53 20 63 6f 6c 31 20   - + 46 AS col1 
f1d0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
f1e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 0d 0a 2d 34  0..----..-46..-4
f1f0: 36 0d 0a 2d 34 36 0d 0a 0d 0a 71 75 65 72 79 20  6..-46....query 
f200: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f210: 54 20 2b 20 32 36 20 2b 20 63 6f 6c 32 20 2a 20  T + 26 + col2 * 
f220: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
f230: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f240: 2d 0d 0a 32 30 35 34 0d 0a 32 31 35 0d 0a 33 30  -..2054..215..30
f250: 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  28....query I ro
f260: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
f270: 6c 30 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28 20  l0 + col0 + - ( 
f280: 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  - col1 ) FROM ta
f290: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35 0d 0a 32  b2..----..175..2
f2a0: 31 35 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72 79 20  15..45....query 
f2b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f2c0: 54 20 41 4c 4c 20 63 6f 6c 31 20 2b 20 2d 20 63  T ALL col1 + - c
f2d0: 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f 6c 31 20  ol1 * tab2.col1 
f2e0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
f2f0: 0a 2d 32 37 32 0d 0a 2d 33 34 32 32 0d 0a 2d 39  .-272..-3422..-9
f300: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
f310: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
f320: 4c 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  L - col0 + + col
f330: 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 * col0 FROM ta
f340: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 36 30  b2..----..42..60
f350: 30 36 0d 0a 36 31 36 32 0d 0a 0d 0a 71 75 65 72  06..6162....quer
f360: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f370: 45 43 54 20 44 49 53 54 49 4e 43 54 20 35 35 20  ECT DISTINCT 55 
f380: 2b 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 46 52  + - tab0.col0 FR
f390: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
f3a0: 33 34 0d 0a 32 30 0d 0a 33 31 0d 0a 0d 0a 73 6b  34..20..31....sk
f3b0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
f3c0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
f3d0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
f3e0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
f3f0: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
f400: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
f410: 49 53 54 49 4e 43 54 20 37 37 20 63 6f 6c 32 20  ISTINCT 77 col2 
f420: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
f430: 0a 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .77....onlyif my
f440: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
f450: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
f460: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
f470: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
f480: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
f490: 34 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  417..SELECT ALL 
f4a0: 2b 20 63 6f 6c 31 20 2a 20 74 61 62 31 2e 63 6f  + col1 * tab1.co
f4b0: 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 4e 55 4c  l1 + + CAST( NUL
f4c0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  L AS SIGNED ) FR
f4d0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab1..----..N
f4e0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
f4f0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
f500: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
f510: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f520: 74 20 6c 61 62 65 6c 2d 34 31 37 0d 0a 53 45 4c  t label-417..SEL
f530: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a  ECT ALL + col1 *
f540: 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2b 20 43   tab1.col1 + + C
f550: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
f560: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
f570: 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  1..----..NULL..N
f580: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c  ULL..NULL....onl
f590: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
f5a0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
f5b0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
f5c0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
f5d0: 72 74 20 6c 61 62 65 6c 2d 34 31 38 0d 0a 53 45  rt label-418..SE
f5e0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
f5f0: 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 44 49  - col0 + col0 DI
f600: 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  V col1 AS col0 F
f610: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
f620: 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 39 0d 0a 38  ..----..7..79..8
f630: 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
f640: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
f650: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
f660: 6f 72 74 20 6c 61 62 65 6c 2d 34 31 38 0d 0a 53  ort label-418..S
f670: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
f680: 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2f   - col0 + col0 /
f690: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
f6a0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
f6b0: 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 39 0d 0a 38 33  .----..7..79..83
f6c0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f6d0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f6e0: 49 4e 43 54 20 2b 20 31 35 20 2b 20 34 38 20 2a  INCT + 15 + 48 *
f6f0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
f700: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
f710: 35 39 0d 0a 33 30 38 37 0d 0a 33 38 35 35 0d 0a  59..3087..3855..
f720: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
f730: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
f740: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
f750: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
f760: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 32  rowsort label-42
f770: 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
f780: 43 54 20 63 6f 6c 31 20 2b 20 32 31 20 44 49 56  CT col1 + 21 DIV
f790: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
f7a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
f7b0: 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69  6..91..97....ski
f7c0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
f7d0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
f7e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f7f0: 6c 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20 44 49  l-420..SELECT DI
f800: 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 32 31  STINCT col1 + 21
f810: 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
f820: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
f830: 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71  .86..91..97....q
f840: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
f850: 53 45 4c 45 43 54 20 2d 20 39 37 20 2a 20 2b 20  SELECT - 97 * + 
f860: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
f870: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
f880: 2d 0d 0a 2d 35 32 33 38 0d 0a 2d 35 35 32 39 0d  -..-5238..-5529.
f890: 0a 2d 39 33 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-9312....onlyif
f8a0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
f8b0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
f8c0: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
f8d0: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
f8e0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
f8f0: 65 6c 2d 34 32 32 0d 0a 53 45 4c 45 43 54 20 41  el-422..SELECT A
f900: 4c 4c 20 2b 20 2b 20 43 41 53 54 28 20 63 6f 6c  LL + + CAST( col
f910: 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  1 AS SIGNED ) AS
f920: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
f930: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
f940: 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69  6..91..97....ski
f950: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
f960: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
f970: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f980: 6c 2d 34 32 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-422..SELECT AL
f990: 4c 20 2b 20 2b 20 43 41 53 54 20 28 20 63 6f 6c  L + + CAST ( col
f9a0: 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  1 AS INTEGER ) A
f9b0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
f9c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f9d0: 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75  86..91..97....qu
f9e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f9f0: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2d  ELECT ALL col2 -
fa00: 20 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f   tab2.col2 AS co
fa10: 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
fa20: 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
fa30: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
fa40: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
fa50: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
fa60: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
fa70: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
fa80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fa90: 41 4c 4c 20 28 20 2d 20 63 6f 6c 30 20 29 20 2b  ALL ( - col0 ) +
faa0: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 63   - col1 * col1 c
fab0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
fac0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
fad0: 34 0d 0a 2d 32 34 39 0d 0a 2d 36 37 39 0d 0a 0d  4..-249..-679...
fae0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
faf0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33 38 20  ..SELECT + - 38 
fb00: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
fb10: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
fb20: 0a 2d 33 38 0d 0a 2d 33 38 0d 0a 2d 33 38 0d 0a  .-38..-38..-38..
fb30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
fb40: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
fb50: 39 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  9 + col1 AS col0
fb60: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
fb70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 38 32  r0..----..77..82
fb80: 0d 0a 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..88....query I 
fb90: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
fba0: 41 4c 4c 20 2d 20 2d 20 32 34 20 2b 20 34 35 20  ALL - - 24 + 45 
fbb0: 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  * + col2 * - col
fbc0: 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  2 + - cor0.col0 
fbd0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
fbe0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 31 39 39  0..----..-131199
fbf0: 0d 0a 2d 31 34 36 32 34 35 0d 0a 2d 34 31 34 37  ..-146245..-4147
fc00: 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
fc10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
fc20: 53 54 49 4e 43 54 20 31 31 20 2d 20 63 6f 6c 30  STINCT 11 - col0
fc30: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
fc40: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 37 0d 0a 2d  r0..----..-67..-
fc50: 36 38 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  68..4....query I
fc60: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
fc70: 20 2d 20 2b 20 35 38 20 41 53 20 63 6f 6c 30 20   - + 58 AS col0 
fc80: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
fc90: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 38 0d 0a 2d 35  0..----..-58..-5
fca0: 38 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72 79 20  8..-58....query 
fcb0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fcc0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
fcd0: 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  2 * col0 + + col
fce0: 30 20 2a 20 2d 20 35 31 20 46 52 4f 4d 20 74 61  0 * - 51 FROM ta
fcf0: 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
fd00: 31 37 35 30 0d 0a 2d 34 33 32 0d 0a 32 37 35 39  1750..-432..2759
fd10: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
fd20: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 32  ort..SELECT + 12
fd30: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
fd40: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
fd50: 32 0d 0a 31 32 0d 0a 31 32 0d 0a 0d 0a 71 75 65  2..12..12....que
fd60: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
fd70: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
fd80: 35 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  5 * col0 AS col0
fd90: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
fda0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a 33 32  r0..----..15..32
fdb0: 30 0d 0a 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20  0..400....query 
fdc0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fdd0: 54 20 2d 20 63 6f 6c 31 20 2a 20 28 20 2d 20 37  T - col1 * ( - 7
fde0: 33 20 2b 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f  3 + + col0 ) FRO
fdf0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
fe00: 2d 2d 2d 2d 0d 0a 2d 31 30 32 0d 0a 2d 32 39 35  ----..-102..-295
fe10: 0d 0a 32 30 34 36 0d 0a 0d 0a 71 75 65 72 79 20  ..2046....query 
fe20: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
fe30: 54 20 2d 20 28 20 28 20 63 6f 6c 31 20 29 20 29  T - ( ( col1 ) )
fe40: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
fe50: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
fe60: 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d  ..-86..-91..-97.
fe70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
fe80: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
fe90: 4e 43 54 20 2d 20 2b 20 31 37 20 46 52 4f 4d 20  NCT - + 17 FROM 
fea0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
feb0: 2d 2d 0d 0a 2d 31 37 0d 0a 0d 0a 71 75 65 72 79  --..-17....query
fec0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
fed0: 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f  CT ALL col0 * co
fee0: 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l1 + - col2 FROM
fef0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
ff00: 2d 2d 2d 0d 0a 32 30 33 31 0d 0a 33 33 39 34 0d  ---..2031..3394.
ff10: 0a 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .8017....query I
ff20: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
ff30: 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20   ALL + col0 * + 
ff40: 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52  col2 + - col1 FR
ff50: 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
ff60: 35 38 0d 0a 31 39 36 39 0d 0a 32 39 38 35 0d 0a  58..1969..2985..
ff70: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
ff80: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
ff90: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
ffa0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
ffb0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33  rowsort label-43
ffc0: 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  8..SELECT ALL + 
ffd0: 38 34 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b 20  84 DIV + col1 + 
ffe0: 2b 20 63 6f 6c 32 20 2a 20 2d 20 39 32 20 2a 20  + col2 * - 92 * 
fff0: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  - col1 AS col2 F
10000 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
10010 31 31 34 38 32 32 0d 0a 31 32 39 31 37 31 0d 0a  114822..129171..
10020 35 32 34 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  52448....skipif 
10030 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
10040 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
10050 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 33  rowsort label-43
10060 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  8..SELECT ALL + 
10070 38 34 20 2f 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  84 / + col1 + + 
10080 63 6f 6c 32 20 2a 20 2d 20 39 32 20 2a 20 2d 20  col2 * - 92 * - 
10090 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
100a0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
100b0 34 38 32 32 0d 0a 31 32 39 31 37 31 0d 0a 35 32  4822..129171..52
100c0 34 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  448....query I r
100d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
100e0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 2b  ol1 * - col1 * +
100f0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52   col2 AS col0 FR
10100 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
10110 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 38 32 0d 0a 2d  .----..-10982..-
10120 32 35 39 34 37 0d 0a 2d 39 30 35 30 36 0d 0a 0d  25947..-90506...
10130 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10140 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
10150 54 20 2b 20 28 20 31 35 20 29 20 46 52 4f 4d 20  T + ( 15 ) FROM 
10160 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a  tab2..----..15..
10170 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10180 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  t..SELECT + ( co
10190 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 29 20 2a 20  l0 + + col2 ) * 
101a0 36 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  62 AS col1 FROM 
101b0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30  tab0..----..1060
101c0 32 0d 0a 32 32 33 32 0d 0a 33 35 33 34 0d 0a 0d  2..2232..3534...
101d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
101e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
101f0 2b 20 63 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f  + col1 * tab0.co
10200 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63  l2 + - col0 AS c
10210 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
10220 2d 2d 2d 0d 0a 32 37 0d 0a 32 37 39 30 0d 0a 37  ---..27..2790..7
10230 32 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  284....query I r
10240 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31  owsort..SELECT 1
10250 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  7 AS col2 FROM t
10260 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
10270 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
10280 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 33 32  s hashing to 432
10290 39 38 65 34 33 33 36 35 66 63 63 62 35 31 34 36  98e43365fccb5146
102a0 65 61 33 32 30 30 33 37 35 33 63 39 32 0d 0a 0d  ea32003753c92...
102b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
102c0 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
102d0 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 * - cor0.col1 
102e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
102f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
10300 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37  .-100..-169..-67
10310 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
10320 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 38  sort..SELECT + 8
10330 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 36 35 20  0 + col2 * - 65 
10340 2a 20 2b 20 28 20 63 6f 6c 30 20 29 20 46 52 4f  * + ( col0 ) FRO
10350 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
10360 2d 2d 2d 2d 0d 0a 2d 31 30 34 35 30 0d 0a 2d 32  ----..-10450..-2
10370 33 37 30 34 30 0d 0a 2d 34 39 39 31 32 30 0d 0a  37040..-499120..
10380 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10390 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
103a0 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 31 36  l1 + + col2 * 16
103b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
103c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 32 33 0d 0a  r0..----..1523..
103d0 38 33 38 0d 0a 39 30 32 0d 0a 0d 0a 71 75 65 72  838..902....quer
103e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
103f0 45 43 54 20 31 39 20 2a 20 2d 20 63 6f 6c 32 20  ECT 19 * - col2 
10400 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
10410 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
10420 0a 2d 34 39 34 0d 0a 2d 35 31 33 0d 0a 2d 37 32  .-494..-513..-72
10430 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
10440 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
10450 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
10460 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
10470 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36 37  ..----..1444..67
10480 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79 20  6..729....query 
10490 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
104a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 32 35 20  T DISTINCT - 25 
104b0 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
104c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
104d0 2d 2d 2d 0d 0a 2d 31 33 35 30 0d 0a 2d 31 34 32  ---..-1350..-142
104e0 35 0d 0a 2d 32 34 30 30 0d 0a 0d 0a 71 75 65 72  5..-2400....quer
104f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10500 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
10510 20 37 36 20 46 52 4f 4d 20 74 61 62 30 20 41 53   76 FROM tab0 AS
10520 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 36   cor0..----..-76
10530 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
10540 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 31 20 2a  ort..SELECT 31 *
10550 20 63 6f 6c 32 20 2b 20 39 36 20 2a 20 63 6f 6c   col2 + 96 * col
10560 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
10570 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 39 32  or0..----..12192
10580 0d 0a 36 38 35 38 0d 0a 37 32 33 39 0d 0a 0d 0a  ..6858..7239....
10590 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
105a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20  .SELECT ALL + ( 
105b0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 29 20  + col0 * col0 ) 
105c0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
105d0 0a 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d  .49..6084..6241.
105e0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
105f0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
10600 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
10610 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
10620 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10630 35 33 0d 0a 53 45 4c 45 43 54 20 32 20 44 49 56  53..SELECT 2 DIV
10640 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
10650 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  1..----..0..0..0
10660 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
10670 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
10680 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
10690 72 74 20 6c 61 62 65 6c 2d 34 35 33 0d 0a 53 45  rt label-453..SE
106a0 4c 45 43 54 20 32 20 2f 20 2b 20 63 6f 6c 30 20  LECT 2 / + col0 
106b0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
106c0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
106d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
106e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38  ECT DISTINCT + 8
106f0 35 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63  5 * - col0 * - c
10700 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
10710 2d 2d 2d 0d 0a 31 36 30 36 35 0d 0a 31 37 32 33  ---..16065..1723
10720 38 30 0d 0a 32 35 35 31 37 30 0d 0a 0d 0a 71 75  80..255170....qu
10730 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
10740 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
10750 20 32 37 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2d   27 * - col2 * -
10760 20 28 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20   ( ( + col0 ) * 
10770 2b 20 34 30 20 29 20 41 53 20 63 6f 6c 31 20 46  + 40 ) AS col1 F
10780 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
10790 33 37 38 30 30 0d 0a 37 38 38 31 38 34 30 0d 0a  37800..7881840..
107a0 38 35 35 33 36 30 0d 0a 0d 0a 73 6b 69 70 69 66  855360....skipif
107b0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
107c0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
107d0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
107e0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
107f0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
10800 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
10810 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b  ol0 + - col1 * +
10820 20 35 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c   51 + - cor0.col
10830 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  2 col0 FROM tab0
10840 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10850 2d 34 33 39 35 0d 0a 2d 34 36 33 34 0d 0a 2d 34  -4395..-4634..-4
10860 39 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  913....query I r
10870 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
10880 49 53 54 49 4e 43 54 20 2b 20 38 32 20 46 52 4f  ISTINCT + 82 FRO
10890 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
108a0 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f  cor0, tab2 AS co
108b0 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 32 0d 0a 0d 0a  r1..----..82....
108c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
108d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
108e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
108f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
10900 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 38 0d  wsort label-458.
10910 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 44 49 56  .SELECT col0 DIV
10920 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41   col1 + + col2 A
10930 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
10940 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 35 34 0d  ..----..102..54.
10950 0a 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .63....skipif my
10960 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
10970 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
10980 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 35 38 0d  wsort label-458.
10990 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 63  .SELECT col0 / c
109a0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol1 + + col2 AS 
109b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
109c0 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 35 34 0d 0a 36  ----..102..54..6
109d0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
109e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
109f0 20 35 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20   51 - - col2 AS 
10a00 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
10a10 2d 2d 2d 2d 0d 0a 31 33 33 0d 0a 35 32 0d 0a 38  ----..133..52..8
10a20 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
10a30 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
10a40 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
10a50 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
10a60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
10a70 2d 34 36 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -460..SELECT - c
10a80 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 31 20 2a  ol0 * ( - col1 *
10a90 20 63 6f 6c 32 20 29 20 2b 20 28 20 2d 20 63 6f   col2 ) + ( - co
10aa0 6c 32 20 29 20 44 49 56 20 63 6f 72 30 2e 63 6f  l2 ) DIV cor0.co
10ab0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 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 33 36 34 37 39 0d 0a 34 32 31 31 0d  --..36479..4211.
10ae0 0a 39 39 38 33 39 0d 0a 0d 0a 73 6b 69 70 69 66  .99839....skipif
10af0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
10b00 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
10b10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
10b20 36 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  60..SELECT - col
10b30 30 20 2a 20 28 20 2d 20 63 6f 6c 31 20 2a 20 63  0 * ( - col1 * c
10b40 6f 6c 32 20 29 20 2b 20 28 20 2d 20 63 6f 6c 32  ol2 ) + ( - col2
10b50 20 29 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20 41   ) / cor0.col2 A
10b60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
10b70 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10b80 33 36 34 37 39 0d 0a 34 32 31 31 0d 0a 39 39 38  36479..4211..998
10b90 33 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  39....onlyif mys
10ba0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
10bb0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
10bc0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
10bd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
10be0 6c 2d 34 36 31 0d 0a 53 45 4c 45 43 54 20 2b 20  l-461..SELECT + 
10bf0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20  + col2 * col2 + 
10c00 2b 20 32 36 20 44 49 56 20 2b 20 63 6f 6c 32 20  + 26 DIV + col2 
10c10 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
10c20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10c30 32 39 37 30 0d 0a 33 33 30 36 0d 0a 39 33 31 32  2970..3306..9312
10c40 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
10c50 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
10c60 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
10c70 72 74 20 6c 61 62 65 6c 2d 34 36 31 0d 0a 53 45  rt label-461..SE
10c80 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  LECT + + col2 * 
10c90 63 6f 6c 32 20 2b 20 2b 20 32 36 20 2f 20 2b 20  col2 + + 26 / + 
10ca0 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col2 + col2 FROM
10cb0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
10cc0 2d 2d 2d 0d 0a 32 39 37 30 0d 0a 33 33 30 36 0d  ---..2970..3306.
10cd0 0a 39 33 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .9312....query I
10ce0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10cf0 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2d 20   DISTINCT - ( - 
10d00 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 2d 20  cor0.col0 ) + - 
10d10 31 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  19 AS col1 FROM 
10d20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
10d30 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
10d40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 34 35 0d  ..----..-16..45.
10d50 0a 36 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .61....onlyif my
10d60 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
10d70 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
10d80 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
10d90 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
10da0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
10db0 34 36 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  463..SELECT - + 
10dc0 63 6f 6c 32 20 2a 20 43 41 53 54 28 20 4e 55 4c  col2 * CAST( NUL
10dd0 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2b  L AS DECIMAL ) +
10de0 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
10df0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10e00 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
10e10 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
10e20 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
10e30 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
10e40 6f 72 74 20 6c 61 62 65 6c 2d 34 36 33 0d 0a 53  ort label-463..S
10e50 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a  ELECT - + col2 *
10e60 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
10e70 52 45 41 4c 20 29 20 2b 20 2d 20 63 6f 6c 32 20  REAL ) + - col2 
10e80 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
10e90 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
10ea0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
10eb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
10ec0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20  LECT - + col2 + 
10ed0 34 33 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  43 FROM tab2 cor
10ee0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 37 0d  0..----..16..17.
10ef0 0a 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .5....query I ro
10f00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
10f10 4c 20 2d 20 63 6f 6c 32 20 2b 20 28 20 2d 20 63  L - col2 + ( - c
10f20 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20 2b 20 63  ol2 ) * col0 + c
10f30 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
10f40 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
10f50 0d 0a 2d 31 39 30 0d 0a 2d 33 36 39 35 0d 0a 2d  ..-190..-3695..-
10f60 37 37 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7763....query I 
10f70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10f80 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b  ALL - + col2 * +
10f90 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
10fa0 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 * col2 FROM 
10fb0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
10fc0 2d 2d 0d 0a 2d 31 35 33 36 30 0d 0a 2d 33 32 34  --..-15360..-324
10fd0 0d 0a 2d 37 32 39 36 0d 0a 0d 0a 71 75 65 72 79  ..-7296....query
10fe0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10ff0 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20  CT + col0 * - ( 
11000 2d 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 32 20  - col2 ) + col2 
11010 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
11020 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36  0 cor0..----..36
11030 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d 0a 71  ..7380..825....q
11040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11050 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
11060 38 30 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  80 + - col0 FROM
11070 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
11080 0d 0a 31 30 30 0d 0a 32 38 0d 0a 33 39 0d 0a 0d  ..100..28..39...
11090 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
110a0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20  ..SELECT - col2 
110b0 2a 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a  * - ( - col1 ) *
110c0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
110d0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
110e0 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a  .----..-119652..
110f0 2d 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d  -51034..-5859...
11100 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
11110 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
11120 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
11130 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
11140 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
11150 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11160 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d  T ALL + col0 * -
11170 20 28 20 2d 20 28 20 63 6f 6c 32 20 29 20 29 20   ( - ( col2 ) ) 
11180 2b 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  + - col1 col0 FR
11190 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
111a0 0a 2d 2d 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36 39  .----..158..1969
111b0 0d 0a 32 39 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..2985....onlyif
111c0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
111d0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
111e0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
111f0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
11200 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11210 65 6c 2d 34 37 31 0d 0a 53 45 4c 45 43 54 20 44  el-471..SELECT D
11220 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30  ISTINCT - - col0
11230 20 2d 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20   - + CAST( NULL 
11240 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
11250 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
11260 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
11270 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11280 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11290 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
112a0 6c 2d 34 37 31 0d 0a 53 45 4c 45 43 54 20 44 49  l-471..SELECT DI
112b0 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20  STINCT - - col0 
112c0 2d 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  - + CAST ( NULL 
112d0 41 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f  AS INTEGER ) FRO
112e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
112f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  ----..NULL....qu
11300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11310 45 4c 45 43 54 20 2b 20 28 20 2b 20 36 30 20 29  ELECT + ( + 60 )
11320 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
11330 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11340 0d 0a 36 30 0d 0a 36 30 0d 0a 36 30 0d 0a 0d 0a  ..60..60..60....
11350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11360 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f  .SELECT + + ( co
11370 6c 31 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 ) + col2 FROM
11380 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
11390 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
113a0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
113b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
113c0 20 2b 20 33 38 20 46 52 4f 4d 20 74 61 62 31 2c   + 38 FROM tab1,
113d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
113e0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
113f0 73 68 69 6e 67 20 74 6f 20 61 66 61 64 64 61 64  shing to afaddad
11400 30 61 34 65 33 61 31 36 38 33 61 31 63 38 63 62  0a4e3a1683a1c8cb
11410 65 36 65 62 35 32 32 61 37 0d 0a 0d 0a 71 75 65  e6eb522a7....que
11420 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11430 4c 45 43 54 20 2b 20 35 30 20 2a 20 2b 20 63 6f  LECT + 50 * + co
11440 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
11450 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
11460 2d 2d 0d 0a 31 35 35 30 0d 0a 32 39 35 30 0d 0a  --..1550..2950..
11470 38 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  850....query I r
11480 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
11490 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2d 20   ( - col0 ) * - 
114a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
114b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34  or0..----..-2064
114c0 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39 39 0d 0a  ..-3395..-8099..
114d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
114e0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
114f0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
11500 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
11510 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
11520 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 37 0d 0a  sort label-477..
11530 53 45 4c 45 43 54 20 2b 20 2d 20 43 41 53 54 28  SELECT + - CAST(
11540 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   + col0 AS SIGNE
11550 44 20 29 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  D ) * + col2 AS 
11560 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
11570 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
11580 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32  89..-2028..-3002
11590 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
115a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
115b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
115c0 72 74 20 6c 61 62 65 6c 2d 34 37 37 0d 0a 53 45  rt label-477..SE
115d0 4c 45 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20  LECT + - CAST ( 
115e0 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  + col0 AS INTEGE
115f0 52 20 29 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20  R ) * + col2 AS 
11600 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
11610 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
11620 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32  89..-2028..-3002
11630 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11640 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
11650 32 31 20 2a 20 35 31 20 41 53 20 63 6f 6c 31 20  21 * 51 AS col1 
11660 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
11670 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 37 31 0d 0a 31  0..----..1071..1
11680 30 37 31 0d 0a 31 30 37 31 0d 0a 0d 0a 71 75 65  071..1071....que
11690 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
116a0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  LECT + - col2 * 
116b0 28 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  ( cor0.col2 * + 
116c0 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
116d0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
116e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d 0a  ..----..-26136..
116f0 2d 33 35 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d 0a  -35..-598436....
11700 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11710 0a 53 45 4c 45 43 54 20 2b 20 36 35 20 2d 20 2d  .SELECT + 65 - -
11720 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
11730 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
11740 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 0d  cor0..----..151.
11750 0a 31 35 36 0d 0a 31 36 32 0d 0a 0d 0a 71 75 65  .156..162....que
11760 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11770 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
11780 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  col2 * col0 + + 
11790 36 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  61 AS col0 FROM 
117a0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
117b0 0a 2d 37 32 33 37 0d 0a 2d 37 33 31 0d 0a 32 36  .-7237..-731..26
117c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
117d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
117e0 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  INCT cor0.col0 +
117f0 20 63 6f 6c 30 20 2a 20 28 20 2d 20 31 38 20 29   col0 * ( - 18 )
11800 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
11810 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
11820 0d 0a 2d 31 31 39 0d 0a 2d 31 33 32 36 0d 0a 2d  ..-119..-1326..-
11830 31 33 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1343....query I 
11840 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11850 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e  + col1 * + cor0.
11860 63 6f 6c 31 20 2d 20 37 39 20 46 52 4f 4d 20 74  col1 - 79 FROM t
11870 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
11880 2d 0d 0a 37 33 31 37 0d 0a 38 32 30 32 0d 0a 39  -..7317..8202..9
11890 33 33 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  330....onlyif my
118a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
118b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
118c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
118d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
118e0 65 6c 2d 34 38 34 0d 0a 53 45 4c 45 43 54 20 35  el-484..SELECT 5
118f0 31 20 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20  1 DIV + col1 AS 
11900 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
11910 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
11920 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
11930 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
11940 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11950 6c 61 62 65 6c 2d 34 38 34 0d 0a 53 45 4c 45 43  label-484..SELEC
11960 54 20 35 31 20 2f 20 2b 20 63 6f 6c 31 20 41 53  T 51 / + col1 AS
11970 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
11980 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
11990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
119a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
119b0 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20   col1 + col0 AS 
119c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
119d0 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 35 35 0d 0a 38  ----..106..55..8
119e0 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
119f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
11a00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
11a10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  ort..SELECT CAST
11a20 20 28 20 63 6f 6c 31 20 41 53 20 52 45 41 4c 20   ( col1 AS REAL 
11a30 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
11a40 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33  ab2..----..17..3
11a50 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  1..59....query I
11a60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
11a70 20 44 49 53 54 49 4e 43 54 20 2d 20 31 36 20 2b   DISTINCT - 16 +
11a80 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   + cor0.col1 FRO
11a90 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
11aa0 2d 2d 2d 2d 0d 0a 31 0d 0a 31 35 0d 0a 34 33 0d  ----..1..15..43.
11ab0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
11ac0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
11ad0 20 63 6f 6c 30 20 2d 20 2b 20 39 38 20 46 52 4f   col0 - + 98 FRO
11ae0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
11af0 2d 2d 2d 2d 0d 0a 2d 31 30 35 0d 0a 2d 31 37 36  ----..-105..-176
11b00 0d 0a 2d 31 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-177....onlyif
11b10 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
11b20 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
11b30 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
11b40 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
11b50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11b60 65 6c 2d 34 38 39 0d 0a 53 45 4c 45 43 54 20 2d  el-489..SELECT -
11b70 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20   - CAST( + col0 
11b80 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20  AS SIGNED ) * - 
11b90 63 6f 6c 31 20 2a 20 39 31 20 2b 20 2b 20 63 6f  col1 * 91 + + co
11ba0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
11bb0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11bc0 2d 2d 0d 0a 2d 35 38 31 37 36 0d 0a 2d 37 30 39  --..-58176..-709
11bd0 35 0d 0a 2d 39 34 35 36 30 0d 0a 0d 0a 73 6b 69  5..-94560....ski
11be0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11bf0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11c00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11c10 6c 2d 34 38 39 0d 0a 53 45 4c 45 43 54 20 2d 20  l-489..SELECT - 
11c20 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20  - CAST ( + col0 
11c30 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d  AS INTEGER ) * -
11c40 20 63 6f 6c 31 20 2a 20 39 31 20 2b 20 2b 20 63   col1 * 91 + + c
11c50 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
11c60 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
11c70 2d 2d 2d 0d 0a 2d 35 38 31 37 36 0d 0a 2d 37 30  ---..-58176..-70
11c80 39 35 0d 0a 2d 39 34 35 36 30 0d 0a 0d 0a 71 75  95..-94560....qu
11c90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
11ca0 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  ELECT - + cor0.c
11cb0 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ol2 + cor0.col2 
11cc0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
11cd0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
11ce0 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  .0..0..0....only
11cf0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
11d00 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
11d10 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
11d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
11d30 74 20 6c 61 62 65 6c 2d 34 39 31 0d 0a 53 45 4c  t label-491..SEL
11d40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
11d50 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20 63  ol1 DIV col1 + c
11d60 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
11d70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
11d80 0d 0a 31 32 0d 0a 32 35 0d 0a 39 0d 0a 0d 0a 73  ..12..25..9....s
11d90 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
11da0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
11db0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11dc0 62 65 6c 2d 34 39 31 0d 0a 53 45 4c 45 43 54 20  bel-491..SELECT 
11dd0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
11de0 2f 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  / col1 + cor0.co
11df0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
11e00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a  cor0..----..12..
11e10 32 35 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  25..9....onlyif 
11e20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
11e30 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
11e40 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
11e50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
11e60 61 62 65 6c 2d 34 39 32 0d 0a 53 45 4c 45 43 54  abel-492..SELECT
11e70 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 6c 32   ALL col2 + col2
11e80 20 44 49 56 20 2d 20 63 6f 6c 31 20 2d 20 2b 20   DIV - col1 - + 
11e90 39 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  91 FROM tab1 cor
11ea0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 33 39  0..----..-2..-39
11eb0 0d 0a 2d 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-39....skipif 
11ec0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
11ed0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
11ee0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39  rowsort label-49
11ef0 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  2..SELECT ALL co
11f00 6c 32 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f  l2 + col2 / - co
11f10 6c 31 20 2d 20 2b 20 39 31 20 46 52 4f 4d 20 74  l1 - + 91 FROM t
11f20 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
11f30 2d 32 0d 0a 2d 33 39 0d 0a 2d 33 39 0d 0a 0d 0a  -2..-39..-39....
11f40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11f50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11f60 20 63 6f 6c 32 20 2a 20 2d 20 36 37 20 2b 20 63   col2 * - 67 + c
11f70 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
11f80 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
11f90 2d 2d 2d 0d 0a 2d 31 36 36 34 0d 0a 2d 31 38 30  ---..-1664..-180
11fa0 32 0d 0a 2d 32 34 36 37 0d 0a 0d 0a 71 75 65 72  2..-2467....quer
11fb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11fc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b  ECT DISTINCT - +
11fd0 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20   col1 - col0 AS 
11fe0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
11ff0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
12000 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 71  9..-74..-93....q
12010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12020 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20  SELECT - ( col2 
12030 29 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  ) + col1 * - col
12040 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
12050 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 31  or0..----..-1381
12060 0d 0a 2d 32 34 34 0d 0a 2d 34 36 32 38 0d 0a 0d  ..-244..-4628...
12070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12080 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
12090 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol2 + col0 * col
120a0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
120b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37 0d  or0..----..2097.
120c0 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a 71  .3396..8181....q
120d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
120e0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2d  SELECT ALL + ( -
120f0 20 33 35 20 29 20 2a 20 2d 20 63 6f 6c 30 20 46   35 ) * - col0 F
12100 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
12110 0d 0a 2d 2d 2d 2d 0d 0a 32 34 35 0d 0a 32 37 33  ..----..245..273
12120 30 0d 0a 32 37 36 35 0d 0a 0d 0a 71 75 65 72 79  0..2765....query
12130 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12140 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
12150 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   * + col1 + - co
12160 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
12170 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32 0d  cor0..----..272.
12180 0a 33 34 32 32 0d 0a 39 33 30 0d 0a 0d 0a 71 75  .3422..930....qu
12190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
121a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
121b0 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  or0.col1 + - col
121c0 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  2 * + cor0.col2 
121d0 2a 20 34 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 43 AS col2 FRO
121e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
121f0 2d 2d 2d 2d 0d 0a 2d 32 39 30 30 39 0d 0a 2d 33  ----..-29009..-3
12200 31 33 31 36 0d 0a 2d 36 32 30 37 35 0d 0a 0d 0a  1316..-62075....
12210 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
12220 0a 53 45 4c 45 43 54 20 28 20 2b 20 34 35 20 29  .SELECT ( + 45 )
12230 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46   + + cor0.col0 F
12240 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
12250 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 31 32 35  ..----..109..125
12260 0d 0a 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..48....onlyif m
12270 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
12280 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
12290 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
122a0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
122b0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
122c0 2d 35 30 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -501..SELECT ALL
122d0 20 2d 20 43 41 53 54 28 20 2b 20 63 6f 6c 30 20   - CAST( + col0 
122e0 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63  AS SIGNED ) AS c
122f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
12300 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
12310 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69  .-64..-80....ski
12320 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
12330 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
12340 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12350 6c 2d 35 30 31 0d 0a 53 45 4c 45 43 54 20 41 4c  l-501..SELECT AL
12360 4c 20 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c  L - CAST ( + col
12370 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  0 AS INTEGER ) A
12380 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
12390 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
123a0 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a  -3..-64..-80....
123b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
123c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
123d0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2b   col2 * col0 * +
123e0 20 63 6f 6c 32 20 2d 20 28 20 2d 20 63 6f 6c 32   col2 - ( - col2
123f0 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   ) * + cor0.col0
12400 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
12410 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31 35 38 34  r0..----..211584
12420 0d 0a 37 34 34 39 36 30 0d 0a 38 39 31 30 0d 0a  ..744960..8910..
12430 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
12440 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
12450 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
12460 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
12470 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 30  rowsort label-50
12480 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  3..SELECT - col0
12490 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 44 49 56   * tab0.col2 DIV
124a0 20 39 38 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   98 FROM tab0..-
124b0 2d 2d 2d 0d 0a 2d 37 34 0d 0a 2d 38 0d 0a 30 0d  ---..-74..-8..0.
124c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
124d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
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 33 0d 0a 53 45 4c  t label-503..SEL
12500 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62  ECT - col0 * tab
12510 30 2e 63 6f 6c 32 20 2f 20 39 38 20 46 52 4f 4d  0.col2 / 98 FROM
12520 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34   tab0..----..-74
12530 0d 0a 2d 38 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-8..0....onlyi
12540 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
12550 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
12560 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
12570 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
12580 20 6c 61 62 65 6c 2d 35 30 34 0d 0a 53 45 4c 45   label-504..SELE
12590 43 54 20 37 37 20 44 49 56 20 63 6f 72 30 2e 63  CT 77 DIV cor0.c
125a0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
125b0 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
125c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
125d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34  ues hashing to 4
125e0 33 61 33 38 37 65 66 34 62 61 38 35 39 32 37 64  3a387ef4ba85927d
125f0 63 33 64 39 64 35 37 33 61 66 63 31 32 63 39 0d  c3d9d573afc12c9.
12600 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
12610 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
12620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12630 74 20 6c 61 62 65 6c 2d 35 30 34 0d 0a 53 45 4c  t label-504..SEL
12640 45 43 54 20 37 37 20 2f 20 63 6f 72 30 2e 63 6f  ECT 77 / cor0.co
12650 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
12660 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
12670 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
12680 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 34 33  es hashing to 43
12690 61 33 38 37 65 66 34 62 61 38 35 39 32 37 64 63  a387ef4ba85927dc
126a0 33 64 39 64 35 37 33 61 66 63 31 32 63 39 0d 0a  3d9d573afc12c9..
126b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
126c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
126d0 43 54 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 32  CT - col1 - col2
126e0 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   * col0 AS col1 
126f0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
12700 0a 2d 31 38 38 0d 0a 2d 33 36 35 38 0d 0a 2d 37  .-188..-3658..-7
12710 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  693....query I r
12720 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
12730 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2b 20 63   tab2.col0 * + c
12740 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
12750 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   tab2..----..-13
12760 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d  43..-217..-4602.
12770 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12780 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
12790 2a 20 28 20 34 33 20 29 20 46 52 4f 4d 20 74 61  * ( 43 ) FROM ta
127a0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 32 0d 0a  b0..----..1032..
127b0 31 35 30 35 0d 0a 33 38 32 37 0d 0a 0d 0a 71 75  1505..3827....qu
127c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
127d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
127e0 6f 6c 32 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63  ol2 - + col0 * c
127f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
12800 2d 2d 2d 0d 0a 2d 32 30 33 31 0d 0a 2d 33 33 39  ---..-2031..-339
12810 34 0d 0a 2d 38 30 31 37 0d 0a 0d 0a 71 75 65 72  4..-8017....quer
12820 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12830 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
12840 31 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  1.col2 * + col1 
12850 2b 20 36 36 20 2d 20 2d 20 63 6f 6c 32 20 46 52  + 66 - - col2 FR
12860 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
12870 34 31 30 0d 0a 31 35 32 34 0d 0a 36 39 33 0d 0a  410..1524..693..
12880 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
12890 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
128a0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
128b0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
128c0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
128d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
128e0 43 54 20 63 6f 6c 30 20 2b 20 37 31 20 63 6f 6c  CT col0 + 71 col
128f0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
12900 2d 0d 0a 31 34 39 0d 0a 31 35 30 0d 0a 37 38 0d  -..149..150..78.
12910 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12920 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
12930 4e 43 54 20 2d 20 28 20 2d 20 74 61 62 31 2e 63  NCT - ( - tab1.c
12940 6f 6c 30 20 29 20 2a 20 63 6f 6c 31 20 2b 20 2d  ol0 ) * col1 + -
12950 20 28 20 38 32 20 29 20 2a 20 63 6f 6c 30 20 41   ( 82 ) * col0 A
12960 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
12970 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 38 0d 0a 2d 34  ..----..-168..-4
12980 36 30 38 0d 0a 2d 35 35 32 30 0d 0a 0d 0a 6f 6e  608..-5520....on
12990 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
129a0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
129b0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
129c0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
129d0 6f 72 74 20 6c 61 62 65 6c 2d 35 31 32 0d 0a 53  ort label-512..S
129e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
129f0 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 2b 20 63  ol1 DIV col1 + c
12a00 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
12a10 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a   tab0..----..2..
12a20 33 34 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66  34..83....skipif
12a30 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
12a40 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
12a50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
12a60 31 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  12..SELECT DISTI
12a70 4e 43 54 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  NCT col1 / col1 
12a80 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
12a90 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
12aa0 32 0d 0a 33 34 0d 0a 38 33 0d 0a 0d 0a 71 75 65  2..34..83....que
12ab0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12ac0 4c 45 43 54 20 2d 20 34 38 20 41 53 20 63 6f 6c  LECT - 48 AS col
12ad0 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
12ae0 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 2c  2 AS cor0, tab2,
12af0 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
12b00 2d 2d 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68  ---..81 values h
12b10 61 73 68 69 6e 67 20 74 6f 20 37 30 62 30 63 66  ashing to 70b0cf
12b20 66 39 31 33 63 65 63 38 35 36 35 34 61 66 30 61  f913cec85654af0a
12b30 61 66 33 66 35 66 36 64 38 35 0d 0a 0d 0a 6f 6e  af3f5f6d85....on
12b40 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
12b50 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
12b60 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
12b70 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
12b80 6f 72 74 20 6c 61 62 65 6c 2d 35 31 34 0d 0a 53  ort label-514..S
12b90 45 4c 45 43 54 20 63 6f 6c 31 20 44 49 56 20 2b  ELECT col1 DIV +
12ba0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41   col2 + + col2 A
12bb0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
12bc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12bd0 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b  54..57..96....sk
12be0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
12bf0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
12c00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
12c10 65 6c 2d 35 31 34 0d 0a 53 45 4c 45 43 54 20 63  el-514..SELECT c
12c20 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32 20 2b 20 2b  ol1 / + col2 + +
12c30 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
12c40 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
12c50 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39  .----..54..57..9
12c60 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
12c70 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
12c80 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
12c90 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
12ca0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
12cb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31  rowsort label-51
12cc0 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  5..SELECT DISTIN
12cd0 43 54 20 2d 20 2b 20 34 33 20 2b 20 2d 20 28 20  CT - + 43 + - ( 
12ce0 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 28 20 4e  col0 * - CAST( N
12cf0 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
12d00 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
12d10 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
12d20 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
12d30 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
12d40 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
12d50 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
12d60 2d 35 31 35 0d 0a 53 45 4c 45 43 54 20 44 49 53  -515..SELECT DIS
12d70 54 49 4e 43 54 20 2d 20 2b 20 34 33 20 2b 20 2d  TINCT - + 43 + -
12d80 20 28 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54   ( col0 * - CAST
12d90 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
12da0 29 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ) ) AS col2 FROM
12db0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
12dc0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
12dd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12de0 4c 45 43 54 20 2d 20 39 38 20 2a 20 63 6f 6c 31  LECT - 98 * col1
12df0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
12e00 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
12e10 0d 0a 2d 38 34 32 38 0d 0a 2d 38 39 31 38 0d 0a  ..-8428..-8918..
12e20 2d 39 35 30 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -9506....onlyif 
12e30 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
12e40 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
12e50 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
12e60 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
12e70 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
12e80 6c 2d 35 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c  l-517..SELECT AL
12e90 4c 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  L + - CAST( NULL
12ea0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d   AS SIGNED ) + -
12eb0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
12ec0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
12ed0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
12ee0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
12ef0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
12f00 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
12f10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
12f20 35 31 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  517..SELECT ALL 
12f30 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  + - CAST ( NULL 
12f40 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
12f50 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
12f60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
12f70 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
12f80 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
12f90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12fa0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31 31  CT DISTINCT - 11
12fb0 20 2a 20 33 34 20 41 53 20 63 6f 6c 30 20 46 52   * 34 AS col0 FR
12fc0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
12fd0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
12fe0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor1..----..-
12ff0 33 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  374....query I r
13000 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13010 4c 4c 20 2d 20 31 20 2a 20 63 6f 6c 31 20 46 52  LL - 1 * col1 FR
13020 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
13030 31 30 0d 0a 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a  10..-13..-26....
13040 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13050 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13060 20 31 37 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c   17 * col1 * col
13070 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
13080 2d 0d 0a 31 33 37 36 38 33 0d 0a 33 35 30 38 38  -..137683..35088
13090 0d 0a 35 37 37 31 35 0d 0a 0d 0a 6f 6e 6c 79 69  ..57715....onlyi
130a0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
130b0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
130c0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
130d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
130e0 20 6c 61 62 65 6c 2d 35 32 31 0d 0a 53 45 4c 45   label-521..SELE
130f0 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 44 49  CT ALL + col1 DI
13100 56 20 35 39 20 2b 20 74 61 62 31 2e 63 6f 6c 30  V 59 + tab1.col0
13110 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
13120 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73  ..3..64..80....s
13130 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
13140 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
13150 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13160 62 65 6c 2d 35 32 31 0d 0a 53 45 4c 45 43 54 20  bel-521..SELECT 
13170 41 4c 4c 20 2b 20 63 6f 6c 31 20 2f 20 35 39 20  ALL + col1 / 59 
13180 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  + tab1.col0 FROM
13190 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a   tab1..----..3..
131a0 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20  64..80....query 
131b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
131c0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
131d0 32 20 2a 20 2b 20 31 20 2b 20 63 6f 6c 32 20 41  2 * + 1 + col2 A
131e0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
131f0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65  ..----..0....que
13200 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13210 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
13220 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
13230 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  r0.col0 AS col2 
13240 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
13250 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d 0a 36  0..----..4096..6
13260 34 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20  400..9....query 
13270 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13280 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b  T ALL - + col1 +
13290 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30   + col2 * + cor0
132a0 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20  .col2 + col0 AS 
132b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
132c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 33 0d  or0..----..2893.
132d0 0a 33 33 30 33 0d 0a 39 32 38 33 0d 0a 0d 0a 71  .3303..9283....q
132e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
132f0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
13300 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  or0.col0 * + col
13310 30 20 2b 20 2d 20 35 20 2a 20 63 6f 6c 32 20 46  0 + - 5 * col2 F
13320 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
13330 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 35 39 35  ..----..-86..595
13340 34 0d 0a 36 30 35 31 0d 0a 0d 0a 6f 6e 6c 79 69  4..6051....onlyi
13350 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
13360 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
13370 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
13380 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
13390 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
133a0 62 65 6c 2d 35 32 36 0d 0a 53 45 4c 45 43 54 20  bel-526..SELECT 
133b0 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 43  ALL - col0 * + C
133c0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
133d0 4e 45 44 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f  NED ) + col2 FRO
133e0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
133f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
13400 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
13410 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
13420 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
13430 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13440 32 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  26..SELECT ALL -
13450 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 20 28   col0 * + CAST (
13460 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
13470 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74   ) + col2 FROM t
13480 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
13490 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
134a0 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ULL....onlyif my
134b0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
134c0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
134d0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
134e0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
134f0 65 6c 2d 35 32 37 0d 0a 53 45 4c 45 43 54 20 41  el-527..SELECT A
13500 4c 4c 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30  LL col2 - - col0
13510 20 44 49 56 20 2d 20 39 33 20 46 52 4f 4d 20 74   DIV - 93 FROM t
13520 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
13530 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a 0d  -..54..57..96...
13540 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
13550 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
13560 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13570 6c 61 62 65 6c 2d 35 32 37 0d 0a 53 45 4c 45 43  label-527..SELEC
13580 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 2d 20 63  T ALL col2 - - c
13590 6f 6c 30 20 2f 20 2d 20 39 33 20 46 52 4f 4d 20  ol0 / - 93 FROM 
135a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
135b0 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36 0d 0a  --..54..57..96..
135c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
135d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
135e0 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 37 36 20  col1 * - ( - 76 
135f0 29 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  ) FROM tab1 cor0
13600 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 36 0d 0a 2d  ..----..-1976..-
13610 37 36 30 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75 65  760..-988....que
13620 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13630 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c  LECT ALL + + col
13640 32 20 2b 20 2d 20 36 32 20 2a 20 35 36 20 46 52  2 + - 62 * 56 FR
13650 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
13660 0a 2d 2d 2d 2d 0d 0a 2d 33 34 33 34 0d 0a 2d 33  .----..-3434..-3
13670 34 34 35 0d 0a 2d 33 34 34 36 0d 0a 0d 0a 71 75  445..-3446....qu
13680 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13690 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
136a0 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2d 20 63 6f   col2 * + ( - co
136b0 6c 32 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d  l2 + col2 ) FROM
136c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
136d0 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ---..0....query 
136e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
136f0 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  T - - cor0.col1 
13700 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f  * ( - col2 ) FRO
13710 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
13720 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34 36 32 0d  -..-2838..-7462.
13730 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-97....skipif p
13740 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
13750 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
13760 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
13770 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
13780 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13790 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
137a0 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c  ol0 * - col1 col
137b0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
137c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d  or0..----..1040.
137d0 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72  .640..78....quer
137e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
137f0 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT - - cor0.col
13800 32 20 2b 20 2d 20 35 31 20 46 52 4f 4d 20 74 61  2 + - 51 FROM ta
13810 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
13820 0d 0a 33 0d 0a 34 35 0d 0a 36 0d 0a 0d 0a 71 75  ..3..45..6....qu
13830 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13840 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
13850 6f 6c 31 20 2b 20 33 30 20 2a 20 2d 20 63 6f 6c  ol1 + 30 * - col
13860 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
13870 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 34  or0..----..-1594
13880 0d 0a 2d 31 37 30 30 0d 0a 2d 32 38 36 37 0d 0a  ..-1700..-2867..
13890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
138a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
138b0 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 28 20  CT + - col2 * ( 
138c0 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  + col0 ) AS col1
138d0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
138e0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36  .----..-162..-36
138f0 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65  48..-7680....que
13900 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
13910 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 28 20  LECT - col0 * ( 
13920 28 20 2b 20 63 6f 6c 32 20 29 20 29 20 46 52 4f  ( + col2 ) ) FRO
13930 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
13940 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38  ----..-35..-7298
13950 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  ..-792....query 
13960 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13970 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2d  T ALL + col0 * -
13980 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2b 20 2b   col2 + col0 + +
13990 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
139a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 38 32  cor0..----..-682
139b0 0d 0a 2d 37 31 31 38 0d 0a 39 37 0d 0a 0d 0a 71  ..-7118..97....q
139c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
139d0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 28  SELECT ALL + + (
139e0 20 2d 20 39 38 20 29 20 41 53 20 63 6f 6c 31 20   - 98 ) AS col1 
139f0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13a00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a 2d 39  0..----..-98..-9
13a10 38 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20  8..-98....query 
13a20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13a30 54 20 2b 20 28 20 2d 20 36 32 20 29 20 2b 20 63  T + ( - 62 ) + c
13a40 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
13a50 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13a60 2d 2d 2d 0d 0a 2d 35 35 0d 0a 31 36 0d 0a 31 37  ---..-55..16..17
13a70 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13a80 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 38  ort..SELECT - 28
13a90 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f   + + col0 * - co
13aa0 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  r0.col1 AS col1 
13ab0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13ac0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 39 32 0d 0a  0..----..-2092..
13ad0 2d 33 34 32 33 0d 0a 2d 38 31 32 37 0d 0a 0d 0a  -3423..-8127....
13ae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13af0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13b00 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 2b 20   + ( col1 ) * + 
13b10 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
13b20 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35  ----..2064..3395
13b30 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20  ..8099....query 
13b40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13b50 54 20 2b 20 28 20 28 20 63 6f 6c 30 20 29 20 29  T + ( ( col0 ) )
13b60 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
13b70 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
13b80 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71  ..7..78..79....q
13b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13ba0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
13bb0 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ol0 + col2 * - c
13bc0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
13bd0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
13be0 2d 2d 2d 0d 0a 2d 31 36 35 0d 0a 2d 33 37 31 32  ---..-165..-3712
13bf0 0d 0a 2d 37 37 36 30 0d 0a 0d 0a 6f 6e 6c 79 69  ..-7760....onlyi
13c00 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
13c10 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
13c20 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
13c30 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
13c40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
13c50 62 65 6c 2d 35 34 34 0d 0a 53 45 4c 45 43 54 20  bel-544..SELECT 
13c60 41 4c 4c 20 2d 20 2d 20 43 41 53 54 28 20 2b 20  ALL - - CAST( + 
13c70 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44 20 29  col2 AS SIGNED )
13c80 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   * col0 AS col0 
13c90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13ca0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
13cb0 38 0d 0a 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  8..792....skipif
13cc0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
13cd0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
13ce0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
13cf0 34 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  44..SELECT ALL -
13d00 20 2d 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32   - CAST ( + col2
13d10 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
13d20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
13d30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
13d40 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a  ----..35..7298..
13d50 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  792....query I r
13d60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13d70 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30  LL - col0 * col0
13d80 20 2b 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30   + col1 - + col0
13d90 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f   * tab0.col1 FRO
13da0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
13db0 35 39 32 39 0d 0a 2d 32 35 35 34 0d 0a 2d 34 35  5929..-2554..-45
13dc0 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
13dd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
13de0 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 32 20 2b 20  col1 ) * col2 + 
13df0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53  col2 * - col0 AS
13e00 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
13e10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13e20 33 30 37 38 0d 0a 2d 36 34 33 32 0d 0a 31 32 34  3078..-6432..124
13e30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
13e40 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
13e50 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
13e60 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
13e70 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
13e80 2d 35 34 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -547..SELECT - -
13e90 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 2b   col2 DIV col0 +
13ea0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
13eb0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
13ec0 37 0d 0a 33 34 0d 0a 35 39 0d 0a 0d 0a 73 6b 69  7..34..59....ski
13ed0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
13ee0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
13ef0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
13f00 6c 2d 35 34 37 0d 0a 53 45 4c 45 43 54 20 2d 20  l-547..SELECT - 
13f10 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20  - col2 / col0 + 
13f20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
13f30 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  S cor0..----..17
13f40 0d 0a 33 34 0d 0a 35 39 0d 0a 0d 0a 6f 6e 6c 79  ..34..59....only
13f50 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
13f60 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
13f70 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
13f80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13f90 74 20 6c 61 62 65 6c 2d 35 34 38 0d 0a 53 45 4c  t label-548..SEL
13fa0 45 43 54 20 2d 20 2b 20 39 34 20 2b 20 2b 20 63  ECT - + 94 + + c
13fb0 6f 6c 31 20 44 49 56 20 2b 20 35 30 20 46 52 4f  ol1 DIV + 50 FRO
13fc0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
13fd0 2d 0d 0a 2d 39 33 0d 0a 2d 39 34 0d 0a 2d 39 34  -..-93..-94..-94
13fe0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
13ff0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
14000 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
14010 72 74 20 6c 61 62 65 6c 2d 35 34 38 0d 0a 53 45  rt label-548..SE
14020 4c 45 43 54 20 2d 20 2b 20 39 34 20 2b 20 2b 20  LECT - + 94 + + 
14030 63 6f 6c 31 20 2f 20 2b 20 35 30 20 46 52 4f 4d  col1 / + 50 FROM
14040 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
14050 0d 0a 2d 39 33 0d 0a 2d 39 34 0d 0a 2d 39 34 0d  ..-93..-94..-94.
14060 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14070 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
14080 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b   + col1 * col0 +
14090 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
140a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
140b0 2d 2d 2d 2d 0d 0a 32 30 38 38 0d 0a 33 34 33 30  ----..2088..3430
140c0 0d 0a 38 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20  ..8188....query 
140d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
140e0 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T - col0 + col2 
140f0 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  * cor0.col1 AS c
14100 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol1 FROM tab0 co
14110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 34 0d 0a  r0..----..2814..
14120 36 32 0d 0a 37 33 37 33 0d 0a 0d 0a 6f 6e 6c 79  62..7373....only
14130 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
14140 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
14150 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
14160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14170 74 20 6c 61 62 65 6c 2d 35 35 31 0d 0a 53 45 4c  t label-551..SEL
14180 45 43 54 20 63 6f 6c 31 20 2d 20 2b 20 35 38 20  ECT col1 - + 58 
14190 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  DIV col1 FROM ta
141a0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  b0..----..86..91
141b0 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..97....skipif m
141c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
141d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
141e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 31  owsort label-551
141f0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d 20  ..SELECT col1 - 
14200 2b 20 35 38 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  + 58 / col1 FROM
14210 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d   tab0..----..86.
14220 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .91..97....query
14230 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14240 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28 20  CT DISTINCT - ( 
14250 2b 20 63 6f 6c 30 20 29 20 2a 20 2b 20 33 20 46  + col0 ) * + 3 F
14260 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
14270 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 33  ..----..-21..-23
14280 34 0d 0a 2d 32 33 37 0d 0a 0d 0a 6f 6e 6c 79 69  4..-237....onlyi
14290 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
142a0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
142b0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
142c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
142d0 20 6c 61 62 65 6c 2d 35 35 33 0d 0a 53 45 4c 45   label-553..SELE
142e0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 32  CT DISTINCT - 72
142f0 20 44 49 56 20 2b 20 63 6f 6c 31 20 2d 20 2b 20   DIV + col1 - + 
14300 28 20 28 20 2b 20 63 6f 6c 32 20 29 20 29 20 63  ( ( + col2 ) ) c
14310 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
14320 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
14330 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 73 6b 69  .-33..-82....ski
14340 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
14350 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
14360 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
14370 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
14380 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
14390 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
143a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
143b0 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 33 0d 0a  sort label-553..
143c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
143d0 2d 20 37 32 20 2f 20 2b 20 63 6f 6c 31 20 2d 20  - 72 / + col1 - 
143e0 2b 20 28 20 28 20 2b 20 63 6f 6c 32 20 29 20 29  + ( ( + col2 ) )
143f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
14400 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
14410 31 0d 0a 2d 33 33 0d 0a 2d 38 32 0d 0a 0d 0a 71  1..-33..-82....q
14420 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14430 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
14440 32 20 2a 20 63 6f 6c 32 20 2d 20 2b 20 28 20 63  2 * col2 - + ( c
14450 6f 6c 31 20 2a 20 63 6f 6c 32 20 29 20 41 53 20  ol1 * col2 ) AS 
14460 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
14470 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
14480 35 36 36 0d 0a 2d 32 30 39 30 0d 0a 2d 32 32 31  566..-2090..-221
14490 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
144a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
144b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
144c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
144d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
144e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
144f0 45 4c 45 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c  ELECT + tab2.col
14500 32 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20  2 * + tab2.col2 
14510 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  + + col2 col1 FR
14520 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
14530 34 38 32 0d 0a 37 30 32 0d 0a 37 35 36 0d 0a 0d  482..702..756...
14540 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
14550 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
14560 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
14570 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
14580 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 36  owsort label-556
14590 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 44 49  ..SELECT col0 DI
145a0 56 20 2d 20 28 20 2b 20 35 38 20 29 20 63 6f 6c  V - ( + 58 ) col
145b0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
145c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30  or0..----..-1..0
145d0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
145e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
145f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
14600 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
14610 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
14620 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
14630 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
14640 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14650 61 62 65 6c 2d 35 35 36 0d 0a 53 45 4c 45 43 54  abel-556..SELECT
14660 20 63 6f 6c 30 20 2f 20 2d 20 28 20 2b 20 35 38   col0 / - ( + 58
14670 20 29 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   ) col0 FROM tab
14680 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
14690 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c  .-1..0..0....onl
146a0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
146b0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
146c0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
146d0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
146e0 72 74 20 6c 61 62 65 6c 2d 35 35 37 0d 0a 53 45  rt label-557..SE
146f0 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 44 49  LECT + + col2 DI
14700 56 20 2d 20 36 33 20 41 53 20 63 6f 6c 32 20 46  V - 63 AS col2 F
14710 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14720 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30  ..----..-1..0..0
14730 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
14740 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
14750 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
14760 72 74 20 6c 61 62 65 6c 2d 35 35 37 0d 0a 53 45  rt label-557..SE
14770 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2f 20  LECT + + col2 / 
14780 2d 20 36 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 63 AS col2 FRO
14790 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
147a0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a  ----..-1..0..0..
147b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
147c0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
147d0 2d 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c  - col2 ) * - col
147e0 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
147f0 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32  -..35..7298..792
14800 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
14810 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
14820 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
14830 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
14840 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
14850 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14860 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 39  LECT DISTINCT 89
14870 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
14880 0a 2d 2d 2d 2d 0d 0a 38 39 0d 0a 0d 0a 71 75 65  .----..89....que
14890 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
148a0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20  LECT + - col1 + 
148b0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
148c0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
148d0 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 37 33 0d  ---..-119..-173.
148e0 0a 2d 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-98....onlyif m
148f0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
14900 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
14910 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
14920 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
14930 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
14940 2d 35 36 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  -561..SELECT DIS
14950 54 49 4e 43 54 20 2b 20 43 41 53 54 28 20 4e 55  TINCT + CAST( NU
14960 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 63  LL AS SIGNED ) c
14970 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
14980 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
14990 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  L....skipif post
149a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
149b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
149c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
149d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
149e0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
149f0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
14a00 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
14a10 65 6c 2d 35 36 31 0d 0a 53 45 4c 45 43 54 20 44  el-561..SELECT D
14a20 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28  ISTINCT + CAST (
14a30 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
14a40 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
14a50 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
14a60 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
14a70 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14a80 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b 20 2b 20   ALL - col0 + + 
14a90 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS 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 30 0d 0a   cor0..----..0..
14ac0 37 32 30 39 0d 0a 37 36 38 0d 0a 0d 0a 71 75 65  7209..768....que
14ad0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14ae0 4c 45 43 54 20 2b 20 2b 20 28 20 32 30 20 29 20  LECT + + ( 20 ) 
14af0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
14b00 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14b10 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 30 0d 0a 32 30  ..----..1640..20
14b20 0d 0a 36 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..660....query I
14b30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14b40 20 41 4c 4c 20 2b 20 34 36 20 41 53 20 63 6f 6c   ALL + 46 AS col
14b50 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
14b60 2d 0d 0a 34 36 0d 0a 34 36 0d 0a 34 36 0d 0a 0d  -..46..46..46...
14b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14b80 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14b90 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20  T col2 + - col0 
14ba0 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  * col1 FROM tab1
14bb0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14bc0 2d 32 34 0d 0a 2d 35 38 33 0d 0a 2d 39 34 34 0d  -24..-583..-944.
14bd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14be0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 32 30 20  rt..SELECT + 20 
14bf0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
14c00 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  1 cor0..----..20
14c10 0d 0a 32 30 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72  ..20..20....quer
14c20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14c30 45 43 54 20 2b 20 28 20 34 30 20 29 20 2a 20 2b  ECT + ( 40 ) * +
14c40 20 63 6f 6c 30 20 2b 20 37 36 20 2a 20 63 6f 6c   col0 + 76 * col
14c50 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
14c60 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
14c70 2d 0d 0a 32 36 33 36 0d 0a 34 34 35 32 0d 0a 37  -..2636..4452..7
14c80 36 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  604....query I r
14c90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
14ca0 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol0 * col1 + + c
14cb0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
14cc0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
14cd0 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a  ---..1422..224..
14ce0 34 36 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4680....onlyif m
14cf0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
14d00 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
14d10 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
14d20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
14d30 62 65 6c 2d 35 36 39 0d 0a 53 45 4c 45 43 54 20  bel-569..SELECT 
14d40 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20  + col1 DIV col1 
14d50 2b 20 28 20 39 34 20 2b 20 2d 20 63 6f 6c 31 20  + ( 94 + - col1 
14d60 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
14d70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 36  or0..----..36..6
14d80 34 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..78....skipif 
14d90 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
14da0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
14db0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36  rowsort label-56
14dc0 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  9..SELECT + col1
14dd0 20 2f 20 63 6f 6c 31 20 2b 20 28 20 39 34 20 2b   / col1 + ( 94 +
14de0 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   - col1 ) FROM t
14df0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
14e00 2d 0d 0a 33 36 0d 0a 36 34 0d 0a 37 38 0d 0a 0d  -..36..64..78...
14e10 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
14e20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
14e30 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
14e40 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
14e50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37 30  owsort label-570
14e60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14e70 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c  T + col0 DIV col
14e80 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
14e90 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  ab0..----..0....
14ea0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
14eb0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
14ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
14ed0 61 62 65 6c 2d 35 37 30 0d 0a 53 45 4c 45 43 54  abel-570..SELECT
14ee0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
14ef0 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   / col1 AS col1 
14f00 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
14f10 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
14f20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
14f30 63 6f 6c 30 20 29 20 2a 20 2b 20 74 61 62 32 2e  col0 ) * + tab2.
14f40 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
14f50 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
14f60 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d  43..217..4602...
14f70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14f80 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72  ..SELECT + - cor
14f90 30 2e 63 6f 6c 30 20 2b 20 38 38 20 41 53 20 63  0.col0 + 88 AS c
14fa0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
14fb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 38 31  r0..----..10..81
14fc0 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..9....query I r
14fd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
14fe0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 35 31 20 2b   + col1 * - 51 +
14ff0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30   + col2 * - col0
15000 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
15010 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
15020 0d 0a 2d 31 31 39 33 39 0d 0a 2d 34 39 38 32 0d  ..-11939..-4982.
15030 0a 2d 35 31 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5178....onlyif
15040 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
15050 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
15060 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
15070 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
15080 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
15090 65 6c 2d 35 37 34 0d 0a 53 45 4c 45 43 54 20 41  el-574..SELECT A
150a0 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 43 41  LL - col1 * - CA
150b0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
150c0 45 44 20 29 20 2b 20 2b 20 38 35 20 46 52 4f 4d  ED ) + + 85 FROM
150d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
150e0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
150f0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
15100 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
15110 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
15120 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
15130 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  4..SELECT ALL - 
15140 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28 20  col1 * - CAST ( 
15150 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
15160 29 20 2b 20 2b 20 38 35 20 46 52 4f 4d 20 74 61  ) + + 85 FROM ta
15170 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
15180 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
15190 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
151a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
151b0 6c 32 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 - col1 AS col
151c0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
151d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a  or0..----..-33..
151e0 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20  -4..21....query 
151f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15200 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  T + col2 * + col
15210 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 36 31 20  0 + col0 * - 61 
15220 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
15230 0a 2d 31 38 31 37 0d 0a 2d 32 33 38 0d 0a 2d 32  .-1817..-238..-2
15240 37 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  730....query I r
15250 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
15260 4c 4c 20 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  LL 1 AS col1 FRO
15270 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab1..----..1.
15280 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .1..1....query I
15290 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
152a0 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
152b0 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 + col0 AS col
152c0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
152d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
152e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
152f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
15300 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  col0 * col2 + - 
15310 36 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f  62 * - col1 + co
15320 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
15330 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
15340 2d 2d 0d 0a 2d 33 30 31 38 0d 0a 2d 36 38 36 31  --..-3018..-6861
15350 0d 0a 31 34 37 36 0d 0a 0d 0a 71 75 65 72 79 20  ..1476....query 
15360 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
15370 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
15380 32 20 2a 20 63 6f 6c 31 20 2d 20 2b 20 28 20 2b  2 * col1 - + ( +
15390 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
153a0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
153b0 33 34 34 0d 0a 2d 31 34 35 38 0d 0a 2d 36 32 37  344..-1458..-627
153c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
153d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
153e0 72 30 2e 63 6f 6c 32 20 2b 20 28 20 2d 20 31 34  r0.col2 + ( - 14
153f0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72   ) FROM tab0 cor
15400 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 0d 0a 31 39  0..----..-13..19
15410 0d 0a 36 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..68....query I 
15420 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15430 2b 20 34 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  + 42 FROM tab0, 
15440 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
15450 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
15460 68 69 6e 67 20 74 6f 20 36 34 63 32 39 64 62 39  hing to 64c29db9
15470 66 31 63 64 37 65 64 34 64 64 65 62 31 37 33 35  f1cd7ed4ddeb1735
15480 65 33 65 30 64 34 34 32 0d 0a 0d 0a 71 75 65 72  e3e0d442....quer
15490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
154a0 45 43 54 20 2d 20 2d 20 28 20 28 20 2d 20 63 6f  ECT - - ( ( - co
154b0 6c 30 20 29 20 29 20 2a 20 39 20 46 52 4f 4d 20  l0 ) ) * 9 FROM 
154c0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
154d0 0a 2d 36 33 0d 0a 2d 37 30 32 0d 0a 2d 37 31 31  .-63..-702..-711
154e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
154f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
15500 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20  INCT - col2 * + 
15510 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col1 + cor0.col1
15520 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
15530 0a 2d 2d 2d 2d 0d 0a 2d 31 32 33 35 0d 0a 2d 31  .----..-1235..-1
15540 33 37 38 0d 0a 2d 35 36 30 0d 0a 0d 0a 71 75 65  378..-560....que
15550 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15560 4c 45 43 54 20 2d 20 2d 20 28 20 63 6f 6c 31 20  LECT - - ( col1 
15570 29 20 2a 20 2b 20 63 6f 6c 30 20 2d 20 28 20 63  ) * + col0 - ( c
15580 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol0 ) FROM tab1 
15590 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
155a0 37 36 0d 0a 37 35 0d 0a 39 36 30 0d 0a 0d 0a 71  76..75..960....q
155b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
155c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
155d0 2d 20 38 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  - 8 * - col2 FRO
155e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
155f0 2d 2d 2d 2d 0d 0a 32 36 34 0d 0a 36 35 36 0d 0a  ----..264..656..
15600 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
15610 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15620 54 49 4e 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c  TINCT + tab1.col
15630 30 20 2a 20 2d 20 39 38 20 41 53 20 63 6f 6c 31  0 * - 98 AS col1
15640 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
15650 0d 0a 2d 32 39 34 0d 0a 2d 36 32 37 32 0d 0a 2d  ..-294..-6272..-
15660 37 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7840....query I 
15670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15680 63 6f 6c 31 20 2a 20 2b 20 31 38 20 46 52 4f 4d  col1 * + 18 FROM
15690 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34   tab0..----..154
156a0 38 0d 0a 31 36 33 38 0d 0a 31 37 34 36 0d 0a 0d  8..1638..1746...
156b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
156c0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
156d0 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  ab1.col0 AS col2
156e0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
156f0 20 63 6f 72 30 2c 20 74 61 62 30 20 63 6f 72 31   cor0, tab0 cor1
15700 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
15710 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 32 39  s hashing to 729
15720 63 31 65 64 64 61 39 33 33 32 33 39 38 32 39 39  c1edda9332398299
15730 66 33 39 63 64 31 37 34 65 64 38 34 30 0d 0a 0d  f39cd174ed840...
15740 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15750 0d 0a 53 45 4c 45 43 54 20 39 39 20 2b 20 2d 20  ..SELECT 99 + - 
15760 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
15770 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab0..----..17
15780 0d 0a 36 36 0d 0a 39 38 0d 0a 0d 0a 6f 6e 6c 79  ..66..98....only
15790 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
157a0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
157b0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
157c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
157d0 74 20 6c 61 62 65 6c 2d 35 39 31 0d 0a 53 45 4c  t label-591..SEL
157e0 45 43 54 20 2b 20 43 41 53 54 28 20 31 33 20 41  ECT + CAST( 13 A
157f0 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b 20 63  S SIGNED ) + + c
15800 6f 6c 31 20 2a 20 63 6f 6c 31 20 44 49 56 20 2b  ol1 * col1 DIV +
15810 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
15820 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
15830 33 0d 0a 32 36 0d 0a 33 39 0d 0a 0d 0a 73 6b 69  3..26..39....ski
15840 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
15850 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
15860 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
15870 6c 2d 35 39 31 0d 0a 53 45 4c 45 43 54 20 2b 20  l-591..SELECT + 
15880 43 41 53 54 20 28 20 31 33 20 41 53 20 49 4e 54  CAST ( 13 AS INT
15890 45 47 45 52 20 29 20 2b 20 2b 20 63 6f 6c 31 20  EGER ) + + col1 
158a0 2a 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20  * col1 / + col1 
158b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
158c0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 0d 0a 32 36 0d  0..----..23..26.
158d0 0a 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .39....query I r
158e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
158f0 20 28 20 32 34 20 29 20 2a 20 63 6f 6c 30 20 46   ( 24 ) * col0 F
15900 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
15910 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 36 0d 0a 31 39  ..----..1536..19
15920 32 30 0d 0a 37 32 0d 0a 0d 0a 71 75 65 72 79 20  20..72....query 
15930 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20  IIIIIIIIIIIIIII 
15940 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15950 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c  ALL * FROM tab2,
15960 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
15970 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74  OSS JOIN tab1, t
15980 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab2 AS cor1, tab
15990 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  1 AS cor2..----.
159a0 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61 73  .3645 values has
159b0 68 69 6e 67 20 74 6f 20 64 35 37 36 31 62 61 34  hing to d5761ba4
159c0 65 34 30 66 30 63 36 35 35 33 36 64 31 64 33 63  e40f0c65536d1d3c
159d0 39 64 65 34 65 35 36 36 0d 0a 0d 0a 71 75 65 72  9de4e566....quer
159e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
159f0 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT + cor0.col1 
15a00 2b 20 2d 20 31 39 20 2a 20 63 6f 6c 31 20 2d 20  + - 19 * col1 - 
15a10 38 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  8 * - col1 AS co
15a20 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
15a30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 30  cor0..----..-860
15a40 0d 0a 2d 39 31 30 0d 0a 2d 39 37 30 0d 0a 0d 0a  ..-910..-970....
15a50 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
15a60 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
15a70 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
15a80 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
15a90 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
15aa0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15ab0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 63   - col0 + col2 c
15ac0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
15ad0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
15ae0 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79  .16..51....query
15af0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15b00 43 54 20 2d 20 28 20 2d 20 36 31 20 29 20 2b 20  CT - ( - 61 ) + 
15b10 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
15b20 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
15b30 2d 2d 2d 2d 0d 0a 31 35 30 0d 0a 38 35 0d 0a 39  ----..150..85..9
15b40 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
15b50 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
15b60 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
15b70 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
15b80 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
15b90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
15ba0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
15bb0 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol1 * - col0 col
15bc0 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
15bd0 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a  -..-1040..-640..
15be0 2d 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -78....query I r
15bf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
15c00 20 37 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53   73 FROM tab0 AS
15c10 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
15c20 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
15c30 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
15c40 73 68 69 6e 67 20 74 6f 20 38 34 61 62 39 64 62  shing to 84ab9db
15c50 35 34 36 38 62 34 61 31 37 38 31 62 64 38 64 35  5468b4a1781bd8d5
15c60 63 38 65 30 65 37 37 66 63 0d 0a 0d 0a 71 75 65  c8e0e77fc....que
15c70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15c80 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LECT + col1 * + 
15c90 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col2 * - col2 FR
15ca0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
15cb0 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d 0a 2d  .----..-22599..-
15cc0 32 34 35 34 38 0d 0a 2d 33 39 38 38 34 0d 0a 0d  24548..-39884...
15cd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
15ce0 0d 0a 53 45 4c 45 43 54 20 2b 20 39 30 20 2a 20  ..SELECT + 90 * 
15cf0 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
15d00 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
15d10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 35   cor0..----..145
15d20 38 30 0d 0a 33 32 38 33 32 30 0d 0a 36 39 31 32  80..328320..6912
15d30 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
15d40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
15d50 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  ( + cor0.col1 ) 
15d60 2a 20 2d 20 31 20 46 52 4f 4d 20 74 61 62 30 20  * - 1 FROM tab0 
15d70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
15d80 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a  86..-91..-97....
15d90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15da0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
15db0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63   col1 * + cor0.c
15dc0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
15dd0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
15de0 2d 2d 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 31 30  ---..119652..510
15df0 33 34 0d 0a 35 38 35 39 0d 0a 0d 0a 71 75 65 72  34..5859....quer
15e00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15e10 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 28 20 37  ECT + col2 * ( 7
15e20 32 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  2 ) * col0 AS co
15e30 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
15e40 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 32 30 0d 0a 35  0..----..2520..5
15e50 32 35 34 35 36 0d 0a 35 37 30 32 34 0d 0a 0d 0a  25456..57024....
15e60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
15e70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
15e80 20 63 6f 6c 31 20 2a 20 2b 20 33 36 20 46 52 4f   col1 * + 36 FRO
15e90 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30  M tab0..----..30
15ea0 39 36 0d 0a 33 32 37 36 0d 0a 33 34 39 32 0d 0a  96..3276..3492..
15eb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15ec0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
15ed0 72 30 2e 63 6f 6c 30 20 2b 20 31 30 20 41 53 20  r0.col0 + 10 AS 
15ee0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
15ef0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
15f00 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
15f10 67 20 74 6f 20 61 37 66 39 38 35 38 64 37 61 64  g to a7f9858d7ad
15f20 63 64 32 36 63 39 66 39 38 64 36 38 33 30 31 66  cd26c9f98d68301f
15f30 37 66 66 38 36 0d 0a 0d 0a 71 75 65 72 79 20 49  7ff86....query I
15f40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15f50 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 33 31 20 2a   ALL col0 + 31 *
15f60 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
15f70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
15f80 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d  0..----..-210..-
15f90 32 33 34 30 0d 0a 2d 32 33 37 30 0d 0a 0d 0a 71  2340..-2370....q
15fa0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
15fb0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20  SELECT + col2 * 
15fc0 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  - col2 * - col0 
15fd0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
15fe0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 33 36 0d  0..----..207936.
15ff0 0a 37 33 37 32 38 30 0d 0a 38 37 34 38 0d 0a 0d  .737280..8748...
16000 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16010 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
16020 20 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 31 39   1 * - col1 + 19
16030 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
16040 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 31 30 0d  .----..105..110.
16050 0a 31 31 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .116....skipif p
16060 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
16070 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
16080 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
16090 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
160a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
160b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
160c0 31 20 2a 20 63 6f 6c 30 20 2b 20 38 20 2b 20 2d  1 * col0 + 8 + -
160d0 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
160e0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
160f0 2d 2d 0d 0a 32 30 34 38 0d 0a 33 33 36 38 0d 0a  --..2048..3368..
16100 38 30 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8018....query I 
16110 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16120 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f 6c  DISTINCT - - col
16130 30 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  0 - col2 AS col0
16140 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
16150 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 34  r0..----..-20..4
16160 31 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49  1..52....query I
16170 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16180 20 2d 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f   - - ( - cor0.co
16190 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63  l0 ) FROM tab2 c
161a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  or0..----..-7..-
161b0 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69  78..-79....onlyi
161c0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
161d0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
161e0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
161f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16200 20 6c 61 62 65 6c 2d 36 31 32 0d 0a 53 45 4c 45   label-612..SELE
16210 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
16220 6c 30 20 44 49 56 20 2d 20 63 6f 6c 31 20 2b 20  l0 DIV - col1 + 
16230 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  - ( - cor0.col2 
16240 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  ) FROM tab0 cor0
16250 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38  ..----..1..33..8
16260 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  2....skipif mysq
16270 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
16280 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
16290 6f 72 74 20 6c 61 62 65 6c 2d 36 31 32 0d 0a 53  ort label-612..S
162a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
162b0 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 31 20 2b   col0 / - col1 +
162c0 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32   - ( - cor0.col2
162d0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72   ) FROM tab0 cor
162e0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a  0..----..1..33..
162f0 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
16300 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
16310 53 54 49 4e 43 54 20 2d 20 2b 20 37 34 20 41 53  STINCT - + 74 AS
16320 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
16330 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
16340 49 4e 20 74 61 62 31 20 63 6f 72 31 0d 0a 2d 2d  IN tab1 cor1..--
16350 2d 2d 0d 0a 2d 37 34 0d 0a 0d 0a 71 75 65 72 79  --..-74....query
16360 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16370 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  CT + - col1 * co
16380 6c 31 20 2a 20 2d 20 31 36 20 2b 20 63 6f 6c 32  l1 * - 16 + col2
16390 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
163a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 34 30 33 0d  r0..----..15403.
163b0 0a 34 36 36 32 0d 0a 35 35 37 32 32 0d 0a 0d 0a  .4662..55722....
163c0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
163d0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
163e0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
163f0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
16400 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 35 0d  wsort label-615.
16410 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
16420 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 31   DIV - cor0.col1
16430 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20   + - ( + col0 ) 
16440 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
16450 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
16460 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a  .-24..-35..-89..
16470 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
16480 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
16490 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
164a0 20 6c 61 62 65 6c 2d 36 31 35 0d 0a 53 45 4c 45   label-615..SELE
164b0 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d 20  CT + + col2 / - 
164c0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 28 20  cor0.col1 + - ( 
164d0 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  + col0 ) AS col1
164e0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
164f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
16500 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79  35..-89....query
16510 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
16520 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20  CT ALL + - col2 
16530 2b 20 63 6f 6c 30 20 2a 20 2b 20 35 37 20 46 52  + col0 * + 57 FR
16540 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
16550 0a 2d 2d 2d 2d 0d 0a 33 37 32 0d 0a 34 34 32 30  .----..372..4420
16560 0d 0a 34 34 36 35 0d 0a 0d 0a 71 75 65 72 79 20  ..4465....query 
16570 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16580 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
16590 30 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 + - col1 AS co
165a0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
165b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d  0..----..-110..-
165c0 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 6f 6e 6c  132..-180....onl
165d0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
165e0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
165f0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
16600 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
16610 72 74 20 6c 61 62 65 6c 2d 36 31 38 0d 0a 53 45  rt label-618..SE
16620 4c 45 43 54 20 41 4c 4c 20 38 33 20 44 49 56 20  LECT ALL 83 DIV 
16630 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
16640 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
16650 2d 2d 2d 2d 0d 0a 33 0d 0a 36 0d 0a 38 0d 0a 0d  ----..3..6..8...
16660 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
16670 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
16680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
16690 6c 61 62 65 6c 2d 36 31 38 0d 0a 53 45 4c 45 43  label-618..SELEC
166a0 54 20 41 4c 4c 20 38 33 20 2f 20 63 6f 6c 31 20  T ALL 83 / col1 
166b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
166c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
166d0 0a 33 0d 0a 36 0d 0a 38 0d 0a 0d 0a 71 75 65 72  .3..6..8....quer
166e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
166f0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
16700 6f 6c 30 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 31  ol0 + + ( + col1
16710 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c   ) * col0 AS col
16720 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
16730 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 32 0d  or0..----..1422.
16740 0a 32 32 34 0d 0a 34 36 38 30 0d 0a 0d 0a 71 75  .224..4680....qu
16750 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16760 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63 6f 6c  ELECT - cor1.col
16770 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
16780 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
16790 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d  0, tab0 AS cor1.
167a0 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
167b0 20 68 61 73 68 69 6e 67 20 74 6f 20 64 34 63 36   hashing to d4c6
167c0 37 33 62 37 34 34 34 65 62 39 39 32 37 65 63 36  73b7444eb9927ec6
167d0 33 31 37 35 62 34 33 63 36 62 38 34 0d 0a 0d 0a  3175b43c6b84....
167e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
167f0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
16800 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 41 53   - ( + col1 ) AS
16810 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
16820 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
16830 35 35 0d 0a 2d 35 38 0d 0a 2d 38 35 0d 0a 0d 0a  55..-58..-85....
16840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
16850 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
16860 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l2 + - col0 * + 
16870 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col2 * col2 FROM
16880 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
16890 2d 2d 2d 0d 0a 2d 31 31 34 30 33 38 0d 0a 2d 35  ---..-114038..-5
168a0 30 37 36 0d 0a 2d 35 32 37 30 32 0d 0a 0d 0a 71  076..-52702....q
168b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
168c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
168d0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col0 * + col2 + 
168e0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
168f0 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37 30 35 0d  ----..216..3705.
16900 0a 37 37 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  .7776....skipif 
16910 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
16920 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
16930 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
16940 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
16950 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16960 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
16970 72 31 2e 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f  r1.col0 col0 FRO
16980 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  M tab0 AS cor0 C
16990 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41  ROSS JOIN tab2 A
169a0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
169b0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
169c0 6f 20 39 35 62 39 36 63 61 31 64 62 65 32 65 33  o 95b96ca1dbe2e3
169d0 39 61 30 66 61 37 38 66 35 30 64 33 37 34 66 35  9a0fa78f50d374f5
169e0 31 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  1a....query I ro
169f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
16a00 2b 20 35 36 20 2a 20 2d 20 63 6f 6c 31 20 46 52  + 56 * - col1 FR
16a10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
16a20 0a 2d 2d 2d 2d 0d 0a 2d 34 38 31 36 0d 0a 2d 35  .----..-4816..-5
16a30 30 39 36 0d 0a 2d 35 34 33 32 0d 0a 0d 0a 71 75  096..-5432....qu
16a40 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16a50 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
16a60 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
16a70 6f 6c 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 * col0 AS co
16a80 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
16a90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d  0..----..-576..-
16aa0 37 35 0d 0a 2d 39 36 30 0d 0a 0d 0a 71 75 65 72  75..-960....quer
16ab0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16ac0 45 43 54 20 2b 20 2b 20 36 32 20 2a 20 2b 20 31  ECT + + 62 * + 1
16ad0 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
16ae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 38 0d 0a  or0..----..868..
16af0 38 36 38 0d 0a 38 36 38 0d 0a 0d 0a 71 75 65 72  868..868....quer
16b00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16b10 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 34 34 20  ECT + col0 * 44 
16b20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16b30 30 0d 0a 2d 2d 2d 2d 0d 0a 33 30 38 0d 0a 33 34  0..----..308..34
16b40 33 32 0d 0a 33 34 37 36 0d 0a 0d 0a 6f 6e 6c 79  32..3476....only
16b50 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
16b60 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
16b70 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
16b80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
16b90 74 20 6c 61 62 65 6c 2d 36 32 39 0d 0a 53 45 4c  t label-629..SEL
16ba0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 31  ECT DISTINCT - 1
16bb0 31 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c  1 DIV + cor0.col
16bc0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
16bd0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
16be0 2d 0d 0a 2d 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  -..-1..0....skip
16bf0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
16c00 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16c10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16c20 2d 36 32 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  -629..SELECT DIS
16c30 54 49 4e 43 54 20 2d 20 31 31 20 2f 20 2b 20 63  TINCT - 11 / + c
16c40 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
16c50 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
16c60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d  r0..----..-1..0.
16c70 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
16c80 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
16c90 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
16ca0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
16cb0 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
16cc0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 30 0d  wsort label-630.
16cd0 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20  .SELECT - CAST( 
16ce0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
16cf0 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
16d00 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  1..----..NULL..N
16d10 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
16d20 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
16d30 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
16d40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
16d50 6c 2d 36 33 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-630..SELECT - 
16d60 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
16d70 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 31 20  NTEGER ) + col1 
16d80 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
16d90 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
16da0 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
16db0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
16dc0 32 20 2a 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  2 * col2 - col1 
16dd0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
16de0 0a 2d 39 36 0d 0a 31 30 30 33 0d 0a 36 36 33 33  .-96..1003..6633
16df0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
16e00 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
16e10 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
16e20 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
16e30 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
16e40 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33 32  owsort label-632
16e50 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28  ..SELECT - CAST(
16e60 20 2d 20 32 34 20 41 53 20 53 49 47 4e 45 44 20   - 24 AS SIGNED 
16e70 29 20 2d 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  ) - - tab2.col2 
16e80 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 46 52  * + tab2.col2 FR
16e90 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
16ea0 34 36 38 0d 0a 37 30 30 0d 0a 37 35 33 0d 0a 0d  468..700..753...
16eb0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
16ec0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
16ed0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
16ee0 6c 61 62 65 6c 2d 36 33 32 0d 0a 53 45 4c 45 43  label-632..SELEC
16ef0 54 20 2d 20 43 41 53 54 20 28 20 2d 20 32 34 20  T - CAST ( - 24 
16f00 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2d  AS INTEGER ) - -
16f10 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20 74   tab2.col2 * + t
16f20 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab2.col2 FROM ta
16f30 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 38 0d 0a  b2..----..1468..
16f40 37 30 30 0d 0a 37 35 33 0d 0a 0d 0a 71 75 65 72  700..753....quer
16f50 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16f60 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  ECT col1 + + col
16f70 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
16f80 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
16f90 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32 0d 0a  --..-1027..-52..
16fa0 2d 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -630....query I 
16fb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16fc0 2d 20 28 20 39 35 20 29 20 2b 20 63 6f 6c 30 20  - ( 95 ) + col0 
16fd0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
16fe0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16ff0 0a 2d 31 35 0d 0a 2d 33 31 0d 0a 2d 39 32 0d 0a  .-15..-31..-92..
17000 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
17010 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
17020 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
17030 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
17040 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 33  rowsort label-63
17050 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  5..SELECT ALL + 
17060 2d 20 63 6f 6c 31 20 2b 20 2b 20 28 20 63 6f 6c  - col1 + + ( col
17070 32 20 29 20 44 49 56 20 2b 20 28 20 63 6f 6c 31  2 ) DIV + ( col1
17080 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   ) FROM tab2 AS 
17090 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d  cor0..----..-15.
170a0 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69  .-31..-59....ski
170b0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
170c0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
170d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
170e0 6c 2d 36 33 35 0d 0a 53 45 4c 45 43 54 20 41 4c  l-635..SELECT AL
170f0 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28  L + - col1 + + (
17100 20 63 6f 6c 32 20 29 20 2f 20 2b 20 28 20 63 6f   col2 ) / + ( co
17110 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  l1 ) FROM tab2 A
17120 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
17130 35 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 6f  5..-31..-59....o
17140 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
17150 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
17160 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
17170 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
17180 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17190 74 20 6c 61 62 65 6c 2d 36 33 36 0d 0a 53 45 4c  t label-636..SEL
171a0 45 43 54 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  ECT CAST( NULL A
171b0 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63  S SIGNED ) * - c
171c0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 + - col0 FRO
171d0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
171e0 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
171f0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
17200 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
17210 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17220 20 6c 61 62 65 6c 2d 36 33 36 0d 0a 53 45 4c 45   label-636..SELE
17230 43 54 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41  CT CAST ( NULL A
17240 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20  S INTEGER ) * - 
17250 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52  col2 + - col0 FR
17260 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab0..----..N
17270 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
17280 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17290 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 32  rt..SELECT - ( 2
172a0 33 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  3 ) AS col2 FROM
172b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
172c0 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 32 33 0d 0a 2d  ---..-23..-23..-
172d0 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  23....query I ro
172e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
172f0 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20  L cor0.col0 + + 
17300 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
17310 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a  ab0, tab0 cor0..
17320 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
17330 61 73 68 69 6e 67 20 74 6f 20 30 61 39 62 61 37  ashing to 0a9ba7
17340 64 64 62 62 37 38 32 37 39 64 62 32 64 37 38 33  ddbb78279db2d783
17350 30 38 34 31 34 65 30 33 63 39 0d 0a 0d 0a 71 75  08414e03c9....qu
17360 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
17370 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36 30 20 2a  ELECT ALL - 60 *
17380 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f   + tab0.col0 FRO
17390 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
173a0 34 34 30 0d 0a 2d 32 31 30 30 0d 0a 2d 35 33 34  440..-2100..-534
173b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
173c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
173d0 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30   - col1 * + col0
173e0 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
173f0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32 30 0d  1..----..-13520.
17400 0a 2d 32 30 32 38 0d 0a 2d 36 34 30 30 0d 0a 0d  .-2028..-6400...
17410 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
17420 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
17430 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
17440 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
17450 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 31  owsort label-641
17460 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
17470 20 35 39 20 29 20 44 49 56 20 2b 20 63 6f 72 30   59 ) DIV + cor0
17480 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52  .col1 AS col0 FR
17490 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
174a0 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 33 0d 0a  --..-1..-1..-3..
174b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
174c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
174d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
174e0 20 6c 61 62 65 6c 2d 36 34 31 0d 0a 53 45 4c 45   label-641..SELE
174f0 43 54 20 41 4c 4c 20 2d 20 28 20 35 39 20 29 20  CT ALL - ( 59 ) 
17500 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  / + cor0.col1 AS
17510 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
17520 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
17530 2d 31 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79 20  -1..-3....query 
17540 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17550 54 20 28 20 36 36 20 29 20 2a 20 63 6f 6c 30 20  T ( 66 ) * col0 
17560 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
17570 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
17580 0a 31 35 38 34 0d 0a 32 33 31 30 0d 0a 35 38 37  .1584..2310..587
17590 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
175a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
175b0 20 28 20 63 6f 6c 32 20 29 20 2a 20 28 20 2b 20   ( col2 ) * ( + 
175c0 37 34 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  74 ) AS col1 FRO
175d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
175e0 2d 2d 2d 2d 0d 0a 32 34 34 32 0d 0a 36 30 36 38  ----..2442..6068
175f0 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..74....query I 
17600 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17610 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  ALL - col1 + - c
17620 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
17630 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
17640 32 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a  29..-74..-93....
17650 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17660 0a 53 45 4c 45 43 54 20 2d 20 33 36 20 2b 20 2d  .SELECT - 36 + -
17670 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
17680 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
17690 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 31 33 32  or0..----..-4132
176a0 0d 0a 2d 34 35 0d 0a 2d 36 34 33 36 0d 0a 0d 0a  ..-45..-6436....
176b0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
176c0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
176d0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
176e0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
176f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 36 0d  wsort label-646.
17700 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
17710 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f  cor0.col2 DIV co
17720 6c 32 20 2b 20 36 38 20 2a 20 63 6f 6c 32 20 2a  l2 + 68 * col2 *
17730 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   - col2 AS col0 
17740 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
17750 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 38 32 38 37  0..----..-198287
17760 0d 0a 2d 32 32 30 39 33 31 0d 0a 2d 36 32 36 36  ..-220931..-6266
17770 38 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  87....skipif mys
17780 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
17790 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
177a0 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 36 0d 0a  sort label-646..
177b0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
177c0 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 32 20  or0.col2 / col2 
177d0 2b 20 36 38 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  + 68 * col2 * - 
177e0 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
177f0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
17800 2d 2d 2d 2d 0d 0a 2d 31 39 38 32 38 37 0d 0a 2d  ----..-198287..-
17810 32 32 30 39 33 31 0d 0a 2d 36 32 36 36 38 37 0d  220931..-626687.
17820 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
17830 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
17840 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
17850 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
17860 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
17870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17880 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
17890 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c  ol1 * + col1 col
178a0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
178b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
178c0 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72  169..676....quer
178d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
178e0 45 43 54 20 36 31 20 2b 20 2d 20 63 6f 6c 30 20  ECT 61 + - col0 
178f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
17900 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 33  0..----..-19..-3
17910 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..58....query I 
17920 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17930 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20  DISTINCT col2 + 
17940 32 36 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  26 AS col1 FROM 
17950 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a  tab2..----..52..
17960 35 33 0d 0a 36 34 0d 0a 0d 0a 73 6b 69 70 69 66  53..64....skipif
17970 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
17980 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
17990 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
179a0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
179b0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
179c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
179d0 4e 43 54 20 39 30 20 63 6f 6c 32 20 46 52 4f 4d  NCT 90 col2 FROM
179e0 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
179f0 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
17a00 31 0d 0a 2d 2d 2d 2d 0d 0a 39 30 0d 0a 0d 0a 71  1..----..90....q
17a10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17a20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
17a30 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  - col2 + col2 * 
17a40 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  col2 + col1 FROM
17a50 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 38 38   tab1..----..288
17a60 38 0d 0a 33 32 30 32 0d 0a 39 31 33 33 0d 0a 0d  8..3202..9133...
17a70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17a80 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
17a90 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  + cor0.col1 * - 
17aa0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
17ab0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
17ac0 31 30 0d 0a 2d 33 34 30 33 0d 0a 2d 39 35 34 0d  10..-3403..-954.
17ad0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
17ae0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
17af0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
17b00 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
17b10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
17b20 35 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  53..SELECT ALL -
17b30 20 63 6f 6c 30 20 2a 20 28 20 2b 20 31 34 20 29   col0 * ( + 14 )
17b40 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
17b50 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
17b60 2d 31 31 0d 0a 2d 31 35 0d 0a 30 0d 0a 0d 0a 73  -11..-15..0....s
17b70 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
17b80 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
17b90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
17ba0 62 65 6c 2d 36 35 33 0d 0a 53 45 4c 45 43 54 20  bel-653..SELECT 
17bb0 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2b  ALL - col0 * ( +
17bc0 20 31 34 20 29 20 2f 20 63 6f 6c 32 20 46 52 4f   14 ) / col2 FRO
17bd0 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
17be0 2d 0d 0a 2d 31 31 0d 0a 2d 31 35 0d 0a 30 0d 0a  -..-11..-15..0..
17bf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
17c00 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
17c10 43 54 20 2d 20 63 6f 6c 31 20 2a 20 37 33 20 2b  CT - col1 * 73 +
17c20 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
17c30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
17c40 31 31 36 32 0d 0a 2d 32 32 35 36 0d 0a 2d 34 32  1162..-2256..-42
17c50 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  29....query I ro
17c60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
17c70 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col2 + - col0 * 
17c80 36 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  60 + col2 FROM t
17c90 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
17ca0 2d 31 33 37 34 0d 0a 2d 32 30 39 38 0d 0a 2d 35  -1374..-2098..-5
17cb0 31 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  176....skipif po
17cc0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
17cd0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
17ce0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
17cf0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
17d00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17d10 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
17d20 63 6f 6c 31 20 2b 20 33 32 20 63 6f 6c 32 20 46  col1 + 32 col2 F
17d30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
17d40 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 31 32 33  ..----..118..123
17d50 0d 0a 31 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..129....query I
17d60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17d70 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b 20   ALL + col2 + + 
17d80 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 41 53  ( cor0.col0 ) AS
17d90 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
17da0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
17db0 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 6f  04..117..34....o
17dc0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
17dd0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
17de0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
17df0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
17e00 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 38 0d 0a  sort label-658..
17e10 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
17e20 30 2e 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  0.col1 DIV + col
17e30 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
17e40 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
17e50 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a 0d  -..-1..-2..-3...
17e60 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
17e70 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
17e80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17e90 6c 61 62 65 6c 2d 36 35 38 0d 0a 53 45 4c 45 43  label-658..SELEC
17ea0 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
17eb0 31 20 2f 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  1 / + col0 AS co
17ec0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
17ed0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
17ee0 2d 32 0d 0a 2d 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  -2..-3....onlyif
17ef0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
17f00 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
17f10 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
17f20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
17f30 6c 61 62 65 6c 2d 36 35 39 0d 0a 53 45 4c 45 43  label-659..SELEC
17f40 54 20 2d 20 37 32 20 2a 20 63 6f 6c 32 20 44 49  T - 72 * col2 DI
17f50 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f  V + cor0.col0 co
17f60 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
17f70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor0..----..-2..
17f80 2d 36 36 0d 0a 2d 39 39 0d 0a 0d 0a 73 6b 69 70  -66..-99....skip
17f90 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
17fa0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
17fb0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
17fc0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
17fd0 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
17fe0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
17ff0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
18000 6f 72 74 20 6c 61 62 65 6c 2d 36 35 39 0d 0a 53  ort label-659..S
18010 45 4c 45 43 54 20 2d 20 37 32 20 2a 20 63 6f 6c  ELECT - 72 * col
18020 32 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  2 / + cor0.col0 
18030 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
18040 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
18050 0d 0a 2d 36 36 0d 0a 2d 39 39 0d 0a 0d 0a 71 75  ..-66..-99....qu
18060 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18070 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 33 20  ELECT ALL - - 3 
18080 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
18090 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
180a0 31 33 0d 0a 31 36 0d 0a 32 39 0d 0a 0d 0a 71 75  13..16..29....qu
180b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
180c0 45 4c 45 43 54 20 2b 20 2b 20 31 37 20 46 52 4f  ELECT + + 17 FRO
180d0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
180e0 2d 2d 2d 2d 0d 0a 31 37 0d 0a 31 37 0d 0a 31 37  ----..17..17..17
180f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18100 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18110 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  INCT - cor0.col1
18120 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   + - col0 FROM t
18130 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
18140 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d  -..-110..-132..-
18150 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  180....query I r
18160 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
18170 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2b 20 63   col0 + col1 + c
18180 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
18190 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34   cor0..----..-44
181a0 0d 0a 2d 35 34 0d 0a 34 39 0d 0a 0d 0a 71 75 65  ..-54..49....que
181b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
181c0 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2b  LECT cor0.col1 +
181d0 20 2d 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   - ( col2 + col1
181e0 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
181f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
18200 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38 32  --..-1..-33..-82
18210 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18220 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
18230 49 4e 43 54 20 2d 20 33 31 20 41 53 20 63 6f 6c  INCT - 31 AS col
18240 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
18250 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 31 0d 0a  or0..----..-31..
18260 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18270 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
18280 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT - + cor0.col1
18290 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
182a0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
182b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36  or0..----..-7396
182c0 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a  ..-8281..-9409..
182d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
182e0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 33 31  t..SELECT + - 31
182f0 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
18300 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
18310 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 35 0d 0a 2d  ..----..-1085..-
18320 32 37 35 39 0d 0a 2d 37 34 34 0d 0a 0d 0a 71 75  2759..-744....qu
18330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18340 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
18350 20 38 30 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29   80 + ( - col1 )
18360 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
18370 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
18380 0d 0a 35 34 0d 0a 36 37 0d 0a 37 30 0d 0a 0d 0a  ..54..67..70....
18390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
183a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
183b0 20 32 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20   21 * + col1 AS 
183c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
183d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  S cor0..----..18
183e0 30 36 0d 0a 31 39 31 31 0d 0a 32 30 33 37 0d 0a  06..1911..2037..
183f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18400 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
18410 2b 20 32 30 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  + 20 * - col0 * 
18420 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
18430 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18440 2d 2d 2d 0d 0a 31 31 35 32 30 0d 0a 31 35 38 34  ---..11520..1584
18450 32 30 0d 0a 32 34 35 30 30 0d 0a 0d 0a 71 75 65  20..24500....que
18460 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
18470 4c 45 43 54 20 41 4c 4c 20 2b 20 36 38 20 41 53  LECT ALL + 68 AS
18480 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c   col2 FROM tab2,
18490 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
184a0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
184b0 6e 67 20 74 6f 20 35 39 39 62 65 65 31 35 61 63  ng to 599bee15ac
184c0 34 63 63 33 39 62 38 35 39 38 35 34 65 30 37 64  4cc39b859854e07d
184d0 66 65 37 39 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  fe7990....onlyif
184e0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
184f0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
18500 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
18510 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
18520 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
18530 65 6c 2d 36 37 32 0d 0a 53 45 4c 45 43 54 20 41  el-672..SELECT A
18540 4c 4c 20 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c  LL + CAST( + col
18550 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  2 AS SIGNED ) * 
18560 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 36 33 20  + col2 + - ( 63 
18570 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52  * cor0.col0 ) FR
18580 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
18590 0a 2d 2d 2d 2d 0d 0a 2d 37 38 33 0d 0a 32 37 32  .----..-783..272
185a0 37 0d 0a 34 31 37 36 0d 0a 0d 0a 73 6b 69 70 69  7..4176....skipi
185b0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
185c0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
185d0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
185e0 36 37 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  672..SELECT ALL 
185f0 2b 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20  + CAST ( + col2 
18600 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b  AS INTEGER ) * +
18610 20 63 6f 6c 32 20 2b 20 2d 20 28 20 36 33 20 2a   col2 + - ( 63 *
18620 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 46 52 4f   cor0.col0 ) FRO
18630 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
18640 2d 2d 2d 2d 0d 0a 2d 37 38 33 0d 0a 32 37 32 37  ----..-783..2727
18650 0d 0a 34 31 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..4176....onlyif
18660 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
18670 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
18680 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
18690 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
186a0 6c 61 62 65 6c 2d 36 37 33 0d 0a 53 45 4c 45 43  label-673..SELEC
186b0 54 20 44 49 53 54 49 4e 43 54 20 39 32 20 44 49  T DISTINCT 92 DI
186c0 56 20 2d 20 38 32 20 46 52 4f 4d 20 74 61 62 32  V - 82 FROM tab2
186d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
186e0 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -1....skipif mys
186f0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
18700 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
18710 73 6f 72 74 20 6c 61 62 65 6c 2d 36 37 33 0d 0a  sort label-673..
18720 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18730 39 32 20 2f 20 2d 20 38 32 20 46 52 4f 4d 20 74  92 / - 82 FROM t
18740 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
18750 2d 0d 0a 2d 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -..-1....onlyif 
18760 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
18770 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
18780 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
18790 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
187a0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
187b0 6c 2d 36 37 34 0d 0a 53 45 4c 45 43 54 20 2b 20  l-674..SELECT + 
187c0 2d 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  - ( col0 ) + col
187d0 31 20 2a 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  1 * + CAST( NULL
187e0 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52   AS DECIMAL ) FR
187f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
18800 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
18810 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
18820 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
18830 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
18840 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
18850 36 37 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  674..SELECT + - 
18860 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31 20  ( col0 ) + col1 
18870 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * + CAST ( NULL 
18880 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74  AS REAL ) FROM t
18890 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
188a0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
188b0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
188c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
188d0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d  ISTINCT col1 + -
188e0 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 2d 20   ( + col0 ) * - 
188f0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
18900 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
18910 36 30 0d 0a 32 34 38 0d 0a 34 36 36 31 0d 0a 0d  60..248..4661...
18920 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18930 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
18940 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  1 + - col1 * + c
18950 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
18960 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
18970 32 37 0d 0a 2d 35 32 0d 0a 2d 36 33 30 0d 0a 0d  27..-52..-630...
18980 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18990 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
189a0 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20  ol1 - - col2 AS 
189b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
189c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
189d0 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65  3..-4..21....que
189e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
189f0 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20  LECT + col0 + + 
18a00 74 61 62 31 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32  tab1.col1 + col2
18a10 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
18a20 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
18a30 2d 0d 0a 2d 31 31 35 35 0d 0a 2d 31 33 37 35 0d  -..-1155..-1375.
18a40 0a 2d 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .-496....query I
18a50 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18a60 20 2d 20 31 31 20 46 52 4f 4d 20 74 61 62 30 20   - 11 FROM tab0 
18a70 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
18a80 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  IN tab2 AS cor1.
18a90 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
18aa0 68 61 73 68 69 6e 67 20 74 6f 20 30 35 63 63 39  hashing to 05cc9
18ab0 38 39 31 32 32 64 37 37 32 34 63 37 61 62 65 66  89122d7724c7abef
18ac0 61 62 61 39 36 32 35 65 66 33 64 0d 0a 0d 0a 71  aba9625ef3d....q
18ad0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18ae0 53 45 4c 45 43 54 20 31 35 20 2b 20 2d 20 63 6f  SELECT 15 + - co
18af0 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l1 * - cor0.col2
18b00 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
18b10 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
18b20 2d 0d 0a 33 34 31 30 0d 0a 36 36 34 31 33 33 0d  -..3410..664133.
18b30 0a 36 38 31 32 37 0d 0a 0d 0a 71 75 65 72 79 20  .68127....query 
18b40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18b50 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 72 30 2e 63  T ALL - + cor0.c
18b60 6f 6c 32 20 2b 20 2b 20 28 20 39 39 20 29 20 41  ol2 + + ( 99 ) A
18b70 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
18b80 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
18b90 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
18ba0 61 73 68 69 6e 67 20 74 6f 20 66 38 32 64 62 38  ashing to f82db8
18bb0 34 31 61 36 39 66 32 65 62 38 39 36 39 34 31 64  41a69f2eb896941d
18bc0 34 39 63 39 35 31 62 62 34 30 0d 0a 0d 0a 71 75  49c951bb40....qu
18bd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18be0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 28 20  ELECT ALL - ( ( 
18bf0 2b 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 29 20  + tab1.col2 ) ) 
18c00 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
18c10 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a  .-54..-57..-96..
18c20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18c30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
18c40 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   * + col1 + col0
18c50 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
18c60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 38 0d 0a  r0..----..1328..
18c70 31 34 30 37 0d 0a 36 33 34 0d 0a 0d 0a 73 6b 69  1407..634....ski
18c80 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
18c90 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
18ca0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
18cb0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
18cc0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
18cd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
18ce0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col0 * - col2 + 
18cf0 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 32 20  col0 * - ( col2 
18d00 29 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  ) * col1 col2 FR
18d10 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
18d20 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 36 38 30 0d 0a  .----..-121680..
18d30 2d 35 34 30 33 36 0d 0a 2d 36 30 34 38 0d 0a 0d  -54036..-6048...
18d40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18d50 0d 0a 53 45 4c 45 43 54 20 34 32 20 46 52 4f 4d  ..SELECT 42 FROM
18d60 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
18d70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
18d80 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
18d90 34 63 32 39 64 62 39 66 31 63 64 37 65 64 34 64  4c29db9f1cd7ed4d
18da0 64 65 62 31 37 33 35 65 33 65 30 64 34 34 32 0d  deb1735e3e0d442.
18db0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18dc0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 31 30 20  rt..SELECT + 10 
18dd0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
18de0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
18df0 33 34 0d 0a 34 35 0d 0a 39 39 0d 0a 0d 0a 73 6b  34..45..99....sk
18e00 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
18e10 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
18e20 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
18e30 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
18e40 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
18e50 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
18e60 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63  LL + cor0.col2 c
18e70 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
18e80 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
18e90 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  0..----..27 valu
18ea0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 66  es hashing to 7f
18eb0 34 61 39 62 66 32 34 64 36 34 38 33 33 37 30 36  4a9bf24d64833706
18ec0 64 66 62 64 64 30 62 61 66 34 39 64 37 39 0d 0a  dfbdd0baf49d79..
18ed0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18ee0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
18ef0 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b  r0.col2 * col0 +
18f00 20 2b 20 35 34 20 41 53 20 63 6f 6c 30 20 46 52   + 54 AS col0 FR
18f10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
18f20 0a 2d 2d 2d 2d 0d 0a 37 33 35 32 0d 0a 38 34 36  .----..7352..846
18f30 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
18f40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18f50 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col1 + col2 * co
18f60 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
18f70 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
18f80 2d 2d 0d 0a 31 38 38 0d 0a 33 36 35 38 0d 0a 37  --..188..3658..7
18f90 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  693....query I r
18fa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
18fb0 20 36 33 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20   63 * - col2 AS 
18fc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
18fd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
18fe0 37 39 0d 0a 35 31 36 36 0d 0a 36 33 0d 0a 0d 0a  79..5166..63....
18ff0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19000 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19010 20 2d 20 32 31 20 46 52 4f 4d 20 74 61 62 30 2c   - 21 FROM tab0,
19020 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
19030 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab1 AS cor1, tab
19040 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  0 AS cor2..----.
19050 0a 2d 32 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-21....onlyif m
19060 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
19070 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
19080 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
19090 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
190a0 62 65 6c 2d 36 39 32 0d 0a 53 45 4c 45 43 54 20  bel-692..SELECT 
190b0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 34 32  - cor0.col0 + 42
190c0 20 44 49 56 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   DIV + col1 FROM
190d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
190e0 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 30 0d 0a 2d 37  ---..-2..-60..-7
190f0 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  7....skipif mysq
19100 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
19110 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
19120 6f 72 74 20 6c 61 62 65 6c 2d 36 39 32 0d 0a 53  ort label-692..S
19130 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  ELECT - cor0.col
19140 30 20 2b 20 34 32 20 2f 20 2b 20 63 6f 6c 31 20  0 + 42 / + col1 
19150 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
19160 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 30  0..----..-2..-60
19170 0d 0a 2d 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-77....query I
19180 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
19190 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 39 30 20 2a   + col2 * + 90 *
191a0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
191b0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
191c0 0a 2d 2d 2d 2d 0d 0a 31 37 30 31 30 0d 0a 31 38  .----..17010..18
191d0 32 35 32 30 0d 0a 32 37 30 31 38 30 0d 0a 0d 0a  2520..270180....
191e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
191f0 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30  .SELECT - + cor0
19200 2e 63 6f 6c 32 20 2b 20 28 20 2b 20 31 38 20 29  .col2 + ( + 18 )
19210 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
19220 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
19230 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33 36 0d  or0..----..1036.
19240 0a 32 36 38 0d 0a 35 33 31 0d 0a 0d 0a 71 75 65  .268..531....que
19250 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19260 4c 45 43 54 20 37 39 20 2b 20 74 61 62 32 2e 63  LECT 79 + tab2.c
19270 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f  ol1 * - col1 FRO
19280 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab2..----..-2
19290 31 30 0d 0a 2d 33 34 30 32 0d 0a 2d 38 38 32 0d  10..-3402..-882.
192a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
192b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
192c0 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  NCT cor0.col1 AS
192d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c   col1 FROM tab0,
192e0 20 74 61 62 32 20 63 6f 72 30 2c 20 74 61 62 31   tab2 cor0, tab1
192f0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
19300 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 73 6b  17..31..59....sk
19310 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
19320 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
19330 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
19340 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
19350 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
19360 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
19370 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63   cor0.col1 * + c
19380 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52  or0.col2 col2 FR
19390 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
193a0 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36  .----..1534..646
193b0 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..837....query I
193c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
193d0 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f   DISTINCT + - co
193e0 6c 31 20 2a 20 2d 20 28 20 2b 20 34 31 20 2a 20  l1 * - ( + 41 * 
193f0 63 6f 6c 30 20 29 20 2b 20 2d 20 63 6f 6c 31 20  col0 ) + - col1 
19400 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19410 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  0 cor0..----..13
19420 39 30 39 38 0d 0a 33 33 31 39 36 38 0d 0a 38 34  9098..331968..84
19430 35 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  538....query I r
19440 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
19450 49 53 54 49 4e 43 54 20 2d 20 31 38 20 2a 20 33  ISTINCT - 18 * 3
19460 38 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  8 + col2 AS col0
19470 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
19480 0a 2d 2d 2d 2d 0d 0a 2d 36 30 32 0d 0a 2d 36 35  .----..-602..-65
19490 31 0d 0a 2d 36 38 33 0d 0a 0d 0a 71 75 65 72 79  1..-683....query
194a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
194b0 43 54 20 41 4c 4c 20 37 30 20 2a 20 63 6f 6c 31  CT ALL 70 * col1
194c0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
194d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
194e0 0d 0a 36 30 32 30 0d 0a 36 33 37 30 0d 0a 36 37  ..6020..6370..67
194f0 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
19500 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
19510 4c 20 2b 20 2b 20 39 20 46 52 4f 4d 20 74 61 62  L + + 9 FROM tab
19520 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
19530 0a 39 0d 0a 39 0d 0a 39 0d 0a 0d 0a 71 75 65 72  .9..9..9....quer
19540 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
19550 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74  ECT DISTINCT + t
19560 61 62 30 2e 63 6f 6c 31 20 2b 20 2b 20 74 61 62  ab0.col1 + + tab
19570 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
19580 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
19590 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab1 AS cor1..--
195a0 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39 38  --..119..173..98
195b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
195c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
195d0 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col0 * cor0.col0
195e0 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
195f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19600 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a 38 33 32  .234..40960..832
19610 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
19620 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
19630 4c 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 33 38 20  L + col1 + + 38 
19640 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  * col2 * - col2 
19650 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
19660 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 35 35 34 32 31  0..----..-255421
19670 0d 0a 2d 34 31 32 39 36 0d 0a 35 39 0d 0a 0d 0a  ..-41296..59....
19680 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
19690 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
196a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
196b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
196c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 35 0d  wsort label-705.
196d0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30  .SELECT + - cor0
196e0 2e 63 6f 6c 32 20 44 49 56 20 2b 20 34 38 20 41  .col2 DIV + 48 A
196f0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
19700 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19710 2d 31 0d 0a 2d 31 0d 0a 2d 32 0d 0a 0d 0a 73 6b  -1..-1..-2....sk
19720 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
19730 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
19740 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
19750 65 6c 2d 37 30 35 0d 0a 53 45 4c 45 43 54 20 2b  el-705..SELECT +
19760 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2f 20 2b   - cor0.col2 / +
19770 20 34 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   48 AS col1 FROM
19780 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
19790 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 32 0d  ---..-1..-1..-2.
197a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
197b0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
197c0 4e 43 54 20 2b 20 28 20 39 35 20 29 20 2b 20 2d  NCT + ( 95 ) + -
197d0 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
197e0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
197f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
19800 33 38 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20  38..41....query 
19810 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19820 54 20 63 6f 6c 32 20 2d 20 2b 20 28 20 32 37 20  T col2 - + ( 27 
19830 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
19840 2d 0d 0a 2d 32 36 0d 0a 35 35 0d 0a 36 0d 0a 0d  -..-26..55..6...
19850 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19860 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
19870 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e  * col0 + - cor0.
19880 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
19890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
198a0 32 32 36 0d 0a 2d 36 30 39 0d 0a 2d 38 30 30 33  226..-609..-8003
198b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
198c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
198d0 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 28 20 2d  ( - col1 ) + ( -
198e0 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20   col1 ) AS col2 
198f0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
19900 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
19910 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19920 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
19930 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  INCT + col1 + co
19940 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l2 * + cor0.col1
19950 20 2b 20 37 37 20 41 53 20 63 6f 6c 31 20 46 52   + 77 AS col1 FR
19960 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
19970 0a 2d 2d 2d 2d 0d 0a 31 33 33 38 0d 0a 31 35 30  .----..1338..150
19980 37 0d 0a 36 35 37 0d 0a 0d 0a 73 6b 69 70 69 66  7..657....skipif
19990 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
199a0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
199b0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
199c0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
199d0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
199e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
199f0 20 28 20 63 6f 6c 32 20 29 20 63 6f 6c 30 20 46   ( col2 ) col0 F
19a00 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
19a10 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a  ---..1..33..82..
19a20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19a30 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
19a40 39 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  9 * cor0.col0 FR
19a50 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
19a60 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 37 30 32 0d 0a  .----..63..702..
19a70 37 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  711....query I r
19a80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
19a90 49 53 54 49 4e 43 54 20 2d 20 39 20 2b 20 63 6f  ISTINCT - 9 + co
19aa0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
19ab0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
19ac0 2d 2d 0d 0a 2d 32 0d 0a 36 39 0d 0a 37 30 0d 0a  --..-2..69..70..
19ad0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19ae0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
19af0 33 37 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  37 FROM tab2, ta
19b00 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
19b10 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
19b20 6e 67 20 74 6f 20 65 64 34 36 34 34 61 66 37 37  ng to ed4644af77
19b30 32 39 63 32 34 32 35 65 61 36 63 63 33 64 38 34  29c2425ea6cc3d84
19b40 63 36 35 30 34 66 0d 0a 0d 0a 71 75 65 72 79 20  c6504f....query 
19b50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19b60 54 20 38 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  T 83 AS col2 FRO
19b70 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
19b80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
19b90 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
19ba0 31 38 66 34 30 35 63 33 31 61 30 66 62 34 37 63  18f405c31a0fb47c
19bb0 65 33 63 63 39 66 37 65 66 66 61 38 38 35 35 63  e3cc9f7effa8855c
19bc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19bd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 32  ort..SELECT - 52
19be0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
19bf0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
19c00 0a 2d 31 33 35 32 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1352..-1404..-
19c10 31 39 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  1976....skipif p
19c20 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
19c30 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
19c40 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
19c50 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
19c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19c70 0d 0a 53 45 4c 45 43 54 20 39 35 20 63 6f 6c 32  ..SELECT 95 col2
19c80 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
19c90 0d 0a 39 35 0d 0a 39 35 0d 0a 39 35 0d 0a 0d 0a  ..95..95..95....
19ca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19cb0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
19cc0 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
19cd0 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  1 cor0 CROSS JOI
19ce0 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
19cf0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
19d00 61 73 68 69 6e 67 20 74 6f 20 34 65 63 33 30 34  ashing to 4ec304
19d10 62 38 63 65 39 33 35 66 32 32 32 36 65 37 35 34  b8ce935f2226e754
19d20 38 64 37 32 63 32 62 32 66 30 0d 0a 0d 0a 6f 6e  8d72c2b2f0....on
19d30 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
19d40 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
19d50 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
19d60 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
19d70 6f 72 74 20 6c 61 62 65 6c 2d 37 31 39 0d 0a 53  ort label-719..S
19d80 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
19d90 20 39 37 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56   97 + - col1 DIV
19da0 20 33 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   35 AS col0 FROM
19db0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 39 35 0d   tab0..----..95.
19dc0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
19dd0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
19de0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
19df0 74 20 6c 61 62 65 6c 2d 37 31 39 0d 0a 53 45 4c  t label-719..SEL
19e00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 39  ECT DISTINCT + 9
19e10 37 20 2b 20 2d 20 63 6f 6c 31 20 2f 20 33 35 20  7 + - col1 / 35 
19e20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
19e30 30 0d 0a 2d 2d 2d 2d 0d 0a 39 35 0d 0a 0d 0a 6f  0..----..95....o
19e40 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
19e50 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
19e60 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
19e70 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
19e80 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 30 0d 0a  sort label-720..
19e90 53 45 4c 45 43 54 20 2d 20 36 30 20 44 49 56 20  SELECT - 60 DIV 
19ea0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53  col0 + - col0 AS
19eb0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
19ec0 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 36 34 0d  .----..-23..-64.
19ed0 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-80....skipif m
19ee0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
19ef0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
19f00 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 30  owsort label-720
19f10 0d 0a 53 45 4c 45 43 54 20 2d 20 36 30 20 2f 20  ..SELECT - 60 / 
19f20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 41 53  col0 + - col0 AS
19f30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
19f40 0a 2d 2d 2d 2d 0d 0a 2d 32 33 0d 0a 2d 36 34 0d  .----..-23..-64.
19f50 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-80....onlyif m
19f60 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
19f70 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
19f80 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
19f90 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
19fa0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
19fb0 2d 37 32 31 0d 0a 53 45 4c 45 43 54 20 43 41 53  -721..SELECT CAS
19fc0 54 28 20 2b 20 63 6f 6c 32 20 41 53 20 44 45 43  T( + col2 AS DEC
19fd0 49 4d 41 4c 20 29 20 2b 20 2d 20 63 6f 6c 30 20  IMAL ) + - col0 
19fe0 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
19ff0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
1a000 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
1a010 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1a020 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1a030 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1a040 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a050 65 6c 2d 37 32 31 0d 0a 53 45 4c 45 43 54 20 43  el-721..SELECT C
1a060 41 53 54 20 28 20 2b 20 63 6f 6c 32 20 41 53 20  AST ( + col2 AS 
1a070 52 45 41 4c 20 29 20 2b 20 2d 20 63 6f 6c 30 20  REAL ) + - col0 
1a080 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  * CAST ( NULL AS
1a090 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
1a0a0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
1a0b0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
1a0c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a0d0 0a 53 45 4c 45 43 54 20 2b 20 35 38 20 2b 20 33  .SELECT + 58 + 3
1a0e0 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
1a0f0 2d 0d 0a 39 30 0d 0a 39 30 0d 0a 39 30 0d 0a 0d  -..90..90..90...
1a100 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1a110 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1a120 54 20 38 37 20 2a 20 2d 20 74 61 62 31 2e 63 6f  T 87 * - tab1.co
1a130 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
1a140 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31  tab1..----..-261
1a150 0d 0a 2d 35 35 36 38 0d 0a 2d 36 39 36 30 0d 0a  ..-5568..-6960..
1a160 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a170 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32  t..SELECT + tab2
1a180 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 2d  .col1 * col1 * -
1a190 20 74 61 62 32 2e 63 6f 6c 32 20 2b 20 38 20 41   tab2.col2 + 8 A
1a1a0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
1a1b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 37 34 0d 0a  ..----..-10974..
1a1c0 2d 32 35 39 33 39 0d 0a 2d 39 30 34 39 38 0d 0a  -25939..-90498..
1a1d0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1a1e0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1a1f0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1a200 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1a210 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1a220 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 35 0d 0a  sort label-725..
1a230 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e  SELECT + CAST( N
1a240 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
1a250 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * - col2 AS col0
1a260 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1a270 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
1a280 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
1a290 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1a2a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1a2b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1a2c0 65 6c 2d 37 32 35 0d 0a 53 45 4c 45 43 54 20 2b  el-725..SELECT +
1a2d0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
1a2e0 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f  INTEGER ) * - co
1a2f0 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
1a300 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1a310 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1a320 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
1a330 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1a340 44 49 53 54 49 4e 43 54 20 2d 20 33 32 20 2a 20  DISTINCT - 32 * 
1a350 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
1a360 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1a370 2d 2d 2d 0d 0a 32 30 34 38 0d 0a 32 35 36 30 0d  ---..2048..2560.
1a380 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .96....query I r
1a390 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1a3a0 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20   + ( - col2 ) + 
1a3b0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  + cor0.col2 * - 
1a3c0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
1a3d0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
1a3e0 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a  -..-1508..-608..
1a3f0 2d 38 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -810....onlyif m
1a400 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1a410 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1a420 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1a430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a440 62 65 6c 2d 37 32 38 0d 0a 53 45 4c 45 43 54 20  bel-728..SELECT 
1a450 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2d 20  cor0.col0 DIV - 
1a460 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32  cor0.col0 + col2
1a470 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1a480 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36  r0..----..53..56
1a490 0d 0a 39 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..95....skipif m
1a4a0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1a4b0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1a4c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 38  owsort label-728
1a4d0 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
1a4e0 6c 30 20 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l0 / - cor0.col0
1a4f0 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
1a500 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1a510 0a 35 33 0d 0a 35 36 0d 0a 39 35 0d 0a 0d 0a 71  .53..56..95....q
1a520 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a530 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1a540 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
1a550 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  0 FROM tab0, tab
1a560 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20  1 AS cor0, tab2 
1a570 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor1..----..1
1a580 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65  0..13..26....que
1a590 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a5a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1a5b0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53  col1 * - col1 AS
1a5c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1a5d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
1a5e0 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65  .169..676....que
1a5f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a600 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1a610 36 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  62 * col2 + col1
1a620 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1a630 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 36 30 0d  r0..----..-1960.
1a640 0a 2d 34 39 39 33 0d 0a 33 35 0d 0a 0d 0a 71 75  .-4993..35....qu
1a650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a660 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1a670 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor1.col1 FROM 
1a680 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
1a690 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
1a6a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31  ..----..-17..-31
1a6b0 0d 0a 2d 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-59....skipif 
1a6c0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1a6d0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1a6e0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1a6f0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1a700 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1a710 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
1a720 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46   + - col2 col1 F
1a730 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1a740 2d 31 30 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a  -109..-67..-80..
1a750 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1a760 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1a770 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1a780 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1a790 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1a7a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a7b0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1a7c0 6c 31 20 2b 20 2d 20 32 38 20 2a 20 2d 20 63 6f  l1 + - 28 * - co
1a7d0 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
1a7e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1a7f0 0a 31 30 38 31 0d 0a 37 38 37 0d 0a 0d 0a 71 75  .1081..787....qu
1a800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a810 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
1a820 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20 41   col1 ) + col2 A
1a830 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1a840 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a850 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d 0a 71  109..67..80....q
1a860 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a870 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
1a880 2b 20 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 63  + col1 * + ( - c
1a890 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20  ol2 ) FROM tab2 
1a8a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1a8b0 31 35 39 33 0d 0a 2d 36 36 33 0d 0a 2d 38 36 38  1593..-663..-868
1a8c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a8d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 20 2a 20  ort..SELECT 9 * 
1a8e0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
1a8f0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1a900 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 32 34 33 0d 0a  ----..234..243..
1a910 33 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  342....skipif po
1a920 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1a930 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1a940 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1a950 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1a960 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1a970 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38 31  .SELECT ALL - 81
1a980 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   * col0 col1 FRO
1a990 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1a9a0 2d 0d 0a 2d 31 39 34 34 0d 0a 2d 32 38 33 35 0d  -..-1944..-2835.
1a9b0 0a 2d 37 32 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-7209....onlyif
1a9c0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
1a9d0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
1a9e0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
1a9f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1aa00 6c 61 62 65 6c 2d 37 33 39 0d 0a 53 45 4c 45 43  label-739..SELEC
1aa10 54 20 41 4c 4c 20 2b 20 34 32 20 2b 20 2d 20 63  T ALL + 42 + - c
1aa20 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 46  ol2 DIV - col0 F
1aa30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1aa40 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 34 33 0d 0a  ..----..42..43..
1aa50 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  60....skipif mys
1aa60 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1aa70 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1aa80 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 39 0d 0a  sort label-739..
1aa90 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 32 20  SELECT ALL + 42 
1aaa0 2b 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  + - col2 / - col
1aab0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1aac0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 34  or0..----..42..4
1aad0 33 0d 0a 36 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..60....onlyif 
1aae0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
1aaf0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
1ab00 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
1ab10 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
1ab20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1ab30 6c 2d 37 34 30 0d 0a 53 45 4c 45 43 54 20 41 4c  l-740..SELECT AL
1ab40 4c 20 2b 20 2b 20 36 38 20 2a 20 63 6f 6c 30 20  L + + 68 * col0 
1ab50 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41  + CAST( + col1 A
1ab60 53 20 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 72  S SIGNED ) * cor
1ab70 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  0.col2 AS col1 F
1ab80 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1ab90 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 38 0d 0a 34 39  ..----..1608..49
1aba0 32 32 0d 0a 36 36 38 38 0d 0a 0d 0a 73 6b 69 70  22..6688....skip
1abb0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1abc0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1abd0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1abe0 2d 37 34 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -740..SELECT ALL
1abf0 20 2b 20 2b 20 36 38 20 2a 20 63 6f 6c 30 20 2b   + + 68 * col0 +
1ac00 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 41   CAST ( + col1 A
1ac10 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f  S INTEGER ) * co
1ac20 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
1ac30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1ac40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 30 38 0d 0a 34  0..----..1608..4
1ac50 39 32 32 0d 0a 36 36 38 38 0d 0a 0d 0a 71 75 65  922..6688....que
1ac60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ac70 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1ac80 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2d 20  + col2 * col1 - 
1ac90 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63 6f  ( - col1 ) AS co
1aca0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1acb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 39 33  cor0..----..1593
1acc0 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a 0d 0a 71 75  ..663..868....qu
1acd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ace0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
1acf0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41   * + cor0.col2 A
1ad00 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
1ad10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ad20 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d  189..2028..3002.
1ad30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ad40 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 32  rt..SELECT + + 2
1ad50 34 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  4 * col0 FROM ta
1ad60 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1ad70 0d 0a 31 36 38 0d 0a 31 38 37 32 0d 0a 31 38 39  ..168..1872..189
1ad80 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1ad90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
1ada0 20 33 35 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20   35 * col2 FROM 
1adb0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
1adc0 0a 31 38 39 30 0d 0a 31 39 39 35 0d 0a 33 33 36  .1890..1995..336
1add0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1ade0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1adf0 20 2d 20 2b 20 34 34 20 41 53 20 63 6f 6c 31 20   - + 44 AS col1 
1ae00 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1ae10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a 2d 34  0..----..-44..-4
1ae20 34 0d 0a 2d 34 34 0d 0a 0d 0a 71 75 65 72 79 20  4..-44....query 
1ae30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ae40 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e  T col2 + + cor0.
1ae50 63 6f 6c 31 20 2a 20 30 20 46 52 4f 4d 20 74 61  col1 * 0 FROM ta
1ae60 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1ae70 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71  ..1..33..82....q
1ae80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ae90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1aea0 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  ( + cor0.col1 ) 
1aeb0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1aec0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d  0..----..10..13.
1aed0 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .26....onlyif my
1aee0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
1aef0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
1af00 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
1af10 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
1af20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1af30 37 34 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  748..SELECT ALL 
1af40 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e  - + col2 * cor0.
1af50 63 6f 6c 30 20 2f 20 2d 20 43 41 53 54 28 20 4e  col0 / - CAST( N
1af60 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
1af70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1af80 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
1af90 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
1afa0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1afb0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1afc0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1afd0 6c 2d 37 34 38 0d 0a 53 45 4c 45 43 54 20 41 4c  l-748..SELECT AL
1afe0 4c 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  L - + col2 * cor
1aff0 30 2e 63 6f 6c 30 20 2f 20 2d 20 43 41 53 54 20  0.col0 / - CAST 
1b000 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
1b010 52 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  R ) FROM tab2 AS
1b020 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
1b030 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
1b040 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b050 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72  ..SELECT + - cor
1b060 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e  0.col0 * + cor0.
1b070 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
1b080 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1b090 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32  ----..-189..-202
1b0a0 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72  8..-3002....quer
1b0b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1b0c0 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 28 20 63  ECT - col2 * ( c
1b0d0 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol2 ) FROM tab1 
1b0e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 31  cor0..----..-291
1b0f0 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39 32 31 36 0d  6..-3249..-9216.
1b100 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b110 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  rt..SELECT - cor
1b120 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  0.col2 * + cor0.
1b130 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52  col1 + + col2 FR
1b140 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1b150 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 32 0d 0a 2d 31  .----..-1152..-1
1b160 33 35 30 0d 0a 2d 35 31 33 0d 0a 0d 0a 6f 6e 6c  350..-513....onl
1b170 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1b180 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1b190 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1b1a0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1b1b0 72 74 20 6c 61 62 65 6c 2d 37 35 32 0d 0a 53 45  rt label-752..SE
1b1c0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1b1d0 63 6f 6c 31 20 2b 20 35 39 20 44 49 56 20 2d 20  col1 + 59 DIV - 
1b1e0 36 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  67 FROM tab1 AS 
1b1f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  cor0..----..10..
1b200 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b 69 70 69 66  13..26....skipif
1b210 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1b220 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1b230 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1b240 35 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  52..SELECT DISTI
1b250 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 35 39 20  NCT + col1 + 59 
1b260 2f 20 2d 20 36 37 20 46 52 4f 4d 20 74 61 62 31  / - 67 FROM tab1
1b270 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1b280 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b  10..13..26....sk
1b290 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1b2a0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1b2b0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1b2c0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1b2d0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1b2e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1b2f0 20 63 6f 6c 31 20 2a 20 31 39 20 63 6f 6c 30 20   col1 * 19 col0 
1b300 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1b310 0a 31 31 32 31 0d 0a 33 32 33 0d 0a 35 38 39 0d  .1121..323..589.
1b320 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b330 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b340 4e 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 32  NCT + + col1 + 2
1b350 39 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  9 + - col1 * - c
1b360 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1b370 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1b380 0d 0a 37 35 31 31 0d 0a 38 34 30 31 0d 0a 39 35  ..7511..8401..95
1b390 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  35....query I ro
1b3a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1b3b0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
1b3c0 2b 20 39 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 92 AS col1 FRO
1b3d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1b3e0 2d 2d 2d 2d 0d 0a 2d 37 39 31 32 0d 0a 2d 38 33  ----..-7912..-83
1b3f0 37 32 0d 0a 2d 38 39 32 34 0d 0a 0d 0a 71 75 65  72..-8924....que
1b400 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b410 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
1b420 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 32  cor0.col0 * col2
1b430 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
1b440 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1b450 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 32 30 39 0d 0a  0..----..-7209..
1b460 2d 37 36 38 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  -768..0....query
1b470 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b480 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 28 20  CT - col1 + + ( 
1b490 2b 20 28 20 63 6f 6c 31 20 29 20 29 20 2b 20 63  + ( col1 ) ) + c
1b4a0 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
1b4b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1b4c0 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
1b4d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b4e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1b4f0 20 63 6f 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 32   col1 * - ( col2
1b500 20 2b 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d   + + col0 ) FROM
1b510 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
1b520 0d 0a 2d 31 32 31 30 0d 0a 2d 31 34 38 32 0d 0a  ..-1210..-1482..
1b530 2d 32 32 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  -2288....query I
1b540 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1b550 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
1b560 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 34 30 20  ol1 + col1 + 40 
1b570 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1b580 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 36 0d  0..----..60..66.
1b590 0a 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .92....query I r
1b5a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1b5b0 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  LL + col0 + + co
1b5c0 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 + + cor0.col2
1b5d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b5e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31  r0..----..131..1
1b5f0 38 39 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20  89..83....query 
1b600 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b610 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  T + cor0.col0 + 
1b620 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  - cor0.col1 * - 
1b630 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1b640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  S cor0..----..13
1b650 32 38 0d 0a 31 34 30 37 0d 0a 36 33 34 0d 0a 0d  28..1407..634...
1b660 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1b670 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
1b680 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
1b690 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  0 * + cor0.col0 
1b6a0 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + + col0 FROM ta
1b6b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1b6c0 0d 0a 2d 31 33 38 30 30 0d 0a 2d 34 32 38 34 30  ..-13800..-42840
1b6d0 0d 0a 2d 37 30 34 38 38 30 0d 0a 0d 0a 71 75 65  ..-704880....que
1b6e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b6f0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1b700 63 6f 6c 31 20 2b 20 38 30 20 46 52 4f 4d 20 74  col1 + 80 FROM t
1b710 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1b720 2d 0d 0a 31 30 36 0d 0a 39 30 0d 0a 39 33 0d 0a  -..106..90..93..
1b730 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b740 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20  t..SELECT + ( - 
1b750 36 38 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  68 ) FROM tab1 A
1b760 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  S cor0..----..-6
1b770 38 0d 0a 2d 36 38 0d 0a 2d 36 38 0d 0a 0d 0a 73  8..-68..-68....s
1b780 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
1b790 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
1b7a0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
1b7b0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
1b7c0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
1b7d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1b7e0 41 4c 4c 20 2b 20 34 39 20 63 6f 6c 32 20 46 52  ALL + 49 col2 FR
1b7f0 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
1b800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1b810 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1b820 20 63 62 34 30 37 38 33 63 30 66 66 66 37 32 65   cb40783c0fff72e
1b830 38 38 30 32 63 64 66 30 36 38 32 65 37 63 62 35  8802cdf0682e7cb5
1b840 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
1b850 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1b860 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 63  1 * - col0 + - c
1b870 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
1b880 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1b890 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 31 0d  r0..----..-1381.
1b8a0 0a 2d 32 34 34 0d 0a 2d 34 36 32 38 0d 0a 0d 0a  .-244..-4628....
1b8b0 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
1b8c0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
1b8d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a  ELECT DISTINCT *
1b8e0 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30   FROM tab2, tab0
1b8f0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
1b900 53 20 63 6f 72 31 2c 20 74 61 62 30 2c 20 74 61  S cor1, tab0, ta
1b910 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b0 AS cor2..----
1b920 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
1b930 73 68 69 6e 67 20 74 6f 20 33 38 38 39 36 64 33  shing to 38896d3
1b940 61 34 62 64 39 35 33 63 63 37 38 66 39 33 64 37  a4bd953cc78f93d7
1b950 33 61 65 30 36 34 63 62 64 0d 0a 0d 0a 71 75 65  3ae064cbd....que
1b960 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b970 4c 45 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20  LECT - ( col1 ) 
1b980 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  * col2 AS col2 F
1b990 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
1b9a0 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36  ---..-1534..-646
1b9b0 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-837....query 
1b9c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1b9d0 54 20 41 4c 4c 20 2b 20 2d 20 34 20 2a 20 2d 20  T ALL + - 4 * - 
1b9e0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30  cor0.col1 * cor0
1b9f0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
1ba00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1ba10 0a 2d 2d 2d 2d 0d 0a 32 35 36 30 0d 0a 33 31 32  .----..2560..312
1ba20 0d 0a 34 31 36 30 0d 0a 0d 0a 71 75 65 72 79 20  ..4160....query 
1ba30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ba40 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c  T ALL + tab1.col
1ba50 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 + col0 AS col1
1ba60 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1ba70 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a  ..29..74..93....
1ba80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ba90 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1baa0 6c 31 20 2b 20 2b 20 33 30 20 2a 20 2b 20 63 6f  l1 + + 30 * + co
1bab0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
1bac0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1bad0 2d 2d 0d 0a 31 31 32 33 0d 0a 37 32 31 0d 0a 37  --..1123..721..7
1bae0 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
1baf0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1bb00 38 32 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c  82 + col1 AS col
1bb10 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1bb20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 38 0d 0a  or0..----..168..
1bb30 31 37 33 0d 0a 31 37 39 0d 0a 0d 0a 71 75 65 72  173..179....quer
1bb40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1bb50 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
1bb60 20 63 6f 6c 31 20 2b 20 2b 20 38 20 46 52 4f 4d   col1 + + 8 FROM
1bb70 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1bb80 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 32 0d 0a 2d 35  ---..-18..-2..-5
1bb90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bba0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 33  ort..SELECT - 33
1bbb0 20 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * + col2 AS col
1bbc0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
1bbd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 35 34  or0..----..-1254
1bbe0 0d 0a 2d 38 35 38 0d 0a 2d 38 39 31 0d 0a 0d 0a  ..-858..-891....
1bbf0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1bc00 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1bc10 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1bc20 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1bc30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 35 0d  wsort label-775.
1bc40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1bc50 6c 31 20 44 49 56 20 2d 20 63 6f 6c 32 20 41 53  l1 DIV - col2 AS
1bc60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1bc70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32  cor0..----..1..2
1bc80 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..97....skipif m
1bc90 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1bca0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1bcb0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 37 35  owsort label-775
1bcc0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1bcd0 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20  ol1 / - col2 AS 
1bce0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63  col1 FROM tab0 c
1bcf0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d  or0..----..1..2.
1bd00 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
1bd10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
1bd20 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 72 30   - col1 ) * cor0
1bd30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 2b  .col2 + col1 + +
1bd40 20 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   1 AS col1 FROM 
1bd50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1bd60 2d 2d 0d 0a 2d 31 32 33 34 0d 0a 2d 31 33 37 37  --..-1234..-1377
1bd70 0d 0a 2d 35 35 39 0d 0a 0d 0a 71 75 65 72 79 20  ..-559....query 
1bd80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bd90 54 20 41 4c 4c 20 2d 20 2d 20 37 36 20 46 52 4f  T ALL - - 76 FRO
1bda0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1bdb0 2d 2d 2d 2d 0d 0a 37 36 0d 0a 37 36 0d 0a 37 36  ----..76..76..76
1bdc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bdd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1bde0 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 38 34  INCT + col0 * 84
1bdf0 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
1be00 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
1be10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 39 0d 0a  or0..----..249..
1be20 35 33 31 32 0d 0a 36 36 34 30 0d 0a 0d 0a 71 75  5312..6640....qu
1be30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1be40 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 2b  ELECT + col2 + +
1be50 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f   col0 * col0 FRO
1be60 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1be70 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36 30 39 0d  ----..1226..609.
1be80 0a 38 30 30 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .8003....onlyif 
1be90 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1bea0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1beb0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1bec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1bed0 61 62 65 6c 2d 37 38 30 0d 0a 53 45 4c 45 43 54  abel-780..SELECT
1bee0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
1bef0 20 2b 20 33 35 20 2b 20 2d 20 63 6f 6c 32 20 44   + 35 + - col2 D
1bf00 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74  IV - col0 FROM t
1bf10 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
1bf20 31 31 35 36 0d 0a 32 38 37 30 0d 0a 33 35 0d 0a  1156..2870..35..
1bf30 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1bf40 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1bf50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1bf60 20 6c 61 62 65 6c 2d 37 38 30 0d 0a 53 45 4c 45   label-780..SELE
1bf70 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
1bf80 20 2a 20 2b 20 33 35 20 2b 20 2d 20 63 6f 6c 32   * + 35 + - col2
1bf90 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   / - col0 FROM t
1bfa0 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
1bfb0 31 31 35 36 0d 0a 32 38 37 30 0d 0a 33 35 0d 0a  1156..2870..35..
1bfc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bfd0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30  t..SELECT + cor0
1bfe0 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c  .col1 FROM tab0,
1bff0 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
1c000 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
1c010 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1c020 37 35 39 39 62 34 38 30 31 32 35 64 65 35 32 31  7599b480125de521
1c030 65 66 65 64 37 31 62 35 62 32 34 31 33 63 37 64  efed71b5b2413c7d
1c040 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1c050 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1c060 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1c070 72 74 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20  rt..SELECT CAST 
1c080 28 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29  ( col0 AS REAL )
1c090 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
1c0a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1c0b0 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32  .189..2028..3002
1c0c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1c0d0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1c0e0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1c0f0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1c100 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1c110 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 38 33  owsort label-783
1c120 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 2b  ..SELECT CAST( +
1c130 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
1c140 29 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 37  ) * + col0 + - 7
1c150 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  9 FROM tab1 AS c
1c160 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 35  or0..----..-1..5
1c170 36 31 0d 0a 39 36 31 0d 0a 0d 0a 73 6b 69 70 69  61..961....skipi
1c180 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1c190 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1c1a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1c1b0 37 38 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54  783..SELECT CAST
1c1c0 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e 54   ( + col1 AS INT
1c1d0 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 30 20  EGER ) * + col0 
1c1e0 2b 20 2d 20 37 39 20 46 52 4f 4d 20 74 61 62 31  + - 79 FROM tab1
1c1f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1c200 2d 31 0d 0a 35 36 31 0d 0a 39 36 31 0d 0a 0d 0a  -1..561..961....
1c210 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c220 0a 53 45 4c 45 43 54 20 37 34 20 2b 20 63 6f 6c  .SELECT 74 + col
1c230 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  0 * + cor0.col1 
1c240 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1c250 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 34 0d 0a 31  0..----..1114..1
1c260 35 32 0d 0a 37 31 34 0d 0a 0d 0a 71 75 65 72 79  52..714....query
1c270 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c280 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  CT + col0 + + co
1c290 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63  l0 * - col0 AS c
1c2a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1c2b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
1c2c0 39 30 0d 0a 2d 35 35 32 0d 0a 2d 37 38 33 32 0d  90..-552..-7832.
1c2d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c2e0 72 74 0d 0a 53 45 4c 45 43 54 20 37 33 20 2b 20  rt..SELECT 73 + 
1c2f0 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20  + col2 * col0 + 
1c300 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
1c310 2d 2d 2d 2d 0d 0a 32 31 37 39 0d 0a 32 36 39 0d  ----..2179..269.
1c320 0a 33 31 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .3154....onlyif 
1c330 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1c340 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1c350 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1c360 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1c370 61 62 65 6c 2d 37 38 37 0d 0a 53 45 4c 45 43 54  abel-787..SELECT
1c380 20 63 6f 6c 31 20 2b 20 2b 20 28 20 31 20 29 20   col1 + + ( 1 ) 
1c390 44 49 56 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  DIV + col1 AS co
1c3a0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
1c3b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a  cor0..----..86..
1c3c0 39 31 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66  91..97....skipif
1c3d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1c3e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1c3f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37   rowsort label-7
1c400 38 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  87..SELECT col1 
1c410 2b 20 2b 20 28 20 31 20 29 20 2f 20 2b 20 63 6f  + + ( 1 ) / + co
1c420 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
1c430 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1c440 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a  --..86..91..97..
1c450 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1c460 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1c470 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1c480 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1c490 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1c4a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c4b0 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2b  CT + tab0.col0 +
1c4c0 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
1c4d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d  tab0..----..178.
1c4e0 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79  .48..70....query
1c4f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c500 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a  CT col2 + col0 *
1c510 20 37 34 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   74 AS col1 FROM
1c520 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1c530 2d 2d 2d 0d 0a 32 37 36 0d 0a 34 37 39 33 0d 0a  ---..276..4793..
1c540 36 30 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6016....query I 
1c550 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c560 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
1c570 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  * col2 * - col2 
1c580 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
1c590 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d  0..----..-22599.
1c5a0 0a 2d 32 34 35 34 38 0d 0a 2d 33 39 38 38 34 0d  .-24548..-39884.
1c5b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1c5c0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1c5d0 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2b 20   + col2 + - ( + 
1c5e0 36 39 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  69 ) * col1 FROM
1c5f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1c600 2d 2d 2d 0d 0a 2d 31 38 34 38 0d 0a 2d 37 34 37  ---..-1848..-747
1c610 0d 0a 2d 39 39 33 0d 0a 0d 0a 71 75 65 72 79 20  ..-993....query 
1c620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c630 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 2d  T ALL - col0 * -
1c640 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
1c650 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
1c660 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1c670 0a 2d 2d 2d 2d 0d 0a 34 30 38 39 0d 0a 36 30 0d  .----..4089..60.
1c680 0a 36 34 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .6416....query I
1c690 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c6a0 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20 2d 20 63   tab0.col0 * - c
1c6b0 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20  ol2 * + col1 AS 
1c6c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
1c6d0 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36 36  ----..-3395..-66
1c6e0 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d 0a  4118..-68112....
1c6f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c700 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1c710 6c 31 20 2b 20 2d 20 28 20 2d 20 38 35 20 29 20  l1 + - ( - 85 ) 
1c720 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1c730 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1c740 0a 2d 31 0d 0a 2d 31 32 0d 0a 2d 36 0d 0a 0d 0a  .-1..-12..-6....
1c750 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1c760 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
1c770 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  1 * - cor0.col0 
1c780 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1c790 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
1c7a0 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32  343..-217..-4602
1c7b0 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
1c7c0 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
1c7d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1c7e0 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  * FROM tab1, tab
1c7f0 30 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  0 cor0 CROSS JOI
1c800 4e 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20  N tab0, tab0 AS 
1c810 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20  cor1..----..972 
1c820 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1c830 6f 20 33 34 30 36 34 39 37 33 35 31 65 34 37 38  o 3406497351e478
1c840 39 63 38 39 61 32 39 35 65 65 39 62 36 34 62 32  9c89a295ee9b64b2
1c850 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  01....query I ro
1c860 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 34  wsort..SELECT 64
1c870 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
1c880 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
1c890 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1c8a0 20 36 30 61 62 30 34 30 65 39 33 31 63 35 63 38   60ab040e931c5c8
1c8b0 35 64 62 37 62 61 31 39 33 36 34 65 61 63 63 38  5db7ba19364eacc8
1c8c0 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  e....query I row
1c8d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
1c8e0 61 62 31 2e 63 6f 6c 32 20 2b 20 35 38 20 41 53  ab1.col2 + 58 AS
1c8f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
1c900 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1c910 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
1c920 73 68 69 6e 67 20 74 6f 20 36 33 39 64 30 38 30  shing to 639d080
1c930 37 65 33 63 31 36 31 66 39 34 37 37 63 63 35 33  7e3c161f9477cc53
1c940 31 61 39 61 66 63 31 64 38 0d 0a 0d 0a 71 75 65  1a9afc1d8....que
1c950 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c960 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  LECT - col0 + co
1c970 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 2b 20  l2 * - col2 - + 
1c980 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
1c990 2d 2d 2d 2d 0d 0a 2d 31 35 34 30 0d 0a 2d 37 36  ----..-1540..-76
1c9a0 37 0d 0a 2d 38 31 33 0d 0a 0d 0a 71 75 65 72 79  7..-813....query
1c9b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c9c0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1c9d0 6c 31 20 2a 20 2d 20 32 38 20 46 52 4f 4d 20 74  l1 * - 28 FROM t
1c9e0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 32 0d  ab2..----..1652.
1c9f0 0a 34 37 36 0d 0a 38 36 38 0d 0a 0d 0a 71 75 65  .476..868....que
1ca00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ca10 4c 45 43 54 20 2d 20 28 20 38 35 20 29 20 41 53  LECT - ( 85 ) AS
1ca20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c   col1 FROM tab2,
1ca30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1ca40 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
1ca50 73 68 69 6e 67 20 74 6f 20 38 65 62 63 38 66 66  shing to 8ebc8ff
1ca60 61 66 62 31 35 31 37 65 61 30 34 65 33 61 36 66  afb1517ea04e3a6f
1ca70 63 34 30 35 39 64 38 38 61 0d 0a 0d 0a 71 75 65  c4059d88a....que
1ca80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1ca90 4c 45 43 54 20 63 6f 6c 30 20 2b 20 74 61 62 30  LECT col0 + tab0
1caa0 2e 63 6f 6c 32 20 2a 20 34 37 20 46 52 4f 4d 20  .col2 * 47 FROM 
1cab0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 37 35  tab0..----..1575
1cac0 0d 0a 33 39 34 33 0d 0a 38 32 0d 0a 0d 0a 6f 6e  ..3943..82....on
1cad0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1cae0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1caf0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1cb00 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1cb10 6f 72 74 20 6c 61 62 65 6c 2d 38 30 33 0d 0a 53  ort label-803..S
1cb20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1cb30 20 2b 20 63 6f 6c 31 20 44 49 56 20 28 20 2d 20   + col1 DIV ( - 
1cb40 32 36 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  26 ) FROM tab2 A
1cb50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1cb60 0a 31 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..2....skipif 
1cb70 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1cb80 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1cb90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30  rowsort label-80
1cba0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
1cbb0 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 28 20  CT - + col1 / ( 
1cbc0 2d 20 32 36 20 29 20 46 52 4f 4d 20 74 61 62 32  - 26 ) FROM tab2
1cbd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1cbe0 30 0d 0a 31 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79  0..1..2....query
1cbf0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cc00 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  CT + col0 * - co
1cc10 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  l1 + col1 + + co
1cc20 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
1cc30 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1cc40 2d 2d 0d 0a 2d 34 39 0d 0a 2d 35 36 36 0d 0a 2d  --..-49..-566..-
1cc50 39 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  947....query I r
1cc60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1cc70 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 32 20 29   col2 + ( col2 )
1cc80 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 28 20 2b 20   + + col1 * ( + 
1cc90 32 36 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  26 ) FROM tab1 A
1cca0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  S cor0..----..26
1ccb0 30 0d 0a 33 33 38 0d 0a 36 37 36 0d 0a 0d 0a 71  0..338..676....q
1ccc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ccd0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1cce0 2d 20 2d 20 63 6f 6c 31 20 2a 20 33 30 20 41 53  - - col1 * 30 AS
1ccf0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1cd00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1cd10 37 37 30 0d 0a 35 31 30 0d 0a 39 33 30 0d 0a 0d  770..510..930...
1cd20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cd30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
1cd40 2b 20 33 32 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  + 32 * col2 FROM
1cd50 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 33   tab1..----..103
1cd60 39 36 38 0d 0a 32 39 34 39 31 32 0d 0a 39 33 33  968..294912..933
1cd70 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  12....onlyif mys
1cd80 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1cd90 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1cda0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1cdb0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1cdc0 6c 2d 38 30 38 0d 0a 53 45 4c 45 43 54 20 44 49  l-808..SELECT DI
1cdd0 53 54 49 4e 43 54 20 63 6f 6c 31 20 44 49 56 20  STINCT col1 DIV 
1cde0 37 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  71 FROM tab0..--
1cdf0 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..1....skipif 
1ce00 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1ce10 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1ce20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30  rowsort label-80
1ce30 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  8..SELECT DISTIN
1ce40 43 54 20 63 6f 6c 31 20 2f 20 37 31 20 46 52 4f  CT col1 / 71 FRO
1ce50 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab0..----..1.
1ce60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ce70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1ce80 4e 43 54 20 63 6f 6c 32 20 2b 20 28 20 2b 20 63  NCT col2 + ( + c
1ce90 6f 6c 30 20 29 20 2a 20 63 6f 6c 30 20 41 53 20  ol0 ) * col0 AS 
1cea0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
1ceb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1cec0 32 36 0d 0a 36 30 39 0d 0a 38 30 30 33 0d 0a 0d  26..609..8003...
1ced0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1cee0 0d 0a 53 45 4c 45 43 54 20 2b 20 31 34 20 2b 20  ..SELECT + 14 + 
1cef0 2b 20 36 38 20 2a 20 2b 20 63 6f 6c 32 20 46 52  + 68 * + col2 FR
1cf00 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1cf10 0a 2d 2d 2d 2d 0d 0a 33 36 38 36 0d 0a 33 38 39  .----..3686..389
1cf20 30 0d 0a 36 35 34 32 0d 0a 0d 0a 71 75 65 72 79  0..6542....query
1cf30 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1cf40 43 54 20 28 20 2d 20 32 38 20 2b 20 2d 20 63 6f  CT ( - 28 + - co
1cf50 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a  l0 ) FROM tab0..
1cf60 2d 2d 2d 2d 0d 0a 2d 31 31 37 0d 0a 2d 35 32 0d  ----..-117..-52.
1cf70 0a 2d 36 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-63....query I 
1cf80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cf90 2b 20 2b 20 33 32 20 2a 20 63 6f 6c 32 20 46 52  + + 32 * col2 FR
1cfa0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1cfb0 2d 2d 0d 0a 31 32 31 36 0d 0a 38 33 32 0d 0a 38  --..1216..832..8
1cfc0 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
1cfd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1cfe0 53 54 49 4e 43 54 20 2b 20 2b 20 28 20 2d 20 63  STINCT + + ( - c
1cff0 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol2 ) AS col0 FR
1d000 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1d010 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d  .----..-26..-27.
1d020 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-38....query I 
1d030 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d040 2b 20 2b 20 37 20 2a 20 2d 20 63 6f 6c 30 20 46  + + 7 * - col0 F
1d050 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1d060 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 34 34  ..----..-21..-44
1d070 38 0d 0a 2d 35 36 30 0d 0a 0d 0a 71 75 65 72 79  8..-560....query
1d080 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d090 43 54 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20  CT - + ( col1 ) 
1d0a0 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  * col2 * + col1 
1d0b0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1d0c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 32 34 0d  0..----..-16224.
1d0d0 0a 2d 33 36 35 30 34 0d 0a 2d 35 37 30 30 0d 0a  .-36504..-5700..
1d0e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d0f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 31  t..SELECT - tab1
1d100 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2d 20 63  .col1 * col2 - c
1d110 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
1d120 2d 2d 2d 0d 0a 2d 31 33 34 34 0d 0a 2d 31 34 35  ---..-1344..-145
1d130 38 0d 0a 2d 36 32 37 0d 0a 0d 0a 71 75 65 72 79  8..-627....query
1d140 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d150 43 54 20 41 4c 4c 20 35 34 20 41 53 20 63 6f 6c  CT ALL 54 AS col
1d160 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
1d170 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  2, tab2 AS cor0.
1d180 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
1d190 20 68 61 73 68 69 6e 67 20 74 6f 20 38 31 31 35   hashing to 8115
1d1a0 30 64 35 39 64 36 63 33 66 63 34 38 62 34 65 66  0d59d6c3fc48b4ef
1d1b0 35 61 34 61 35 34 39 35 62 63 37 61 0d 0a 0d 0a  5a4a5495bc7a....
1d1c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d1d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
1d1e0 63 6f 6c 31 20 29 20 2b 20 2b 20 74 61 62 31 2e  col1 ) + + tab1.
1d1f0 63 6f 6c 30 20 2a 20 2d 20 39 39 20 46 52 4f 4d  col0 * - 99 FROM
1d200 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32   tab1..----..-32
1d210 33 0d 0a 2d 36 33 34 36 0d 0a 2d 37 39 33 33 0d  3..-6346..-7933.
1d220 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1d230 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1d240 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1d250 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1d260 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1d270 31 39 0d 0a 53 45 4c 45 43 54 20 2b 20 33 32 20  19..SELECT + 32 
1d280 44 49 56 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  DIV - col2 AS co
1d290 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
1d2a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d  cor0..----..-32.
1d2b0 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
1d2c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1d2d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1d2e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31  rowsort label-81
1d2f0 39 0d 0a 53 45 4c 45 43 54 20 2b 20 33 32 20 2f  9..SELECT + 32 /
1d300 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
1d310 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d320 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a 30 0d  0..----..-32..0.
1d330 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1d340 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1d350 2d 20 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  - 1 * + col1 + c
1d360 6f 6c 31 20 2b 20 32 32 20 41 53 20 63 6f 6c 32  ol1 + 22 AS col2
1d370 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d380 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 32 0d 0a 34 38  r0..----..42..48
1d390 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..74....query I 
1d3a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1d3b0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
1d3c0 63 6f 6c 32 20 2a 20 2d 20 28 20 63 6f 6c 31 20  col2 * - ( col1 
1d3d0 29 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  ) * col1 + col0 
1d3e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d3f0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 39 32 0d  0..----..244092.
1d400 0a 36 37 39 31 33 31 0d 0a 39 34 34 34 0d 0a 0d  .679131..9444...
1d410 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d420 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1d430 54 20 38 34 20 2b 20 37 31 20 2a 20 2d 20 63 6f  T 84 + 71 * - co
1d440 72 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  r2.col1 AS col2 
1d450 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
1d460 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f  AS cor0, tab1 co
1d470 72 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32  r1, tab0 AS cor2
1d480 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 30 32 32 0d 0a 2d  ..----..-6022..-
1d490 36 33 37 37 0d 0a 2d 36 38 30 33 0d 0a 0d 0a 6f  6377..-6803....o
1d4a0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1d4b0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1d4c0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1d4d0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1d4e0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 33 0d 0a  sort label-823..
1d4f0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 44 49  SELECT - col0 DI
1d500 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52  V col1 + col2 FR
1d510 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1d520 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32  .----..1..33..82
1d530 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1d540 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1d550 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1d560 72 74 20 6c 61 62 65 6c 2d 38 32 33 0d 0a 53 45  rt label-823..SE
1d570 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f 20 63 6f  LECT - col0 / co
1d580 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 + col2 FROM t
1d590 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1d5a0 2d 0d 0a 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a  -..1..33..82....
1d5b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d5c0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 31 2e 63  .SELECT - cor1.c
1d5d0 6f 6c 31 20 2a 20 34 36 20 46 52 4f 4d 20 74 61  ol1 * 46 FROM ta
1d5e0 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b0, tab1 AS cor0
1d5f0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  , tab0 AS cor1..
1d600 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
1d610 68 61 73 68 69 6e 67 20 74 6f 20 36 61 38 36 39  hashing to 6a869
1d620 63 30 65 64 39 64 63 39 32 37 39 63 65 61 64 63  c0ed9dc9279ceadc
1d630 62 64 64 39 32 36 33 66 35 32 30 0d 0a 0d 0a 6f  bdd9263f520....o
1d640 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
1d650 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
1d660 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
1d670 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
1d680 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 35 0d 0a  sort label-825..
1d690 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1d6a0 2d 20 2b 20 39 37 20 44 49 56 20 63 6f 72 30 2e  - + 97 DIV cor0.
1d6b0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
1d6c0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1d6d0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 32 0d 0a 0d  ----..-1..-32...
1d6e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1d6f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1d700 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1d710 6c 61 62 65 6c 2d 38 32 35 0d 0a 53 45 4c 45 43  label-825..SELEC
1d720 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 39  T DISTINCT - + 9
1d730 37 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  7 / cor0.col0 AS
1d740 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1d750 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1d760 31 0d 0a 2d 33 32 0d 0a 0d 0a 71 75 65 72 79 20  1..-32....query 
1d770 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d780 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  T col2 + + col1 
1d790 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
1d7a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1d7b0 2d 2d 2d 0d 0a 31 35 36 30 0d 0a 36 38 34 0d 0a  ---..1560..684..
1d7c0 38 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  864....query I r
1d7d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d7e0 4c 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20  LL + + col0 * + 
1d7f0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 28 20 63 6f  cor0.col0 + ( co
1d800 72 30 2e 63 6f 6c 30 20 29 20 2a 20 63 6f 72 30  r0.col0 ) * cor0
1d810 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
1d820 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d830 0a 2d 2d 2d 2d 0d 0a 31 32 38 30 30 0d 0a 31 38  .----..12800..18
1d840 0d 0a 38 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20  ..8192....query 
1d850 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d860 54 20 41 4c 4c 20 2b 20 36 39 20 2a 20 33 35 20  T ALL + 69 * 35 
1d870 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
1d880 0a 32 34 31 35 0d 0a 32 34 31 35 0d 0a 32 34 31  .2415..2415..241
1d890 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  5....skipif post
1d8a0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
1d8b0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
1d8c0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
1d8d0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
1d8e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d8f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1d900 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 72   cor0.col1 + cor
1d910 30 2e 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d  0.col2 col2 FROM
1d920 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1d930 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
1d940 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
1d950 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1d960 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1d970 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1d980 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1d990 2d 38 33 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -830..SELECT DIS
1d9a0 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 44 49 56  TINCT - col0 DIV
1d9b0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
1d9c0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1d9d0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ----..-1....skip
1d9e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1d9f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1da00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1da10 2d 38 33 30 0d 0a 53 45 4c 45 43 54 20 44 49 53  -830..SELECT DIS
1da20 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2f 20 2b  TINCT - col0 / +
1da30 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
1da40 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1da50 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  --..-1....query 
1da60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1da70 54 20 41 4c 4c 20 2b 20 28 20 2b 20 63 6f 72 30  T ALL + ( + cor0
1da80 2e 63 6f 6c 32 20 29 20 2b 20 2b 20 35 31 20 46  .col2 ) + + 51 F
1da90 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
1daa0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 0d 0a 31 30 38  ..----..105..108
1dab0 0d 0a 31 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..147....query I
1dac0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1dad0 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 32 32   DISTINCT - - 22
1dae0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1daf0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1db00 0d 0a 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..22....query I 
1db10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1db20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2b  + + col1 + - ( +
1db30 20 35 33 20 29 20 46 52 4f 4d 20 74 61 62 30 20   53 ) FROM tab0 
1db40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
1db50 33 0d 0a 33 38 0d 0a 34 34 0d 0a 0d 0a 71 75 65  3..38..44....que
1db60 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1db70 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20  LECT + + col1 + 
1db80 38 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  85 FROM tab2 AS 
1db90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d  cor0..----..102.
1dba0 0a 31 31 36 0d 0a 31 34 34 0d 0a 0d 0a 71 75 65  .116..144....que
1dbb0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1dbc0 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  LECT col2 + col0
1dbd0 20 2a 20 35 35 20 41 53 20 63 6f 6c 30 20 46 52   * 55 AS col0 FR
1dbe0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1dbf0 0a 2d 2d 2d 2d 0d 0a 31 33 35 33 0d 0a 31 39 32  .----..1353..192
1dc00 36 0d 0a 34 39 37 37 0d 0a 0d 0a 6f 6e 6c 79 69  6..4977....onlyi
1dc10 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1dc20 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1dc30 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1dc40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dc50 20 6c 61 62 65 6c 2d 38 33 36 0d 0a 53 45 4c 45   label-836..SELE
1dc60 43 54 20 63 6f 6c 30 20 44 49 56 20 36 33 20 2b  CT col0 DIV 63 +
1dc70 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46   - col1 * col2 F
1dc80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1dc90 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 33 0d 0a 2d  ..----..-1533..-
1dca0 36 34 35 0d 0a 2d 38 33 37 0d 0a 0d 0a 73 6b 69  645..-837....ski
1dcb0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1dcc0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1dcd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1dce0 6c 2d 38 33 36 0d 0a 53 45 4c 45 43 54 20 63 6f  l-836..SELECT co
1dcf0 6c 30 20 2f 20 36 33 20 2b 20 2d 20 63 6f 6c 31  l0 / 63 + - col1
1dd00 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
1dd10 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1dd20 0a 2d 31 35 33 33 0d 0a 2d 36 34 35 0d 0a 2d 38  .-1533..-645..-8
1dd30 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
1dd40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1dd50 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20  STINCT + + col0 
1dd60 2a 20 32 30 20 46 52 4f 4d 20 74 61 62 31 20 63  * 20 FROM tab1 c
1dd70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 30 0d  or0..----..1280.
1dd80 0a 31 36 30 30 0d 0a 36 30 0d 0a 0d 0a 71 75 65  .1600..60....que
1dd90 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1dda0 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2d 20  LECT + - col2 - 
1ddb0 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  - col1 * col1 FR
1ddc0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1ddd0 0a 2d 2d 2d 2d 0d 0a 37 33 36 33 0d 0a 38 31 39  .----..7363..819
1dde0 39 0d 0a 39 34 30 38 0d 0a 0d 0a 6f 6e 6c 79 69  9..9408....onlyi
1ddf0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1de00 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1de10 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1de20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1de30 20 6c 61 62 65 6c 2d 38 33 39 0d 0a 53 45 4c 45   label-839..SELE
1de40 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e  CT ALL - - cor0.
1de50 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 46 52  col1 DIV col1 FR
1de60 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1de70 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
1de80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1de90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1dea0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1deb0 20 6c 61 62 65 6c 2d 38 33 39 0d 0a 53 45 4c 45   label-839..SELE
1dec0 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30 2e  CT ALL - - cor0.
1ded0 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col1 / col1 FROM
1dee0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1def0 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
1df00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1df10 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61  .SELECT ALL + ta
1df20 62 32 2e 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b  b2.col2 * col2 +
1df30 20 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29   ( col0 * col1 )
1df40 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1df50 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 37 38 37 0d 0a  b2..----..2787..
1df60 35 32 37 38 0d 0a 39 34 36 0d 0a 0d 0a 71 75 65  5278..946....que
1df70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1df80 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
1df90 20 2a 20 2b 20 34 36 20 46 52 4f 4d 20 74 61 62   * + 46 FROM tab
1dfa0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1dfb0 0a 33 32 32 0d 0a 33 35 38 38 0d 0a 33 36 33 34  .322..3588..3634
1dfc0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1dfd0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
1dfe0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
1dff0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
1e000 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1e010 38 34 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  842..SELECT DIST
1e020 49 4e 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20  INCT + col0 DIV 
1e030 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 41 53  + col1 - col1 AS
1e040 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
1e050 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1e060 32 36 0d 0a 2d 34 0d 0a 2d 37 0d 0a 0d 0a 73 6b  26..-4..-7....sk
1e070 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
1e080 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1e090 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e0a0 65 6c 2d 38 34 32 0d 0a 53 45 4c 45 43 54 20 44  el-842..SELECT D
1e0b0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2f  ISTINCT + col0 /
1e0c0 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 41   + col1 - col1 A
1e0d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
1e0e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e0f0 2d 32 36 0d 0a 2d 34 0d 0a 2d 37 0d 0a 0d 0a 71  -26..-4..-7....q
1e100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e110 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e  SELECT - - cor0.
1e120 63 6f 6c 31 20 2d 20 28 20 2d 20 63 6f 6c 32 20  col1 - ( - col2 
1e130 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
1e140 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a  or0..----..119..
1e150 31 37 33 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69  173..98....skipi
1e160 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
1e170 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
1e180 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
1e190 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
1e1a0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
1e1b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1e1c0 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 35 38  INCT col2 * + 58
1e1d0 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   + col1 col0 FRO
1e1e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e1f0 2d 2d 2d 2d 0d 0a 31 35 36 37 0d 0a 31 35 39 37  ----..1567..1597
1e200 0d 0a 32 32 32 31 0d 0a 0d 0a 71 75 65 72 79 20  ..2221....query 
1e210 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e220 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
1e230 32 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  2 + col2 * col0 
1e240 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1e250 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37  0..----..216..37
1e260 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71 75 65 72  05..7776....quer
1e270 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e280 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  ECT cor0.col0 + 
1e290 2d 20 36 36 20 2a 20 63 6f 6c 32 20 2a 20 2b 20  - 66 * col2 * + 
1e2a0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col0 + - col1 * 
1e2b0 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
1e2c0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
1e2d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 37 32  or0..----..-2372
1e2e0 0d 0a 2d 34 38 39 30 34 31 0d 0a 2d 35 35 30 38  ..-489041..-5508
1e2f0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1e300 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1e310 54 49 4e 43 54 20 28 20 2b 20 63 6f 72 30 2e 63  TINCT ( + cor0.c
1e320 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 32 2c  ol1 ) FROM tab2,
1e330 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
1e340 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a  ..17..31..59....
1e350 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e360 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39 31  .SELECT ALL - 91
1e370 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31   FROM tab0, tab1
1e380 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1e390 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
1e3a0 20 74 6f 20 37 34 35 64 31 63 33 61 30 39 64 39   to 745d1c3a09d9
1e3b0 33 35 34 36 35 63 61 64 35 35 32 33 32 35 63 35  35465cad552325c5
1e3c0 63 39 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  c945....query I 
1e3d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e3e0 44 49 53 54 49 4e 43 54 20 2d 20 34 39 20 46 52  DISTINCT - 49 FR
1e3f0 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41 53  OM tab1, tab1 AS
1e400 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31   cor0, tab1 cor1
1e410 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39 0d 0a 0d 0a 71  ..----..-49....q
1e420 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1e430 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1e440 31 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 37  1 * - col1 + - 7
1e450 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  6 AS col2 FROM t
1e460 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 36  ab1..----..24..6
1e470 30 30 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  00..93....onlyif
1e480 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
1e490 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
1e4a0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
1e4b0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
1e4c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1e4d0 65 6c 2d 38 35 31 0d 0a 53 45 4c 45 43 54 20 41  el-851..SELECT A
1e4e0 4c 4c 20 74 61 62 31 2e 63 6f 6c 32 20 2f 20 63  LL tab1.col2 / c
1e4f0 6f 6c 30 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 38  ol0 + col2 / - 8
1e500 34 20 2b 20 63 6f 6c 32 20 2a 20 43 41 53 54 28  4 + col2 * CAST(
1e510 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
1e520 29 20 2f 20 28 20 2d 20 63 6f 6c 32 20 29 20 46  ) / ( - col2 ) F
1e530 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1e540 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
1e550 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1e560 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1e570 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1e580 72 74 20 6c 61 62 65 6c 2d 38 35 31 0d 0a 53 45  rt label-851..SE
1e590 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f  LECT ALL tab1.co
1e5a0 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  l2 / col0 + col2
1e5b0 20 2f 20 2d 20 38 34 20 2b 20 63 6f 6c 32 20 2a   / - 84 + col2 *
1e5c0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
1e5d0 49 4e 54 45 47 45 52 20 29 20 2f 20 28 20 2d 20  INTEGER ) / ( - 
1e5e0 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31  col2 ) FROM tab1
1e5f0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1e600 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
1e610 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e620 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 30  ECT ALL + ( col0
1e630 20 29 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   ) * col2 + + co
1e640 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 31 33  l0 * - col2 + 13
1e650 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1e660 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31 33  b2..----..13..13
1e670 0d 0a 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..13....query I 
1e680 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e690 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
1e6a0 30 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 36 35 20  0 * + col2 + 65 
1e6b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1e6c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1e6d0 0a 32 30 39 33 0d 0a 32 35 34 0d 0a 33 30 36 37  .2093..254..3067
1e6e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1e6f0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1e700 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1e710 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1e720 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1e730 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1e740 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
1e750 2a 20 2d 20 63 6f 6c 31 20 2d 20 35 33 20 63 6f  * - col1 - 53 co
1e760 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1e770 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31  cor0..----..-101
1e780 34 0d 0a 2d 33 34 32 0d 0a 2d 33 35 33 34 0d 0a  4..-342..-3534..
1e790 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e7a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1e7b0 43 54 20 2b 20 63 6f 6c 32 20 2a 20 39 20 46 52  CT + col2 * 9 FR
1e7c0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1e7d0 0a 2d 2d 2d 2d 0d 0a 32 33 34 0d 0a 32 34 33 0d  .----..234..243.
1e7e0 0a 33 34 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .342....skipif p
1e7f0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
1e800 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
1e810 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
1e820 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
1e830 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e840 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1e850 54 20 2b 20 63 6f 6c 30 20 2b 20 28 20 63 6f 6c  T + col0 + ( col
1e860 32 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  2 ) col2 FROM ta
1e870 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1e880 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d  ..171..36..57...
1e890 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e8a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1e8b0 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c 32 20  or0.col0 - col2 
1e8c0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1e8d0 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a  ----..-16..-51..
1e8e0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
1e8f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
1e900 6f 6c 31 20 2a 20 2b 20 28 20 2b 20 38 35 20 29  ol1 * + ( + 85 )
1e910 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   + + col1 FROM t
1e920 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1e930 2d 0d 0a 31 34 36 32 0d 0a 32 36 36 36 0d 0a 35  -..1462..2666..5
1e940 30 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  074....query I r
1e950 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e960 20 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 2a   col0 - + col1 *
1e970 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
1e980 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 32 0d 0a 2d 37  .----..-1612..-7
1e990 32 35 0d 0a 2d 38 34 34 0d 0a 0d 0a 71 75 65 72  25..-844....quer
1e9a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1e9b0 45 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20  ECT tab0.col2 * 
1e9c0 63 6f 6c 30 20 2b 20 2d 20 36 35 20 46 52 4f 4d  col0 + - 65 FROM
1e9d0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30   tab0..----..-30
1e9e0 0d 0a 37 32 33 33 0d 0a 37 32 37 0d 0a 0d 0a 71  ..7233..727....q
1e9f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ea00 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1ea10 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20  col2 * col2 + - 
1ea20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
1ea30 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 31 30 30 33 0d  ----..-96..1003.
1ea40 0a 36 36 33 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .6633....onlyif 
1ea50 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1ea60 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1ea70 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1ea80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1ea90 61 62 65 6c 2d 38 36 32 0d 0a 53 45 4c 45 43 54  abel-862..SELECT
1eaa0 20 41 4c 4c 20 38 33 20 2b 20 63 6f 6c 31 20 2a   ALL 83 + col1 *
1eab0 20 28 20 63 6f 6c 31 20 29 20 44 49 56 20 2b 20   ( col1 ) DIV + 
1eac0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
1ead0 2d 2d 2d 2d 0d 0a 31 38 33 0d 0a 33 30 37 0d 0a  ----..183..307..
1eae0 39 34 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  9492....skipif m
1eaf0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1eb00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1eb10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 32  owsort label-862
1eb20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 38 33 20  ..SELECT ALL 83 
1eb30 2b 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 31 20  + col1 * ( col1 
1eb40 29 20 2f 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ) / + col2 FROM 
1eb50 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33 0d  tab0..----..183.
1eb60 0a 33 30 37 0d 0a 39 34 39 32 0d 0a 0d 0a 71 75  .307..9492....qu
1eb70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1eb80 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1eb90 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2d 20 63  ol0 * - col2 - c
1eba0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
1ebb0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1ebc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 0d 0a  r0..----..-216..
1ebd0 2d 33 37 30 35 0d 0a 2d 37 37 37 36 0d 0a 0d 0a  -3705..-7776....
1ebe0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1ebf0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1ec00 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1ec10 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1ec20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 36 34 0d  wsort label-864.
1ec30 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 30  .SELECT - - col0
1ec40 20 2b 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f   + + col0 DIV co
1ec50 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
1ec60 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1ec70 2d 2d 0d 0a 37 0d 0a 37 39 0d 0a 38 33 0d 0a 0d  --..7..79..83...
1ec80 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1ec90 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1eca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1ecb0 6c 61 62 65 6c 2d 38 36 34 0d 0a 53 45 4c 45 43  label-864..SELEC
1ecc0 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63  T - - col0 + + c
1ecd0 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 / col1 AS co
1ece0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1ecf0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37  cor0..----..7..7
1ed00 39 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  9..83....skipif 
1ed10 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
1ed20 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
1ed30 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
1ed40 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
1ed50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1ed60 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1ed70 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f  CT + - col0 + co
1ed80 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
1ed90 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1eda0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1edb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1edc0 63 6f 6c 30 20 2b 20 2b 20 37 37 20 41 53 20 63  col0 + + 77 AS c
1edd0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
1ede0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
1edf0 0a 2d 32 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79 69  .-2..70....onlyi
1ee00 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1ee10 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1ee20 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1ee30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ee40 20 6c 61 62 65 6c 2d 38 36 37 0d 0a 53 45 4c 45   label-867..SELE
1ee50 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
1ee60 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2d 20  - col1 * col0 - 
1ee70 63 6f 6c 32 20 44 49 56 20 2b 20 28 20 2d 20 63  col2 DIV + ( - c
1ee80 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol1 ) FROM tab1 
1ee90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1eea0 31 31 32 39 0d 0a 2d 31 33 30 0d 0a 2d 36 39 32  1129..-130..-692
1eeb0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1eec0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1eed0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1eee0 72 74 20 6c 61 62 65 6c 2d 38 36 37 0d 0a 53 45  rt label-867..SE
1eef0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
1ef00 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  + - col1 * col0 
1ef10 2d 20 63 6f 6c 32 20 2f 20 2b 20 28 20 2d 20 63  - col2 / + ( - c
1ef20 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 20  ol1 ) FROM tab1 
1ef30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1ef40 31 31 32 39 0d 0a 2d 31 33 30 0d 0a 2d 36 39 32  1129..-130..-692
1ef50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ef60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1ef70 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 31 31  INCT - col1 + 11
1ef80 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
1ef90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1efa0 0a 36 39 34 0d 0a 37 0d 0a 38 36 37 0d 0a 0d 0a  .694..7..867....
1efb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1efc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1efd0 20 63 6f 6c 30 20 2a 20 2b 20 34 36 20 2a 20 2d   col0 * + 46 * -
1efe0 20 36 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   67 AS col2 FROM
1eff0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1f000 2d 2d 2d 0d 0a 2d 32 31 35 37 34 0d 0a 2d 32 34  ---..-21574..-24
1f010 30 33 39 36 0d 0a 2d 32 34 33 34 37 38 0d 0a 0d  0396..-243478...
1f020 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f030 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f040 54 20 28 20 2d 20 34 30 20 2a 20 2d 20 63 6f 6c  T ( - 40 * - col
1f050 30 20 29 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20  0 ) + tab2.col1 
1f060 2a 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 2b 20  * tab2.col1 * + 
1f070 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
1f080 2d 2d 2d 2d 0d 0a 32 30 38 34 39 39 0d 0a 33 30  ----..208499..30
1f090 30 37 31 0d 0a 38 30 37 33 0d 0a 0d 0a 71 75 65  071..8073....que
1f0a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f0b0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  LECT + col1 * - 
1f0c0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
1f0d0 6c 32 20 2b 20 34 20 41 53 20 63 6f 6c 31 20 46  l2 + 4 AS col1 F
1f0e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1f0f0 0d 0a 2d 2d 2d 2d 0d 0a 32 34 34 30 37 32 0d 0a  ..----..244072..
1f100 36 37 39 30 34 36 0d 0a 39 34 31 33 0d 0a 0d 0a  679046..9413....
1f110 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f120 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1f130 20 38 34 20 2b 20 2b 20 38 31 20 2a 20 2d 20 63   84 + + 81 * - c
1f140 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
1f150 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1f160 2d 2d 2d 0d 0a 2d 31 35 39 0d 0a 2d 35 31 30 30  ---..-159..-5100
1f170 0d 0a 2d 36 33 39 36 0d 0a 0d 0a 71 75 65 72 79  ..-6396....query
1f180 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f190 43 54 20 38 30 20 2a 20 28 20 2b 20 63 6f 6c 30  CT 80 * ( + col0
1f1a0 20 29 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d   ) + + col2 FROM
1f1b0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1f1c0 0d 0a 31 39 35 33 0d 0a 32 38 30 31 0d 0a 37 32  ..1953..2801..72
1f1d0 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
1f1e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1f1f0 2b 20 63 6f 6c 30 20 2a 20 2d 20 38 39 20 2a 20  + col0 * - 89 * 
1f200 2b 20 63 6f 6c 32 20 2b 20 2d 20 28 20 2b 20 35  + col2 + - ( + 5
1f210 34 20 29 20 2a 20 63 6f 6c 31 20 2a 20 2d 20 63  4 ) * col1 * - c
1f220 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1f230 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 36   cor0..----..186
1f240 33 30 0d 0a 33 35 39 32 33 32 0d 0a 37 33 39 36  30..359232..7396
1f250 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
1f260 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1f270 4c 20 2b 20 36 38 20 2a 20 2b 20 63 6f 6c 30 20  L + 68 * + col0 
1f280 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
1f290 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f2a0 32 35 38 0d 0a 34 34 30 39 0d 0a 35 35 33 36 0d  258..4409..5536.
1f2b0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1f2c0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1f2d0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1f2e0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1f2f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1f300 37 36 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  76..SELECT - - c
1f310 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 31 20 2b  ol1 DIV + col1 +
1f320 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
1f330 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1f340 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 73 6b 69  1..14..27....ski
1f350 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1f360 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1f370 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1f380 6c 2d 38 37 36 0d 0a 53 45 4c 45 43 54 20 2d 20  l-876..SELECT - 
1f390 2d 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 31 20  - col1 / + col1 
1f3a0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  + col1 FROM tab1
1f3b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f3c0 31 31 0d 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 6f 6e  11..14..27....on
1f3d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1f3e0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1f3f0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1f400 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1f410 6f 72 74 20 6c 61 62 65 6c 2d 38 37 37 0d 0a 53  ort label-877..S
1f420 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
1f430 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 36   cor0.col0 ) + 6
1f440 39 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f  9 DIV - col0 FRO
1f450 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1f460 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 36 33 0d 0a 38  ----..-20..63..8
1f470 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
1f480 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1f490 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1f4a0 6f 72 74 20 6c 61 62 65 6c 2d 38 37 37 0d 0a 53  ort label-877..S
1f4b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
1f4c0 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b 20 36   cor0.col0 ) + 6
1f4d0 39 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  9 / - col0 FROM 
1f4e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1f4f0 2d 2d 0d 0a 2d 32 30 0d 0a 36 33 0d 0a 38 30 0d  --..-20..63..80.
1f500 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1f510 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
1f520 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41 53  col1 * + col2 AS
1f530 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
1f540 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38  cor0..----..2838
1f550 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 6f 6e  ..7462..97....on
1f560 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1f570 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1f580 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1f590 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1f5a0 6f 72 74 20 6c 61 62 65 6c 2d 38 37 39 0d 0a 53  ort label-879..S
1f5b0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
1f5c0 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 46 52 4f  ol0 DIV col1 FRO
1f5d0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1f5e0 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d 0a 0d  ----..0..1..4...
1f5f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
1f600 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
1f610 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1f620 6c 61 62 65 6c 2d 38 37 39 0d 0a 53 45 4c 45 43  label-879..SELEC
1f630 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20  T ALL cor0.col0 
1f640 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  / col1 FROM tab2
1f650 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1f660 30 0d 0a 31 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  0..1..4....query
1f670 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f680 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 36 37  CT DISTINCT - 67
1f690 20 2a 20 38 34 20 41 53 20 63 6f 6c 30 20 46 52   * 84 AS col0 FR
1f6a0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
1f6b0 35 36 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5628....query I 
1f6c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f6d0 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29  ALL - ( + col2 )
1f6e0 20 2a 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30   * col1 - + col0
1f6f0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1f700 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 38 0d  b1..----..-1328.
1f710 0a 2d 31 34 30 37 0d 0a 2d 36 33 34 0d 0a 0d 0a  .-1407..-634....
1f720 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f730 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63  .SELECT col2 * c
1f740 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29  ol1 + ( + col2 )
1f750 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1f760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 34 0d 0a  r0..----..1344..
1f770 31 34 35 38 0d 0a 36 32 37 0d 0a 0d 0a 71 75 65  1458..627....que
1f780 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f790 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20  LECT ALL col2 * 
1f7a0 2d 20 63 6f 6c 30 20 2b 20 2d 20 28 20 2b 20 63  - col0 + - ( + c
1f7b0 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol2 ) AS col0 FR
1f7c0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
1f7d0 2d 2d 0d 0a 2d 33 36 0d 0a 2d 37 33 38 30 0d 0a  --..-36..-7380..
1f7e0 2d 38 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -825....query I 
1f7f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f800 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 30  cor0.col1 * col0
1f810 20 2d 20 31 30 20 41 53 20 63 6f 6c 32 20 46 52   - 10 AS col2 FR
1f820 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f830 0a 2d 2d 2d 2d 0d 0a 31 33 33 33 0d 0a 32 30 37  .----..1333..207
1f840 0d 0a 34 35 39 32 0d 0a 0d 0a 71 75 65 72 79 20  ..4592....query 
1f850 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f860 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 63 6f 72  T ALL col2 + cor
1f870 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  0.col0 AS col0 F
1f880 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1f890 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d  ..----..171..36.
1f8a0 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .57....query I r
1f8b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1f8c0 4c 4c 20 2b 20 34 38 20 2b 20 2b 20 63 6f 6c 32  LL + 48 + + col2
1f8d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1f8e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 0d 0a 31  r0..----..102..1
1f8f0 30 35 0d 0a 31 34 34 0d 0a 0d 0a 6f 6e 6c 79 69  05..144....onlyi
1f900 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1f910 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1f920 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1f930 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1f940 20 6c 61 62 65 6c 2d 38 38 37 0d 0a 53 45 4c 45   label-887..SELE
1f950 43 54 20 2b 20 33 33 20 44 49 56 20 37 20 41 53  CT + 33 DIV 7 AS
1f960 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
1f970 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
1f980 49 4e 20 74 61 62 32 20 63 6f 72 31 0d 0a 2d 2d  IN tab2 cor1..--
1f990 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
1f9a0 68 69 6e 67 20 74 6f 20 36 66 65 63 39 36 35 62  hing to 6fec965b
1f9b0 36 30 62 39 38 38 35 63 34 61 66 37 33 65 38 35  60b9885c4af73e85
1f9c0 34 32 32 63 66 64 39 62 0d 0a 0d 0a 73 6b 69 70  422cfd9b....skip
1f9d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1f9e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1f9f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1fa00 2d 38 38 37 0d 0a 53 45 4c 45 43 54 20 2b 20 33  -887..SELECT + 3
1fa10 33 20 2f 20 37 20 41 53 20 63 6f 6c 30 20 46 52  3 / 7 AS col0 FR
1fa20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
1fa30 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
1fa40 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
1fa50 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
1fa60 36 66 65 63 39 36 35 62 36 30 62 39 38 38 35 63  6fec965b60b9885c
1fa70 34 61 66 37 33 65 38 35 34 32 32 63 66 64 39 62  4af73e85422cfd9b
1fa80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1fa90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
1faa0 63 6f 6c 31 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  col1 - col1 FROM
1fab0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1fac0 0d 0a 2d 31 37 32 0d 0a 2d 31 38 32 0d 0a 2d 31  ..-172..-182..-1
1fad0 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
1fae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1faf0 37 37 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  77 * - cor0.col2
1fb00 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + - cor0.col1 *
1fb10 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
1fb20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1fb30 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 34 39 0d 0a  0..----..-3749..
1fb40 2d 34 30 38 30 0d 0a 2d 36 33 35 32 0d 0a 0d 0a  -4080..-6352....
1fb50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1fb60 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63  .SELECT col2 * c
1fb70 6f 72 30 2e 63 6f 6c 30 20 2b 20 37 38 20 2a 20  or0.col0 + 78 * 
1fb80 38 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  81 * col1 FROM t
1fb90 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1fba0 2d 0d 0a 35 34 34 31 34 30 0d 0a 35 38 32 32 33  -..544140..58223
1fbb0 36 0d 0a 36 31 32 38 38 31 0d 0a 0d 0a 73 6b 69  6..612881....ski
1fbc0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
1fbd0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
1fbe0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
1fbf0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
1fc00 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
1fc10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1fc20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  - col0 * - col0 
1fc30 2d 20 34 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74  - 46 col2 FROM t
1fc40 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1fc50 2d 0d 0a 31 31 37 39 0d 0a 35 33 30 0d 0a 37 38  -..1179..530..78
1fc60 37 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  75....onlyif mys
1fc70 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1fc80 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1fc90 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1fca0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1fcb0 6c 2d 38 39 32 0d 0a 53 45 4c 45 43 54 20 2d 20  l-892..SELECT - 
1fcc0 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f 6c 31 20  col1 DIV - col1 
1fcd0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
1fce0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
1fcf0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a  ..----..27..28..
1fd00 33 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  39....skipif mys
1fd10 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1fd20 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1fd30 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 32 0d 0a  sort label-892..
1fd40 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
1fd50 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53  - col1 + col2 AS
1fd60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1fd70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1fd80 37 0d 0a 32 38 0d 0a 33 39 0d 0a 0d 0a 6f 6e 6c  7..28..39....onl
1fd90 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
1fda0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
1fdb0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
1fdc0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
1fdd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
1fde0 6c 61 62 65 6c 2d 38 39 33 0d 0a 53 45 4c 45 43  label-893..SELEC
1fdf0 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d 20 43  T + - col0 + - C
1fe00 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
1fe10 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2a  NED ) * + col1 *
1fe20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
1fe30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
1fe40 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
1fe50 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
1fe60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
1fe70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1fe80 74 20 6c 61 62 65 6c 2d 38 39 33 0d 0a 53 45 4c  t label-893..SEL
1fe90 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d  ECT + - col0 + -
1fea0 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
1feb0 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f  INTEGER ) * + co
1fec0 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
1fed0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1fee0 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
1fef0 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ULL....query I r
1ff00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1ff10 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  ol0 + col2 * - c
1ff20 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 * + col1 FRO
1ff30 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
1ff40 34 34 30 34 34 0d 0a 2d 36 37 38 39 35 33 0d 0a  44044..-678953..
1ff50 2d 39 33 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -9374....query I
1ff60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ff70 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 28 20   DISTINCT + - ( 
1ff80 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31 20  col2 ) + + col1 
1ff90 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  * - cor0.col1 FR
1ffa0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1ffb0 0a 2d 2d 2d 2d 0d 0a 2d 33 32 37 0d 0a 2d 33 35  .----..-327..-35
1ffc0 30 37 0d 0a 2d 39 38 38 0d 0a 0d 0a 71 75 65 72  07..-988....quer
1ffd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ffe0 45 43 54 20 2d 20 28 20 36 35 20 29 20 41 53 20  ECT - ( 65 ) AS 
1fff0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
20000 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 35 0d 0a  or0..----..-65..
20010 2d 36 35 0d 0a 2d 36 35 0d 0a 0d 0a 71 75 65 72  -65..-65....quer
20020 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20030 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
20040 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 32   col1 ) * - col2
20050 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
20060 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  r0..----..1534..
20070 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72  646..837....quer
20080 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20090 45 43 54 20 2d 20 2b 20 32 38 20 46 52 4f 4d 20  ECT - + 28 FROM 
200a0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
200b0 0a 2d 32 38 0d 0a 2d 32 38 0d 0a 2d 32 38 0d 0a  .-28..-28..-28..
200c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
200d0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33 36  t..SELECT ALL 36
200e0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   + cor0.col2 AS 
200f0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
20100 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
20110 38 0d 0a 33 37 0d 0a 36 39 0d 0a 0d 0a 71 75 65  8..37..69....que
20120 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20130 4c 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  LECT col1 + col2
20140 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46   * col1 * col1 F
20150 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
20160 32 34 34 31 35 34 0d 0a 36 37 39 31 33 33 0d 0a  244154..679133..
20170 39 35 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9506....query I 
20180 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
20190 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  - col2 * - col1 
201a0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
201b0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
201c0 31 33 32 0d 0a 32 38 36 32 0d 0a 37 35 35 31 0d  132..2862..7551.
201d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
201e0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
201f0 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31   col1 ) * - col1
20200 20 2d 20 28 20 63 6f 6c 31 20 2b 20 63 6f 6c 30   - ( col1 + col0
20210 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
20220 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 31  tab2..----..-361
20230 38 0d 0a 2d 33 38 35 0d 0a 2d 39 39 39 0d 0a 0d  8..-385..-999...
20240 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20250 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 32 2e  ..SELECT + tab2.
20260 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col0 * + col1 + 
20270 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
20280 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
20290 31 32 36 34 0d 0a 32 31 30 0d 0a 34 35 32 34 0d  1264..210..4524.
202a0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
202b0 72 74 0d 0a 53 45 4c 45 43 54 20 32 34 20 2b 20  rt..SELECT 24 + 
202c0 2d 20 38 35 20 2a 20 2b 20 63 6f 6c 31 20 41 53  - 85 * + col1 AS
202d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
202e0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 31 0d 0a 2d 32  .----..-1081..-2
202f0 31 38 36 0d 0a 2d 38 32 36 0d 0a 0d 0a 6f 6e 6c  186..-826....onl
20300 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
20310 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
20320 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
20330 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
20340 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20350 6c 61 62 65 6c 2d 39 30 35 0d 0a 53 45 4c 45 43  label-905..SELEC
20360 54 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T - CAST( NULL A
20370 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 31  S SIGNED ) * - 1
20380 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
20390 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
203a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
203b0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
203c0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
203d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
203e0 62 65 6c 2d 39 30 35 0d 0a 53 45 4c 45 43 54 20  bel-905..SELECT 
203f0 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
20400 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 31   INTEGER ) * - 1
20410 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
20420 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
20430 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
20440 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20450 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c  SELECT - ( + col
20460 32 20 29 20 2b 20 63 6f 6c 31 20 2d 20 36 37 20  2 ) + col1 - 67 
20470 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
20480 0a 2d 31 34 0d 0a 2d 35 38 0d 0a 32 39 0d 0a 0d  .-14..-58..29...
20490 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
204a0 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
204b0 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
204c0 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63 6f 72  M tab2, tab0 cor
204d0 30 2c 20 74 61 62 30 20 63 6f 72 31 2c 20 74 61  0, tab0 cor1, ta
204e0 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32  b0, tab0 AS cor2
204f0 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
20500 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
20510 34 61 62 35 31 36 31 35 66 64 32 63 37 65 34 39  4ab51615fd2c7e49
20520 32 64 65 36 61 35 39 65 39 38 32 32 36 65 31 0d  2de6a59e98226e1.
20530 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
20540 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
20550 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
20560 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
20570 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
20580 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20590 45 43 54 20 41 4c 4c 20 28 20 2d 20 36 34 20 29  ECT ALL ( - 64 )
205a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
205b0 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36 34 0d  .----..-64..-64.
205c0 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-64....query I 
205d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
205e0 63 6f 6c 32 20 2b 20 2b 20 35 20 2a 20 63 6f 6c  col2 + + 5 * col
205f0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
20600 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 38 0d 0a  ab0..----..198..
20610 34 39 32 0d 0a 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  492..6....onlyif
20620 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
20630 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
20640 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
20650 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20660 6c 61 62 65 6c 2d 39 31 30 0d 0a 53 45 4c 45 43  label-910..SELEC
20670 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  T + + cor0.col0 
20680 2a 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  * col1 DIV + col
20690 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
206a0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a  ..----..10..13..
206b0 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
206c0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
206d0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
206e0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 30 0d 0a  sort label-910..
206f0 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 72 30 2e  SELECT + + cor0.
20700 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2f 20 2b 20  col0 * col1 / + 
20710 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63  col0 FROM tab1 c
20720 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31  or0..----..10..1
20730 33 0d 0a 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..26....onlyif 
20740 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
20750 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
20760 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
20770 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
20780 61 62 65 6c 2d 39 31 31 0d 0a 53 45 4c 45 43 54  abel-911..SELECT
20790 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 44 49 56 20   ALL + col2 DIV 
207a0 38 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  84 AS col2 FROM 
207b0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab0..----..0..0
207c0 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
207d0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
207e0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
207f0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 31 0d  wsort label-911.
20800 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
20810 6c 32 20 2f 20 38 34 20 41 53 20 63 6f 6c 32 20  l2 / 84 AS col2 
20820 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
20830 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .0..0..0....quer
20840 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20850 45 43 54 20 2b 20 28 20 2d 20 36 33 20 29 20 2a  ECT + ( - 63 ) *
20860 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 2d   + tab2.col0 * -
20870 20 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor1.col2 FROM 
20880 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
20890 72 30 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41  r0, tab1, tab0 A
208a0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor1..----..81
208b0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
208c0 74 6f 20 31 33 31 61 32 38 62 63 64 64 37 39 61  to 131a28bcdd79a
208d0 33 37 63 34 61 37 37 36 30 32 35 33 31 61 39 62  37c4a77602531a9b
208e0 37 65 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  7e6....query I r
208f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
20900 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 33  ISTINCT col0 + 3
20910 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53  2 * cor0.col2 AS
20920 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
20930 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
20940 30 38 30 0d 0a 32 37 31 33 0d 0a 36 37 0d 0a 0d  080..2713..67...
20950 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20960 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
20970 6c 32 20 2a 20 2d 20 28 20 28 20 63 6f 6c 30 20  l2 * - ( ( col0 
20980 29 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ) ) FROM tab0 AS
20990 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
209a0 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d  ..-7298..-792...
209b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
209c0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
209d0 63 6f 6c 32 20 2b 20 39 35 20 41 53 20 63 6f 6c  col2 + 95 AS col
209e0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
209f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 33 38 0d 0a  ..----..-1..38..
20a00 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  41....query I ro
20a10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
20a20 4c 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  L ( - cor0.col2 
20a30 29 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  ) * - col0 AS co
20a40 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
20a50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39 0d  cor0..----..189.
20a60 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a 71  .2028..3002....q
20a70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20a80 53 45 4c 45 43 54 20 2d 20 33 37 20 41 53 20 63  SELECT - 37 AS c
20a90 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
20aa0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
20ab0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
20ac0 69 6e 67 20 74 6f 20 65 64 34 36 34 34 61 66 37  ing to ed4644af7
20ad0 37 32 39 63 32 34 32 35 65 61 36 63 63 33 64 38  729c2425ea6cc3d8
20ae0 34 63 36 35 30 34 66 0d 0a 0d 0a 71 75 65 72 79  4c6504f....query
20af0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20b00 43 54 20 41 4c 4c 20 2d 20 32 32 20 46 52 4f 4d  CT ALL - 22 FROM
20b10 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30   tab0, tab1 cor0
20b20 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
20b30 20 68 61 73 68 69 6e 67 20 74 6f 20 66 61 65 34   hashing to fae4
20b40 36 66 38 31 34 38 62 30 32 39 36 34 66 37 31 34  6f8148b02964f714
20b50 35 65 62 36 65 64 35 38 31 39 66 39 0d 0a 0d 0a  5eb6ed5819f9....
20b60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
20b70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
20b80 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 2a 20 2b   - cor1.col1 * +
20b90 20 28 20 38 39 20 29 20 46 52 4f 4d 20 74 61 62   ( 89 ) FROM tab
20ba0 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
20bb0 4a 4f 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72  JOIN tab1 AS cor
20bc0 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 35 37 0d 0a  1..----..-1157..
20bd0 2d 32 33 31 34 0d 0a 2d 38 39 30 0d 0a 0d 0a 71  -2314..-890....q
20be0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
20bf0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
20c00 63 6f 6c 31 20 2a 20 33 33 20 46 52 4f 4d 20 74  col1 * 33 FROM t
20c10 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 33 0d  ab2..----..1023.
20c20 0a 31 39 34 37 0d 0a 35 36 31 0d 0a 0d 0a 71 75  .1947..561....qu
20c30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20c40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 33  ELECT DISTINCT 3
20c50 35 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  5 FROM tab1, tab
20c60 32 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  2 AS cor0 CROSS 
20c70 4a 4f 49 4e 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  JOIN tab2..----.
20c80 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .35....query I r
20c90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
20ca0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
20cb0 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62 31  tab2, tab1, tab1
20cc0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
20cd0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
20ce0 6f 20 63 37 38 39 30 34 36 39 65 61 62 62 32 63  o c7890469eabb2c
20cf0 36 66 63 38 31 34 35 34 62 33 35 64 32 33 33 33  6fc81454b35d2333
20d00 62 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  b6....query I ro
20d10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20d20 53 54 49 4e 43 54 20 35 39 20 2b 20 2d 20 34 37  STINCT 59 + - 47
20d30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
20d40 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
20d50 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
20d60 2d 2d 2d 2d 0d 0a 31 32 0d 0a 0d 0a 71 75 65 72  ----..12....quer
20d70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20d80 45 43 54 20 2b 20 2d 20 37 31 20 41 53 20 63 6f  ECT + - 71 AS co
20d90 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l2 FROM tab2, ta
20da0 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
20db0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
20dc0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 39 30  s hashing to 390
20dd0 37 65 30 61 61 34 66 32 39 63 30 30 32 31 32 30  7e0aa4f29c002120
20de0 37 34 32 63 34 61 62 62 33 65 32 33 61 0d 0a 0d  742c4abb3e23a...
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 63 6f 6c 31 20  ..SELECT + col1 
20e10 2a 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53  * col0 * col2 AS
20e20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
20e30 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 36 34  .----..3395..664
20e40 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a 71 75  118..68112....qu
20e50 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20e60 45 4c 45 43 54 20 28 20 63 6f 6c 32 20 29 20 2b  ELECT ( col2 ) +
20e70 20 38 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   89 AS col1 FROM
20e80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
20e90 2d 2d 2d 0d 0a 31 34 33 0d 0a 31 34 36 0d 0a 31  ---..143..146..1
20ea0 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
20eb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
20ec0 53 54 49 4e 43 54 20 31 36 20 46 52 4f 4d 20 74  STINCT 16 FROM t
20ed0 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab0, tab1 AS cor
20ee0 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  0, tab1 AS cor1.
20ef0 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 0d 0a 71 75 65  .----..16....que
20f00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
20f10 4c 45 43 54 20 2b 20 28 20 2d 20 32 20 29 20 46  LECT + ( - 2 ) F
20f20 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41  ROM tab0, tab2 A
20f30 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  S cor0, tab2 AS 
20f40 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
20f50 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
20f60 20 32 30 63 39 32 31 33 33 31 36 35 32 37 64 35   20c9213316527d5
20f70 30 37 65 32 36 34 32 35 30 34 31 65 30 38 33 38  07e26425041e0838
20f80 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
20f90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
20fa0 6f 6c 31 20 2a 20 2d 20 38 37 20 2b 20 2d 20 36  ol1 * - 87 + - 6
20fb0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
20fc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 32  or0..----..-1192
20fd0 0d 0a 2d 32 33 32 33 0d 0a 2d 39 33 31 0d 0a 0d  ..-2323..-931...
20fe0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20ff0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
21000 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72  T + + col1 * cor
21010 30 2e 63 6f 6c 30 20 2d 20 2b 20 28 20 63 6f 6c  0.col0 - + ( col
21020 32 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53  2 ) FROM tab0 AS
21030 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33   cor0..----..203
21040 31 0d 0a 33 33 39 34 0d 0a 38 30 31 37 0d 0a 0d  1..3394..8017...
21050 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21060 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2d  ..SELECT ALL ( -
21070 20 32 39 20 29 20 41 53 20 63 6f 6c 31 20 46 52   29 ) AS col1 FR
21080 4f 4d 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f  OM tab0 cor0 CRO
21090 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20  SS JOIN tab2 AS 
210a0 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
210b0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
210c0 30 63 63 39 64 64 61 64 39 33 66 63 37 38 33 30  0cc9ddad93fc7830
210d0 35 35 35 31 38 61 65 34 62 36 62 65 30 35 34 62  55518ae4b6be054b
210e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
210f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 39 38  ort..SELECT - 98
21100 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
21110 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21120 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
21130 20 74 6f 20 66 31 37 62 37 30 30 38 61 37 64 65   to f17b7008a7de
21140 61 65 31 65 62 35 61 32 65 37 30 37 65 63 32 33  ae1eb5a2e707ec23
21150 37 36 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7638....query I 
21160 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21170 41 4c 4c 20 2d 20 74 61 62 30 2e 63 6f 6c 31 20  ALL - tab0.col1 
21180 2a 20 2d 20 31 35 20 2b 20 2b 20 31 37 20 2a 20  * - 15 + + 17 * 
21190 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  + col2 FROM tab0
211a0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 32 0d 0a 31 38  ..----..1472..18
211b0 35 31 0d 0a 32 37 35 39 0d 0a 0d 0a 71 75 65 72  51..2759....quer
211c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
211d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
211e0 6f 6c 32 20 2b 20 2b 20 36 37 20 41 53 20 63 6f  ol2 + + 67 AS co
211f0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
21200 2d 2d 0d 0a 32 39 0d 0a 34 30 0d 0a 34 31 0d 0a  --..29..40..41..
21210 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21220 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 33 37  t..SELECT ( - 37
21230 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
21240 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
21250 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
21260 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 64  es hashing to ed
21270 34 36 34 34 61 66 37 37 32 39 63 32 34 32 35 65  4644af7729c2425e
21280 61 36 63 63 33 64 38 34 63 36 35 30 34 66 0d 0a  a6cc3d84c6504f..
21290 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
212a0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
212b0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
212c0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
212d0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
212e0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 36 0d 0a  sort label-936..
212f0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 43 41  SELECT col2 - CA
21300 53 54 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49  ST( + col0 AS SI
21310 47 4e 45 44 20 29 20 2a 20 74 61 62 30 2e 63 6f  GNED ) * tab0.co
21320 6c 30 20 2a 20 31 38 20 46 52 4f 4d 20 74 61 62  l0 * 18 FROM tab
21330 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 33 35 0d  0..----..-10335.
21340 0a 2d 31 34 32 34 39 36 0d 0a 2d 32 32 30 34 39  .-142496..-22049
21350 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21360 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21370 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
21380 72 74 20 6c 61 62 65 6c 2d 39 33 36 0d 0a 53 45  rt label-936..SE
21390 4c 45 43 54 20 63 6f 6c 32 20 2d 20 43 41 53 54  LECT col2 - CAST
213a0 20 28 20 2b 20 63 6f 6c 30 20 41 53 20 49 4e 54   ( + col0 AS INT
213b0 45 47 45 52 20 29 20 2a 20 74 61 62 30 2e 63 6f  EGER ) * tab0.co
213c0 6c 30 20 2a 20 31 38 20 46 52 4f 4d 20 74 61 62  l0 * 18 FROM tab
213d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 33 35 0d  0..----..-10335.
213e0 0a 2d 31 34 32 34 39 36 0d 0a 2d 32 32 30 34 39  .-142496..-22049
213f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21400 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
21410 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20 28 20  INCT - col1 * ( 
21420 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30  + col1 ) AS col0
21430 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
21440 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d  r0..----..-7396.
21450 0a 2d 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d  .-8281..-9409...
21460 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21470 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
21480 30 20 2b 20 2d 20 32 30 20 2a 20 2d 20 36 30 20  0 + - 20 * - 60 
21490 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
214a0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 31 0d 0a 31  0..----..1121..1
214b0 31 32 32 0d 0a 31 31 39 33 0d 0a 0d 0a 71 75 65  122..1193....que
214c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
214d0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
214e0 2a 20 2d 20 31 38 20 41 53 20 63 6f 6c 32 20 46  * - 18 AS col2 F
214f0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
21500 0d 0a 2d 2d 2d 2d 0d 0a 31 34 37 36 0d 0a 31 38  ..----..1476..18
21510 0d 0a 35 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..594....query I
21520 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
21530 20 37 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   71 FROM tab1, t
21540 61 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab1 AS cor0, tab
21550 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
21560 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
21570 6e 67 20 74 6f 20 39 35 61 36 66 66 33 35 62 37  ng to 95a6ff35b7
21580 62 38 66 30 30 38 36 38 66 62 35 38 62 63 61 61  b8f00868fb58bcaa
21590 33 32 64 30 63 32 0d 0a 0d 0a 71 75 65 72 79 20  32d0c2....query 
215a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
215b0 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 63  T ALL + col0 * c
215c0 6f 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol1 + col1 FROM 
215d0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
215e0 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39  .2150..3492..819
215f0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
21600 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
21610 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a   col1 + + col2 *
21620 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 46 52   - ( + col2 ) FR
21630 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
21640 0a 2d 2d 2d 2d 0d 0a 2d 31 34 32 37 0d 0a 2d 36  .----..-1427..-6
21650 31 37 0d 0a 2d 36 39 38 0d 0a 0d 0a 71 75 65 72  17..-698....quer
21660 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21670 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT + cor0.col1 
21680 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e  * - col0 + cor0.
21690 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
216a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
216b0 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30 31  040..-3360..-801
216c0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
216d0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34 33 20  sort..SELECT 43 
216e0 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 2b  - ( + col2 ) * +
216f0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
21700 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
21710 31 34 30 31 0d 0a 2d 36 33 33 0d 0a 2d 36 38 36  1401..-633..-686
21720 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21730 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
21740 39 39 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  99 FROM tab2, ta
21750 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b0, tab0 AS cor0
21760 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
21770 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 35 65  s hashing to 05e
21780 61 31 38 32 66 64 36 30 33 36 63 37 66 35 65 30  a182fd6036c7f5e0
21790 65 61 30 38 66 63 30 36 31 63 63 36 37 0d 0a 0d  ea08fc061cc67...
217a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
217b0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 2b  ..SELECT ALL ( +
217c0 20 74 61 62 32 2e 63 6f 6c 31 20 29 20 2a 20 2d   tab2.col1 ) * -
217d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d   col0 FROM tab2.
217e0 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
217f0 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 73 6b 69  17..-4602....ski
21800 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
21810 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
21820 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
21830 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
21840 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
21850 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
21860 4c 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  L col0 * - col0 
21870 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
21880 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37  ----..-1225..-57
21890 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72  6..-7921....quer
218a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
218b0 45 43 54 20 2b 20 2d 20 28 20 63 6f 72 30 2e 63  ECT + - ( cor0.c
218c0 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
218d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
218e0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d  .----..-10..-13.
218f0 0a 2d 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-26....query I 
21900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21910 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f  - cor0.col0 + co
21920 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  r0.col0 AS col1 
21930 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
21940 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
21950 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21960 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 36  ort..SELECT - 26
21970 20 2d 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a   - - tab1.col0 *
21980 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
21990 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
219a0 33 36 0d 0a 33 36 32 32 0d 0a 37 36 35 34 0d 0a  36..3622..7654..
219b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
219c0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
219d0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
219e0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
219f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35  rowsort label-95
21a00 31 0d 0a 53 45 4c 45 43 54 20 2b 20 33 30 20 44  1..SELECT + 30 D
21a10 49 56 20 34 31 20 2b 20 2d 20 63 6f 6c 32 20 63  IV 41 + - col2 c
21a20 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
21a30 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d 38  ---..-1..-33..-8
21a40 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  2....skipif post
21a50 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
21a60 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
21a70 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
21a80 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
21a90 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
21aa0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
21ab0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
21ac0 65 6c 2d 39 35 31 0d 0a 53 45 4c 45 43 54 20 2b  el-951..SELECT +
21ad0 20 33 30 20 2f 20 34 31 20 2b 20 2d 20 63 6f 6c   30 / 41 + - col
21ae0 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  2 col2 FROM tab0
21af0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d  ..----..-1..-33.
21b00 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
21b10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21b20 63 6f 6c 30 20 2a 20 35 37 20 46 52 4f 4d 20 74  col0 * 57 FROM t
21b30 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
21b40 2d 0d 0a 33 39 39 0d 0a 34 34 34 36 0d 0a 34 35  -..399..4446..45
21b50 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  03....query I ro
21b60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
21b70 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col2 * - col0 + 
21b80 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  - col2 AS col1 F
21b90 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
21ba0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 37 33  ..----..-36..-73
21bb0 38 30 0d 0a 2d 38 32 35 0d 0a 0d 0a 71 75 65 72  80..-825....quer
21bc0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21bd0 45 43 54 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b  ECT + ( col2 ) +
21be0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   - cor0.col2 FRO
21bf0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
21c00 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
21c10 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
21c20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
21c30 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
21c40 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
21c50 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
21c60 6f 72 74 20 6c 61 62 65 6c 2d 39 35 35 0d 0a 53  ort label-955..S
21c70 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b  ELECT + col0 * +
21c80 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 43   cor0.col1 + + C
21c90 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
21ca0 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52  NED ) AS col1 FR
21cb0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
21cc0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
21cd0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
21ce0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
21cf0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
21d00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21d10 39 35 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  955..SELECT + co
21d20 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l0 * + cor0.col1
21d30 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c   + + CAST ( NULL
21d40 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
21d50 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
21d60 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
21d70 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
21d80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21d90 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
21da0 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  1 - + cor0.col2 
21db0 2a 20 2d 20 39 38 20 41 53 20 63 6f 6c 32 20 46  * - 98 AS col2 F
21dc0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
21dd0 0d 0a 2d 2d 2d 2d 0d 0a 32 36 30 37 0d 0a 32 36  ..----..2607..26
21de0 37 37 0d 0a 33 37 34 31 0d 0a 0d 0a 71 75 65 72  77..3741....quer
21df0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21e00 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 38  ECT DISTINCT + 8
21e10 30 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  0 + col0 FROM ta
21e20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
21e30 0d 0a 31 34 34 0d 0a 31 36 30 0d 0a 38 33 0d 0a  ..144..160..83..
21e40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21e50 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
21e60 28 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 30 20  ( col1 ) * col0 
21e70 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
21e80 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
21e90 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d  .-2064..-3395..-
21ea0 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
21eb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21ec0 44 49 53 54 49 4e 43 54 20 2d 20 37 39 20 2a 20  DISTINCT - 79 * 
21ed0 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
21ee0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21ef0 31 38 39 36 0d 0a 32 37 36 35 0d 0a 37 30 33 31  1896..2765..7031
21f00 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
21f10 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
21f20 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
21f30 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
21f40 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
21f50 39 36 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  960..SELECT ALL 
21f60 2b 20 63 6f 6c 30 20 2b 20 36 37 20 44 49 56 20  + col0 + 67 DIV 
21f70 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
21f80 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
21f90 0d 0a 31 36 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a  ..16..78..79....
21fa0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
21fb0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
21fc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21fd0 61 62 65 6c 2d 39 36 30 0d 0a 53 45 4c 45 43 54  abel-960..SELECT
21fe0 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 36 37   ALL + col0 + 67
21ff0 20 2f 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46   / + cor0.col0 F
22000 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
22010 2d 2d 2d 0d 0a 31 36 0d 0a 37 38 0d 0a 37 39 0d  ---..16..78..79.
22020 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22030 72 74 0d 0a 53 45 4c 45 43 54 20 32 32 20 41 53  rt..SELECT 22 AS
22040 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
22050 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
22060 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
22070 73 68 69 6e 67 20 74 6f 20 63 35 35 65 65 37 34  shing to c55ee74
22080 33 33 64 38 64 33 39 61 35 39 62 31 64 65 32 61  33d8d39a59b1de2a
22090 61 64 64 39 35 33 38 63 39 0d 0a 0d 0a 71 75 65  add9538c9....que
220a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
220b0 4c 45 43 54 20 33 32 20 41 53 20 63 6f 6c 30 20  LECT 32 AS col0 
220c0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
220d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
220e0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
220f0 74 6f 20 64 33 30 61 32 61 63 62 66 33 33 63 38  to d30a2acbf33c8
22100 38 32 37 34 34 37 34 33 30 36 39 33 36 64 33 32  8274474306936d32
22110 32 37 62 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  27b....onlyif my
22120 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
22130 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
22140 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
22150 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
22160 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22170 39 36 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  963..SELECT ALL 
22180 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
22190 44 45 43 49 4d 41 4c 20 29 20 2b 20 2d 20 63 6f  DECIMAL ) + - co
221a0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
221b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
221c0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
221d0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
221e0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
221f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
22200 61 62 65 6c 2d 39 36 33 0d 0a 53 45 4c 45 43 54  abel-963..SELECT
22210 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55   ALL - CAST ( NU
22220 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2b 20 2d  LL AS REAL ) + -
22230 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
22240 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
22250 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
22260 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22270 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
22280 63 6f 6c 31 20 2b 20 32 34 20 2a 20 63 6f 6c 32  col1 + 24 * col2
22290 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
222a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
222b0 0d 0a 31 33 32 32 0d 0a 31 33 37 38 0d 0a 32 33  ..1322..1378..23
222c0 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  17....query I ro
222d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
222e0 4c 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  L - - col0 * + c
222f0 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
22300 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
22310 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33 30 30  ..189..2028..300
22320 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
22330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
22340 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
22350 30 20 2a 20 2d 20 35 33 20 2b 20 63 6f 6c 30 20  0 * - 53 + col0 
22360 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  + + col0 * + col
22370 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * - col2 FROM 
22380 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
22390 2d 2d 0d 0a 2d 31 38 35 35 0d 0a 2d 32 37 33 38  --..-1855..-2738
223a0 34 0d 0a 2d 36 30 33 30 36 34 0d 0a 0d 0a 73 6b  4..-603064....sk
223b0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
223c0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
223d0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
223e0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
223f0 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
22400 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
22410 49 53 54 49 4e 43 54 20 38 38 20 2a 20 2b 20 63  ISTINCT 88 * + c
22420 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
22430 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
22440 0d 0a 34 37 35 32 0d 0a 35 30 31 36 0d 0a 38 34  ..4752..5016..84
22450 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  48....query I ro
22460 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
22470 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20  + cor0.col2 + + 
22480 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30  cor0.col0 * col0
22490 20 2a 20 35 35 20 46 52 4f 4d 20 74 61 62 31 20   * 55 FROM tab1 
224a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
224b0 32 35 33 33 37 0d 0a 33 35 32 30 39 36 0d 0a 35  25337..352096..5
224c0 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  49....query I ro
224d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
224e0 6c 31 20 2a 20 2b 20 33 36 20 2b 20 63 6f 6c 30  l1 * + 36 + col0
224f0 20 2b 20 2b 20 28 20 63 6f 6c 31 20 2a 20 2d 20   + + ( col1 * - 
22500 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41 53 20 63  cor0.col2 ) AS c
22510 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
22520 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30   cor0..----..-40
22530 39 37 0d 0a 32 38 32 0d 0a 33 34 33 30 0d 0a 0d  97..282..3430...
22540 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
22550 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
22560 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
22570 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
22580 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
22590 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
225a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72  T DISTINCT - cor
225b0 30 2e 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f  0.col1 + cor0.co
225c0 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 30  l1 * - col2 col0
225d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
225e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 31 0d  r0..----..-1261.
225f0 0a 2d 31 34 33 30 0d 0a 2d 35 38 30 0d 0a 0d 0a  .-1430..-580....
22600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22610 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
22620 20 2d 20 2b 20 28 20 31 32 20 29 20 41 53 20 63   - + ( 12 ) AS c
22630 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
22640 2d 2d 2d 0d 0a 2d 39 0d 0a 35 32 0d 0a 36 38 0d  ---..-9..52..68.
22650 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22660 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
22670 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2b   col0 + - col0 +
22680 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
22690 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
226a0 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d  ----..3..64..80.
226b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
226c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
226d0 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20 28 20 63  NCT col0 * + ( c
226e0 6f 6c 31 20 29 20 2b 20 63 6f 6c 32 20 41 53 20  ol1 ) + col2 AS 
226f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
22700 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
22710 33 36 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a  36..132..697....
22720 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22730 0a 53 45 4c 45 43 54 20 35 36 20 2b 20 63 6f 6c  .SELECT 56 + col
22740 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
22750 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
22760 2d 0d 0a 31 31 30 0d 0a 31 31 33 0d 0a 31 35 32  -..110..113..152
22770 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22780 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  ort..SELECT + - 
22790 28 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c  ( col1 ) * + col
227a0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
227b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
227c0 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36 0d 0a  -..-1534..-646..
227d0 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -837....query I 
227e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
227f0 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f  cor0.col1 + + co
22800 6c 31 20 2b 20 2b 20 39 35 20 46 52 4f 4d 20 74  l1 + + 95 FROM t
22810 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
22820 2d 0d 0a 31 32 39 0d 0a 31 35 37 0d 0a 32 31 33  -..129..157..213
22830 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
22840 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
22850 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
22860 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
22870 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22880 39 37 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  977..SELECT - + 
22890 32 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2b  2 DIV + col0 + +
228a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
228b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
228c0 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70  ..64..80....skip
228d0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
228e0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
228f0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
22900 2d 39 37 37 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  -977..SELECT - +
22910 20 32 20 2f 20 2b 20 63 6f 6c 30 20 2b 20 2b 20   2 / + col0 + + 
22920 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
22930 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d  S cor0..----..3.
22940 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69  .64..80....onlyi
22950 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
22960 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
22970 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
22980 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
22990 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
229a0 62 65 6c 2d 39 37 38 0d 0a 53 45 4c 45 43 54 20  bel-978..SELECT 
229b0 2b 20 43 41 53 54 28 20 63 6f 6c 32 20 2b 20 63  + CAST( col2 + c
229c0 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
229d0 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * + col1 AS col1
229e0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
229f0 0d 0a 31 34 31 37 0d 0a 32 30 38 30 0d 0a 36 37  ..1417..2080..67
22a00 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
22a10 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
22a20 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
22a30 6f 72 74 20 6c 61 62 65 6c 2d 39 37 38 0d 0a 53  ort label-978..S
22a40 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 63  ELECT + CAST ( c
22a50 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e  ol2 + col1 AS IN
22a60 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c 31  TEGER ) * + col1
22a70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
22a80 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 37 0d 0a  b1..----..1417..
22a90 32 30 38 30 0d 0a 36 37 30 0d 0a 0d 0a 71 75 65  2080..670....que
22aa0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
22ab0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
22ac0 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20  b0.col1 AS col1 
22ad0 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c  FROM tab0, tab1,
22ae0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
22af0 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d  ---..86..91..97.
22b00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22b10 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
22b20 20 63 6f 6c 32 20 2b 20 38 34 20 46 52 4f 4d 20   col2 + 84 FROM 
22b30 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 0d  tab1..----..138.
22b40 0a 31 34 31 0d 0a 31 38 30 0d 0a 0d 0a 6f 6e 6c  .141..180....onl
22b50 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
22b60 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
22b70 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
22b80 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
22b90 72 74 20 6c 61 62 65 6c 2d 39 38 31 0d 0a 53 45  rt label-981..SE
22ba0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
22bb0 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  l0 + col1 * + co
22bc0 6c 31 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l1 DIV col1 AS c
22bd0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
22be0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30   cor0..----..110
22bf0 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 73 6b  ..132..180....sk
22c00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
22c10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
22c20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
22c30 65 6c 2d 39 38 31 0d 0a 53 45 4c 45 43 54 20 44  el-981..SELECT D
22c40 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63  ISTINCT col0 + c
22c50 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2f 20 63  ol1 * + col1 / c
22c60 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
22c70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
22c80 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31  ---..110..132..1
22c90 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
22ca0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
22cb0 4c 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  L + + col0 * col
22cc0 31 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  1 - + col2 * - c
22cd0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
22ce0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 30   cor0..----..240
22cf0 0d 0a 34 32 38 38 0d 0a 38 37 32 30 0d 0a 0d 0a  ..4288..8720....
22d00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22d10 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
22d20 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a   - col0 * col0 *
22d30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
22d40 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
22d50 2d 2d 2d 2d 0d 0a 2d 31 33 32 33 0d 0a 2d 31 35  ----..-1323..-15
22d60 38 31 38 34 0d 0a 2d 32 33 37 31 35 38 0d 0a 0d  8184..-237158...
22d70 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
22d80 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
22d90 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
22da0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
22db0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 34  owsort label-984
22dc0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
22dd0 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
22de0 31 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f  1 DIV col0 AS co
22df0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
22e00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 33 0d  cor0..----..-83.
22e10 0a 2d 39 30 0d 0a 2d 39 35 0d 0a 0d 0a 73 6b 69  .-90..-95....ski
22e20 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
22e30 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
22e40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22e50 6c 2d 39 38 34 0d 0a 53 45 4c 45 43 54 20 41 4c  l-984..SELECT AL
22e60 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72  L - + col1 + cor
22e70 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 41 53  0.col1 / col0 AS
22e80 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
22e90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
22ea0 38 33 0d 0a 2d 39 30 0d 0a 2d 39 35 0d 0a 0d 0a  83..-90..-95....
22eb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22ec0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
22ed0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 31 30  cor0.col0 * - 10
22ee0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
22ef0 0a 2d 2d 2d 2d 0d 0a 32 34 30 0d 0a 33 35 30 0d  .----..240..350.
22f00 0a 38 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .890....query I 
22f10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
22f20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
22f30 2b 20 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  + 8 AS col1 FROM
22f40 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
22f50 2d 2d 2d 0d 0a 2d 34 36 0d 0a 2d 34 39 0d 0a 2d  ---..-46..-49..-
22f60 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
22f70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
22f80 4c 20 63 6f 6c 32 20 2a 20 39 32 20 41 53 20 63  L col2 * 92 AS c
22f90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
22fa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 36   cor0..----..496
22fb0 38 0d 0a 35 32 34 34 0d 0a 38 38 33 32 0d 0a 0d  8..5244..8832...
22fc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22fd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b  ..SELECT ALL + +
22fe0 20 63 6f 6c 30 20 2a 20 2d 20 33 38 20 2b 20 2b   col0 * - 38 + +
22ff0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a   col0 * + col0 *
23000 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
23010 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
23020 0a 2d 2d 2d 2d 0d 0a 31 32 39 31 32 0d 0a 34 31  .----..12912..41
23030 35 34 35 0d 0a 37 30 31 35 38 37 0d 0a 0d 0a 71  545..701587....q
23040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23050 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
23060 2a 20 2b 20 39 38 20 41 53 20 63 6f 6c 30 20 46  * + 98 AS col0 F
23070 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
23080 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 34 0d 0a 2d 36  ..----..-294..-6
23090 32 37 32 0d 0a 2d 37 38 34 30 0d 0a 0d 0a 71 75  272..-7840....qu
230a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
230b0 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 31 34 20  ELECT col1 + 14 
230c0 2a 20 37 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 72 AS col2 FRO
230d0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab0..----..10
230e0 39 34 0d 0a 31 30 39 39 0d 0a 31 31 30 35 0d 0a  94..1099..1105..
230f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
23100 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
23110 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
23120 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
23130 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
23140 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 31 0d 0a  sort label-991..
23150 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
23160 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  0 * CAST( NULL A
23170 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63  S SIGNED ) * + c
23180 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ol2 + col1 * + c
23190 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol2 FROM tab2..-
231a0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
231b0 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
231c0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
231d0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
231e0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39  rowsort label-99
231f0 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  1..SELECT ALL + 
23200 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55  col0 * CAST ( NU
23210 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
23220 2a 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  * + col2 + col1 
23230 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
23240 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
23250 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
23260 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23270 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
23280 20 63 6f 6c 30 20 2b 20 28 20 37 20 2a 20 63 6f   col0 + ( 7 * co
23290 6c 32 20 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 32  l2 + + tab2.col2
232a0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
232b0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 33 0d  tab2..----..223.
232c0 0a 32 38 36 0d 0a 33 38 33 0d 0a 0d 0a 6f 6e 6c  .286..383....onl
232d0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
232e0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
232f0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
23300 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
23310 72 74 20 6c 61 62 65 6c 2d 39 39 33 0d 0a 53 45  rt label-993..SE
23320 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
23330 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 31 20  - col2 * ( col1 
23340 2b 20 63 6f 6c 32 20 29 20 44 49 56 20 2b 20 38  + col2 ) DIV + 8
23350 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
23360 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
23370 0d 0a 2d 31 39 35 0d 0a 2d 32 36 31 0d 0a 2d 32  ..-195..-261..-2
23380 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  76....skipif mys
23390 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
233a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
233b0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 33 0d 0a  sort label-993..
233c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
233d0 2b 20 2d 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c  + - col2 * ( col
233e0 31 20 2b 20 63 6f 6c 32 20 29 20 2f 20 2b 20 38  1 + col2 ) / + 8
233f0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
23400 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
23410 0d 0a 2d 31 39 35 0d 0a 2d 32 36 31 0d 0a 2d 32  ..-195..-261..-2
23420 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  76....onlyif mys
23430 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
23440 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
23450 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
23460 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
23470 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39   rowsort label-9
23480 39 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  94..SELECT DISTI
23490 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53  NCT col2 * + CAS
234a0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
234b0 44 20 29 20 2a 20 31 35 20 2b 20 63 6f 72 30 2e  D ) * 15 + cor0.
234c0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
234d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
234e0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
234f0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
23500 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
23510 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23520 65 6c 2d 39 39 34 0d 0a 53 45 4c 45 43 54 20 44  el-994..SELECT D
23530 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b  ISTINCT col2 * +
23540 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
23550 49 4e 54 45 47 45 52 20 29 20 2a 20 31 35 20 2b  INTEGER ) * 15 +
23560 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
23570 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
23580 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
23590 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
235a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
235b0 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  INCT + + col2 * 
235c0 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20 63  col0 + col0 AS c
235d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
235e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35   cor0..----..165
235f0 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a  ..3712..7760....
23600 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23610 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
23620 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 2b 20   * ( + col2 ) + 
23630 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
23640 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
23650 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39 35 30 0d 0a  ---..182..1950..
23660 32 39 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2923....query I 
23670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23680 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
23690 2d 20 37 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 71 AS col1 FRO
236a0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
236b0 2d 2d 2d 2d 0d 0a 31 35 0d 0a 32 30 0d 0a 32 36  ----..15..20..26
236c0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
236d0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
236e0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
236f0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
23700 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
23710 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 38  owsort label-998
23720 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
23730 30 20 2b 20 2d 20 43 41 53 54 28 20 63 6f 6c 31  0 + - CAST( col1
23740 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
23750 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
23760 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
23770 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 73 6b  ..-62..-62....sk
23780 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
23790 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
237a0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
237b0 65 6c 2d 39 39 38 0d 0a 53 45 4c 45 43 54 20 41  el-998..SELECT A
237c0 4c 4c 20 63 6f 6c 30 20 2b 20 2d 20 43 41 53 54  LL col0 + - CAST
237d0 20 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47   ( col1 AS INTEG
237e0 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ER ) AS col0 FRO
237f0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
23800 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d  ----..-2..-62..-
23810 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
23820 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23830 4c 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 32 20  L col0 - - col2 
23840 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  * col0 FROM tab1
23850 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35   cor0..----..165
23860 0d 0a 33 37 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a  ..3712..7760....
23870 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23880 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63  .SELECT col0 * c
23890 6f 6c 31 20 2b 20 37 30 20 41 53 20 63 6f 6c 31  ol1 + 70 AS col1
238a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
238b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 31 33 0d 0a  r0..----..1413..
238c0 32 38 37 0d 0a 34 36 37 32 0d 0a 0d 0a 73 6b 69  287..4672....ski
238d0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
238e0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
238f0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
23900 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
23910 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
23920 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
23930 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 63 6f  STINCT col1 + co
23940 6c 31 20 2a 20 31 39 20 2b 20 63 6f 6c 30 20 63  l1 * 19 + col0 c
23950 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
23960 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 34   cor0..----..264
23970 0d 0a 33 34 30 0d 0a 35 32 33 0d 0a 0d 0a 71 75  ..340..523....qu
23980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
23990 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20  ELECT cor0.col1 
239a0 2b 20 2d 20 34 35 20 2a 20 2b 20 63 6f 6c 31 20  + - 45 * + col1 
239b0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
239c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
239d0 0a 2d 31 31 34 34 0d 0a 2d 34 34 30 0d 0a 2d 35  .-1144..-440..-5
239e0 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  72....query I ro
239f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
23a00 4c 20 2b 20 38 39 20 46 52 4f 4d 20 74 61 62 32  L + 89 FROM tab2
23a10 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
23a20 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
23a30 61 73 68 69 6e 67 20 74 6f 20 35 63 38 34 32 38  ashing to 5c8428
23a40 65 39 66 31 65 37 64 65 33 64 30 39 63 62 30 38  e9f1e7de3d09cb08
23a50 31 34 62 34 63 63 31 37 34 33 0d 0a 0d 0a 6f 6e  14b4cc1743....on
23a60 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
23a70 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
23a80 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
23a90 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
23aa0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 34 0d 0a  ort label-1004..
23ab0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49  SELECT - col1 DI
23ac0 56 20 63 6f 6c 31 20 2b 20 2d 20 35 20 41 53 20  V col1 + - 5 AS 
23ad0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
23ae0 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 2d 36  ----..-6..-6..-6
23af0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23b00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
23b10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
23b20 72 74 20 6c 61 62 65 6c 2d 31 30 30 34 0d 0a 53  rt label-1004..S
23b30 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63  ELECT - col1 / c
23b40 6f 6c 31 20 2b 20 2d 20 35 20 41 53 20 63 6f 6c  ol1 + - 5 AS col
23b50 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
23b60 2d 0d 0a 2d 36 0d 0a 2d 36 0d 0a 2d 36 0d 0a 0d  -..-6..-6..-6...
23b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23b80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 35  ..SELECT ALL - 5
23b90 34 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  4 FROM tab2, tab
23ba0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
23bb0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
23bc0 67 20 74 6f 20 34 65 63 64 62 30 66 31 62 38 35  g to 4ecdb0f1b85
23bd0 66 30 64 34 66 64 63 33 61 38 32 36 65 66 64 39  f0d4fdc3a826efd9
23be0 66 32 33 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  f2342....query I
23bf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
23c00 20 41 4c 4c 20 38 36 20 46 52 4f 4d 20 74 61 62   ALL 86 FROM tab
23c10 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  2, tab0 AS cor0,
23c20 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d   tab0 AS cor1..-
23c30 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
23c40 61 73 68 69 6e 67 20 74 6f 20 65 64 31 61 33 39  ashing to ed1a39
23c50 63 32 37 35 32 63 61 33 37 32 33 36 30 32 65 34  c2752ca3723602e4
23c60 61 39 32 63 35 34 62 62 63 34 0d 0a 0d 0a 6f 6e  a92c54bbc4....on
23c70 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
23c80 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
23c90 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
23ca0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
23cb0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 37 0d 0a  ort label-1007..
23cc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
23cd0 2b 20 37 33 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  + 73 * - col2 + 
23ce0 63 6f 6c 32 20 44 49 56 20 2d 20 35 37 20 2b 20  col2 DIV - 57 + 
23cf0 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
23d00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23d10 2d 31 39 32 34 0d 0a 2d 31 39 39 38 0d 0a 2d 32  -1924..-1998..-2
23d20 38 31 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  812....skipif my
23d30 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
23d40 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
23d50 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 30 37  wsort label-1007
23d60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
23d70 54 20 2b 20 37 33 20 2a 20 2d 20 63 6f 6c 32 20  T + 73 * - col2 
23d80 2b 20 63 6f 6c 32 20 2f 20 2d 20 35 37 20 2b 20  + col2 / - 57 + 
23d90 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  - col2 FROM tab2
23da0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23db0 2d 31 39 32 34 0d 0a 2d 31 39 39 38 0d 0a 2d 32  -1924..-1998..-2
23dc0 38 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  812....query I r
23dd0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
23de0 4c 4c 20 2b 20 31 35 20 2a 20 2d 20 63 6f 72 30  LL + 15 * - cor0
23df0 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63 6f 6c  .col2 + cor0.col
23e00 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 - - col2 AS co
23e10 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
23e20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36  cor0..----..-126
23e30 34 0d 0a 2d 37 33 34 0d 0a 2d 37 35 33 0d 0a 0d  4..-734..-753...
23e40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23e50 0d 0a 53 45 4c 45 43 54 20 2b 20 31 31 20 2b 20  ..SELECT + 11 + 
23e60 33 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  34 AS col2 FROM 
23e70 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
23e80 2d 2d 0d 0a 34 35 0d 0a 34 35 0d 0a 34 35 0d 0a  --..45..45..45..
23e90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23ea0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
23eb0 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d 20 38 39  cor0.col1 - - 89
23ec0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
23ed0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
23ee0 0d 0a 2d 32 0d 0a 2d 38 0d 0a 33 0d 0a 0d 0a 71  ..-2..-8..3....q
23ef0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
23f00 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e  SELECT ALL cor0.
23f10 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col2 + + cor0.co
23f20 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l2 * + col2 * - 
23f30 37 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  7 FROM tab0 AS c
23f40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 36 39 38  or0..----..-4698
23f50 36 0d 0a 2d 36 0d 0a 2d 37 35 39 30 0d 0a 0d 0a  6..-6..-7590....
23f60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
23f70 0a 53 45 4c 45 43 54 20 35 32 20 46 52 4f 4d 20  .SELECT 52 FROM 
23f80 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
23f90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
23fa0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 66  es hashing to 7f
23fb0 34 61 65 33 30 38 39 33 61 62 33 33 30 37 38 34  4ae30893ab330784
23fc0 38 32 39 37 31 31 30 33 32 61 65 35 39 39 0d 0a  829711032ae599..
23fd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23fe0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
23ff0 20 2a 20 35 33 20 2b 20 63 6f 6c 32 20 2d 20 33   * 53 + col2 - 3
24000 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  5 FROM tab2 AS c
24010 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 33 0d 0a  or0..----..363..
24020 34 31 32 35 0d 0a 34 31 39 30 0d 0a 0d 0a 73 6b  4125..4190....sk
24030 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
24040 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
24050 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
24060 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
24070 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
24080 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
24090 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
240a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 43 41  wsort..SELECT CA
240b0 53 54 20 28 20 2d 20 63 6f 6c 32 20 41 53 20 52  ST ( - col2 AS R
240c0 45 41 4c 20 29 20 2b 20 2d 20 63 6f 6c 32 20 63  EAL ) + - col2 c
240d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
240e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
240f0 34 0d 0a 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75  4..-2..-66....qu
24100 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24110 45 4c 45 43 54 20 2b 20 28 20 63 6f 72 30 2e 63  ELECT + ( cor0.c
24120 6f 6c 30 20 29 20 2d 20 63 6f 6c 31 20 46 52 4f  ol0 ) - col1 FRO
24130 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
24140 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36  ----..-24..19..6
24150 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
24160 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
24170 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
24180 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
24190 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
241a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
241b0 31 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  16..SELECT - CAS
241c0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
241d0 44 20 29 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f  D ) - + col1 FRO
241e0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
241f0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
24200 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
24210 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
24220 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
24230 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24240 30 31 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41  016..SELECT - CA
24250 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
24260 45 47 45 52 20 29 20 2d 20 2b 20 63 6f 6c 31 20  EGER ) - + col1 
24270 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
24280 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
24290 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
242a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
242b0 4c 45 43 54 20 41 4c 4c 20 2b 20 35 35 20 2a 20  LECT ALL + 55 * 
242c0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
242d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
242e0 2d 0d 0a 31 34 33 30 0d 0a 35 35 30 0d 0a 37 31  -..1430..550..71
242f0 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
24300 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
24310 54 49 4e 43 54 20 2b 20 35 36 20 2b 20 2d 20 63  TINCT + 56 + - c
24320 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
24330 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d  r0..----..-24..-
24340 38 0d 0a 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49  8..53....query I
24350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
24360 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72 30   - + col2 * cor0
24370 2e 63 6f 6c 31 20 2b 20 28 20 2b 20 34 37 20 29  .col1 + ( + 47 )
24380 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
24390 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
243a0 0d 0a 2d 31 32 30 31 0d 0a 2d 31 33 35 37 0d 0a  ..-1201..-1357..
243b0 2d 35 32 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -523....onlyif m
243c0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
243d0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
243e0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
243f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
24400 62 65 6c 2d 31 30 32 30 0d 0a 53 45 4c 45 43 54  bel-1020..SELECT
24410 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   - col1 + + col2
24420 20 2a 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30   * col2 DIV col0
24430 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
24440 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 31 0d 0a 31  r0..----..-51..1
24450 0d 0a 37 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..73....skipif m
24460 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
24470 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
24480 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32  owsort label-102
24490 30 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  0..SELECT - col1
244a0 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32   + + col2 * col2
244b0 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
244c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
244d0 0a 2d 35 31 0d 0a 31 0d 0a 37 33 0d 0a 0d 0a 71  .-51..1..73....q
244e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
244f0 53 45 4c 45 43 54 20 41 4c 4c 20 31 33 20 2b 20  SELECT ALL 13 + 
24500 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 28 20  cor0.col1 + ( ( 
24510 2b 20 63 6f 6c 31 20 29 20 2a 20 2d 20 28 20 2b  + col1 ) * - ( +
24520 20 63 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20 74   col2 ) ) FROM t
24530 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24540 2d 0d 0a 2d 31 34 36 32 0d 0a 2d 36 31 36 0d 0a  -..-1462..-616..
24550 2d 37 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -793....query I 
24560 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
24570 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 72  ALL + col2 * cor
24580 30 2e 63 6f 6c 30 20 2b 20 2b 20 39 34 20 46 52  0.col0 + + 94 FR
24590 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
245a0 0a 2d 2d 2d 2d 0d 0a 32 31 32 32 0d 0a 32 38 33  .----..2122..283
245b0 0d 0a 33 30 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..3096....skipif
245c0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
245d0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
245e0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
245f0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
24600 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
24610 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
24620 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol1 + + col2 * -
24630 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 63 6f 6c   col1 + col1 col
24640 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
24650 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 34 38  or0..----..-1248
24660 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30 0d 0a 0d  ..-1404..-570...
24670 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24680 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
24690 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 * cor0.col1 
246a0 2b 20 35 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  + 58 AS col0 FRO
246b0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
246c0 2d 0d 0a 31 34 30 31 0d 0a 32 37 35 0d 0a 34 36  -..1401..275..46
246d0 36 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  60....skipif pos
246e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
246f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
24700 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
24710 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
24720 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24730 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24740 2b 20 2d 20 38 34 20 2a 20 63 6f 6c 30 20 2b 20  + - 84 * col0 + 
24750 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f  cor0.col0 * + co
24760 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
24770 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
24780 0a 2d 33 36 33 34 0d 0a 2d 33 39 39 0d 0a 2d 34  .-3634..-399..-4
24790 35 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  524....onlyif my
247a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
247b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
247c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
247d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
247e0 65 6c 2d 31 30 32 36 0d 0a 53 45 4c 45 43 54 20  el-1026..SELECT 
247f0 2d 20 2b 20 39 39 20 44 49 56 20 2d 20 63 6f 6c  - + 99 DIV - col
24800 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
24810 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  or0..----..1..1.
24820 0a 31 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .14....skipif my
24830 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
24840 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
24850 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 36  wsort label-1026
24860 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 39 39 20  ..SELECT - + 99 
24870 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  / - col0 FROM ta
24880 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
24890 0d 0a 31 0d 0a 31 0d 0a 31 34 0d 0a 0d 0a 71 75  ..1..1..14....qu
248a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
248b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
248c0 20 34 38 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f   48 * - col1 FRO
248d0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
248e0 2d 2d 2d 2d 0d 0a 2d 34 31 32 38 0d 0a 2d 34 33  ----..-4128..-43
248f0 36 38 0d 0a 2d 34 36 35 36 0d 0a 0d 0a 6f 6e 6c  68..-4656....onl
24900 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
24910 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
24920 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
24930 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
24940 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
24950 6c 61 62 65 6c 2d 31 30 32 38 0d 0a 53 45 4c 45  label-1028..SELE
24960 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30  CT col0 * + col0
24970 20 2b 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20   + - CAST( NULL 
24980 41 53 20 44 45 43 49 4d 41 4c 20 29 20 46 52 4f  AS DECIMAL ) FRO
24990 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
249a0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
249b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
249c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
249d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
249e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
249f0 30 32 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  028..SELECT col0
24a00 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 43 41   * + col0 + - CA
24a10 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41  ST ( NULL AS REA
24a20 4c 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  L ) FROM tab1 AS
24a30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
24a40 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
24a50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24a60 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
24a70 28 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20  ( col2 + + col2 
24a80 29 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) * col0 FROM ta
24a90 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
24aa0 0d 0a 32 36 34 36 0d 0a 33 31 36 33 36 38 0d 0a  ..2646..316368..
24ab0 34 37 34 33 31 36 0d 0a 0d 0a 71 75 65 72 79 20  474316....query 
24ac0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24ad0 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 34 31 20  T + col1 * - 41 
24ae0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
24af0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 36 0d 0a  0..----..-1066..
24b00 2d 34 31 30 0d 0a 2d 35 33 33 0d 0a 0d 0a 71 75  -410..-533....qu
24b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
24b20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
24b30 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30 20 41   col2 - - col0 A
24b40 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
24b50 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
24b60 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a  104..117..34....
24b70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24b80 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
24b90 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20  ol1 * cor0.col2 
24ba0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
24bb0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
24bc0 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d  .1534..646..837.
24bd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24be0 72 74 0d 0a 53 45 4c 45 43 54 20 33 33 20 41 53  rt..SELECT 33 AS
24bf0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
24c00 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
24c10 49 4e 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d  IN tab1 AS cor1.
24c20 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
24c30 68 61 73 68 69 6e 67 20 74 6f 20 36 32 30 64 33  hashing to 620d3
24c40 38 34 32 38 36 65 38 32 64 31 63 36 63 38 62 31  84286e82d1c6c8b1
24c50 62 32 62 31 30 39 61 37 64 61 35 0d 0a 0d 0a 71  b2b109a7da5....q
24c60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
24c70 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
24c80 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20  + col0 * col1 * 
24c90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 57  col1 FROM tab2 W
24ca0 48 45 52 45 20 2b 20 63 6f 6c 30 20 2b 20 63 6f  HERE + col0 + co
24cb0 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 4e 4f 54 20  l2 * + col2 NOT 
24cc0 49 4e 20 28 20 2d 20 63 6f 6c 32 20 29 0d 0a 2d  IN ( - col2 )..-
24cd0 2d 2d 2d 0d 0a 32 32 38 33 31 0d 0a 32 37 31 35  ---..22831..2715
24ce0 31 38 0d 0a 36 37 32 37 0d 0a 0d 0a 71 75 65 72  18..6727....quer
24cf0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
24d00 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT + col2 * col
24d10 32 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  2 + + col1 FROM 
24d20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 34 32  tab1..----..2942
24d30 0d 0a 33 32 35 39 0d 0a 39 32 32 39 0d 0a 0d 0a  ..3259..9229....
24d40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24d50 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a  .SELECT + col0 *
24d60 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63   + col1 * cor0.c
24d70 6f 6c 31 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol1 + col2 + col
24d80 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
24d90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 36 39 36  or0..----..13696
24da0 0d 0a 32 30 38 35 0d 0a 36 35 32 31 0d 0a 0d 0a  ..2085..6521....
24db0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24dc0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63  .SELECT col0 + c
24dd0 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol0 + + cor0.col
24de0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
24df0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
24e00 2d 0d 0a 31 37 35 0d 0a 32 31 35 0d 0a 34 35 0d  -..175..215..45.
24e10 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
24e20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
24e30 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
24e40 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
24e50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24e60 30 33 38 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  038..SELECT + + 
24e70 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20 2b 20  col2 DIV col0 + 
24e80 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f  cor0.col0 DIV co
24e90 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
24ea0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
24eb0 2d 2d 0d 0a 31 0d 0a 33 0d 0a 34 0d 0a 0d 0a 73  --..1..3..4....s
24ec0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
24ed0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
24ee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
24ef0 62 65 6c 2d 31 30 33 38 0d 0a 53 45 4c 45 43 54  bel-1038..SELECT
24f00 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f 6c 30   + + col2 / col0
24f10 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63   + cor0.col0 / c
24f20 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
24f30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
24f40 2d 2d 2d 0d 0a 31 0d 0a 33 0d 0a 34 0d 0a 0d 0a  ---..1..3..4....
24f50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
24f60 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
24f70 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d   - cor0.col2 * -
24f80 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 63   col0 + col0 * c
24f90 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20  ol0 * - col2 AS 
24fa0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
24fb0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
24fc0 31 32 37 0d 0a 2d 31 35 36 30 37 38 0d 0a 2d 32  127..-156078..-2
24fd0 33 34 30 37 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  34077....onlyif 
24fe0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
24ff0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
25000 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
25010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
25020 61 62 65 6c 2d 31 30 34 30 0d 0a 53 45 4c 45 43  abel-1040..SELEC
25030 54 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  T + + col0 + - c
25040 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 2b 20 2d  ol0 DIV col0 + -
25050 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
25060 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d  cor0..----..-24.
25070 0a 35 33 0d 0a 36 36 0d 0a 0d 0a 73 6b 69 70 69  .53..66....skipi
25080 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
25090 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
250a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
250b0 31 30 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1040..SELECT + +
250c0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2f   col0 + - col0 /
250d0 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46   col0 + - col1 F
250e0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
250f0 2d 2d 2d 0d 0a 2d 32 34 0d 0a 35 33 0d 0a 36 36  ---..-24..53..66
25100 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25110 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
25120 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  l1 + + cor0.col2
25130 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
25140 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
25150 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a  or0..----..131..
25160 31 38 39 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79  189..83....query
25170 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25180 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f  CT cor0.col0 FRO
25190 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 57  M tab0 AS cor0 W
251a0 48 45 52 45 20 4e 4f 54 20 63 6f 6c 32 20 42 45  HERE NOT col2 BE
251b0 54 57 45 45 4e 20 63 6f 6c 30 20 41 4e 44 20 4e  TWEEN col0 AND N
251c0 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 38  ULL..----..35..8
251d0 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
251e0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
251f0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
25200 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
25210 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
25220 2d 31 30 34 33 0d 0a 53 45 4c 45 43 54 20 63 6f  -1043..SELECT co
25230 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l2 * col1 + - co
25240 6c 30 20 2a 20 63 6f 6c 32 20 44 49 56 20 63 6f  l0 * col2 DIV co
25250 6c 30 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f  l0 + col0 DIV co
25260 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
25270 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25280 2d 2d 0d 0a 31 31 35 32 0d 0a 31 33 35 30 0d 0a  --..1152..1350..
25290 35 31 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  514....skipif my
252a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
252b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
252c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 33  wsort label-1043
252d0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
252e0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col1 + - col0 * 
252f0 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 63 6f  col2 / col0 + co
25300 6c 30 20 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l0 / col2 AS col
25310 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
25320 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d  or0..----..1152.
25330 0a 31 33 35 30 0d 0a 35 31 34 0d 0a 0d 0a 71 75  .1350..514....qu
25340 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
25350 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
25360 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   * FROM tab2 AS 
25370 63 6f 72 30 20 57 48 45 52 45 20 2b 20 63 6f 6c  cor0 WHERE + col
25380 30 20 3c 3d 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d  0 <= ( NULL )..-
25390 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
253a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
253b0 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  LL + cor0.col2 +
253c0 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   - cor0.col2 FRO
253d0 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63 6f 72  M tab2, tab0 cor
253e0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
253f0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38 62 37  s hashing to 8b7
25400 35 31 33 36 62 32 62 35 31 63 37 37 33 34 35 63  5136b2b51c77345c
25410 30 33 38 30 34 65 63 31 63 64 61 35 63 0d 0a 0d  03804ec1cda5c...
25420 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25430 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
25440 63 6f 6c 31 20 2a 20 2b 20 74 61 62 31 2e 63 6f  col1 * + tab1.co
25450 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
25460 2d 2d 0d 0a 32 33 34 0d 0a 34 30 39 36 30 0d 0a  --..234..40960..
25470 38 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  83200....query I
25480 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25490 20 41 4c 4c 20 37 30 20 2a 20 2d 20 63 6f 6c 31   ALL 70 * - col1
254a0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
254b0 0d 0a 2d 31 31 39 30 0d 0a 2d 32 31 37 30 0d 0a  ..-1190..-2170..
254c0 2d 34 31 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -4130....query I
254d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
254e0 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 2d   col1 * col0 + -
254f0 20 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c   col2 * tab1.col
25500 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 + col2 FROM ta
25510 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 35 31 0d  b1..----..-2951.
25520 0a 2d 33 30 0d 0a 2d 36 35 34 34 0d 0a 0d 0a 71  .-30..-6544....q
25530 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25540 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
25550 32 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  2 + - col2 + col
25560 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
25570 2d 0d 0a 2d 32 33 0d 0a 2d 35 39 0d 0a 37 0d 0a  -..-23..-59..7..
25580 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
25590 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
255a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
255b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
255c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
255d0 35 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  50..SELECT - + c
255e0 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 2b 20 63  ol0 DIV col1 + c
255f0 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  or0.col1 + col1 
25600 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
25610 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25620 0a 31 34 0d 0a 32 30 0d 0a 35 32 0d 0a 0d 0a 73  .14..20..52....s
25630 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
25640 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
25650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25660 62 65 6c 2d 31 30 35 30 0d 0a 53 45 4c 45 43 54  bel-1050..SELECT
25670 20 2d 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 31   - + col0 / col1
25680 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   + cor0.col1 + c
25690 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
256a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
256b0 2d 2d 2d 0d 0a 31 34 0d 0a 32 30 0d 0a 35 32 0d  ---..14..20..52.
256c0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
256d0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
256e0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
256f0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
25700 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
25710 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25720 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT - cor0.col2 
25730 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 63 6f  + col0 * col0 co
25740 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
25750 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 0d 0a  cor0..----..22..
25760 36 30 35 38 0d 0a 36 32 30 33 0d 0a 0d 0a 71 75  6058..6203....qu
25770 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25780 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  ELECT - + cor0.c
25790 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63  ol2 * col2 + - c
257a0 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol0 + cor0.col0 
257b0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
257c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
257d0 0a 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d  .-2916..-3249..-
257e0 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9216....query I 
257f0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25800 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 2b 20  col1 * col0 * + 
25810 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
25820 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab0..----..11
25830 38 38 32 35 0d 0a 34 39 35 33 36 0d 0a 37 32 30  8825..49536..720
25840 38 31 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  811....onlyif my
25850 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
25860 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
25870 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
25880 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25890 65 6c 2d 31 30 35 34 0d 0a 53 45 4c 45 43 54 20  el-1054..SELECT 
258a0 2b 20 74 61 62 31 2e 63 6f 6c 30 20 44 49 56 20  + tab1.col0 DIV 
258b0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
258c0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  M tab1..----..1.
258d0 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  .1..1....skipif 
258e0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
258f0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
25900 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
25910 35 34 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  54..SELECT + tab
25920 31 2e 63 6f 6c 30 20 2f 20 63 6f 6c 30 20 41 53  1.col0 / col0 AS
25930 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
25940 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a  .----..1..1..1..
25950 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
25960 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
25970 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
25980 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
25990 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
259a0 35 35 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  55..SELECT - tab
259b0 30 2e 63 6f 6c 31 20 44 49 56 20 2d 20 74 61 62  0.col1 DIV - tab
259c0 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0.col2 FROM tab0
259d0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 32 0d 0a 39 37  ..----..1..2..97
259e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
259f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
25a00 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
25a10 72 74 20 6c 61 62 65 6c 2d 31 30 35 35 0d 0a 53  rt label-1055..S
25a20 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c  ELECT - tab0.col
25a30 31 20 2f 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20  1 / - tab0.col2 
25a40 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
25a50 0a 31 0d 0a 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69  .1..2..97....ski
25a60 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
25a70 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
25a80 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
25a90 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
25aa0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
25ab0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
25ac0 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31  r0.col2 + + col1
25ad0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
25ae0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
25af0 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71  19..173..98....q
25b00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25b10 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
25b20 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 28  1 * + col0 + - (
25b30 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 6c 31   col1 ) + + col1
25b40 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
25b50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a  r0..----..1040..
25b60 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  640..78....query
25b70 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25b80 43 54 20 2d 20 35 31 20 2b 20 2d 20 63 6f 6c 31  CT - 51 + - col1
25b90 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
25ba0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37 0d 0a  r0..----..-137..
25bb0 2d 31 34 32 0d 0a 2d 31 34 38 0d 0a 0d 0a 71 75  -142..-148....qu
25bc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25bd0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 36 20 2a 20  ELECT ALL + 6 * 
25be0 2d 20 63 6f 6c 32 20 2a 20 31 38 20 46 52 4f 4d  - col2 * 18 FROM
25bf0 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
25c00 0d 0a 2d 31 30 38 0d 0a 2d 33 35 36 34 0d 0a 2d  ..-108..-3564..-
25c10 38 38 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8856....query I 
25c20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25c30 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
25c40 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  + + col2 * + col
25c50 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  2 + cor0.col0 * 
25c60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
25c70 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
25c80 37 33 32 0d 0a 33 30 36 37 0d 0a 33 32 39 39 0d  732..3067..3299.
25c90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25ca0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
25cb0 4e 43 54 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c  NCT - col1 - col
25cc0 31 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  1 * col2 * - col
25cd0 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
25ce0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 37 30  ab1..----..36470
25cf0 0d 0a 34 31 38 36 0d 0a 39 39 38 32 37 0d 0a 0d  ..4186..99827...
25d00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25d10 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
25d20 54 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  T - col2 + - col
25d30 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
25d40 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
25d50 2d 31 37 31 0d 0a 2d 33 36 0d 0a 2d 35 37 0d 0a  -171..-36..-57..
25d60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25d70 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
25d80 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2a 20  col0 * + col1 * 
25d90 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 41 53 20 63  col1 - col0 AS c
25da0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
25db0 2d 2d 2d 0d 0a 2d 31 37 37 35 32 38 0d 0a 2d 33  ---..-177528..-3
25dc0 32 39 33 35 30 0d 0a 2d 37 33 37 30 39 38 0d 0a  29350..-737098..
25dd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25de0 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 31 2e 63  t..SELECT tab1.c
25df0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b  ol2 + - col2 * +
25e00 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
25e10 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
25e20 32 38 36 32 0d 0a 2d 33 31 39 32 0d 0a 2d 39 31  2862..-3192..-91
25e30 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
25e40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
25e50 53 54 49 4e 43 54 20 2b 20 36 38 20 2a 20 63 6f  STINCT + 68 * co
25e60 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 41 53 20 63  l0 - - col2 AS c
25e70 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
25e80 2d 2d 2d 0d 0a 31 36 36 35 0d 0a 32 33 38 31 0d  ---..1665..2381.
25e90 0a 36 31 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .6134....query I
25ea0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
25eb0 20 33 34 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f   34 + - col2 FRO
25ec0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab1..----..-2
25ed0 30 0d 0a 2d 32 33 0d 0a 2d 36 32 0d 0a 0d 0a 71  0..-23..-62....q
25ee0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
25ef0 53 45 4c 45 43 54 20 39 35 20 2b 20 2b 20 63 6f  SELECT 95 + + co
25f00 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d 20  l0 + + col1 * - 
25f10 38 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  82 AS col2 FROM 
25f20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 39 33  tab0..----..-693
25f30 33 0d 0a 2d 37 32 37 38 0d 0a 2d 37 38 32 34 0d  3..-7278..-7824.
25f40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
25f50 72 74 0d 0a 53 45 4c 45 43 54 20 35 36 20 2a 20  rt..SELECT 56 * 
25f60 2d 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63  - tab0.col1 AS c
25f70 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
25f80 2d 2d 2d 0d 0a 2d 34 38 31 36 0d 0a 2d 35 30 39  ---..-4816..-509
25f90 36 0d 0a 2d 35 34 33 32 0d 0a 0d 0a 71 75 65 72  6..-5432....quer
25fa0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
25fb0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
25fc0 30 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 46 52  0 - tab2.col0 FR
25fd0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab2..----..0
25fe0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25ff0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
26000 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b  .col2 * + col2 +
26010 20 31 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53   15 FROM tab0 AS
26020 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30   cor0..----..110
26030 34 0d 0a 31 36 0d 0a 36 37 33 39 0d 0a 0d 0a 71  4..16..6739....q
26040 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74  uery III rowsort
26050 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
26060 74 61 62 32 20 57 48 45 52 45 20 4e 4f 54 20 63  tab2 WHERE NOT c
26070 6f 6c 31 20 49 4e 20 28 20 2b 20 63 6f 6c 31 20  ol1 IN ( + col1 
26080 2b 20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a  + col2 )..----..
26090 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
260a0 20 74 6f 20 61 64 30 35 62 35 39 34 32 34 30 30   to ad05b5942400
260b0 64 35 65 37 61 32 31 62 33 32 33 62 33 64 61 36  d5e7a21b323b3da6
260c0 35 61 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5a45....query I 
260d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
260e0 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 46 52  DISTINCT col1 FR
260f0 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 63 6f  OM tab2 WHERE co
26100 6c 30 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  l0 <= NULL..----
26110 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26120 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
26130 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53  col0 + + col0 AS
26140 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
26150 57 48 45 52 45 20 63 6f 6c 30 20 2a 20 63 6f 6c  WHERE col0 * col
26160 31 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a  1 = NULL..----..
26170 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
26180 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
26190 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
261a0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
261b0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
261c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
261d0 43 54 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f  CT col2 col1 FRO
261e0 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54  M tab1 WHERE NOT
261f0 20 28 20 4e 55 4c 4c 20 29 20 4e 4f 54 20 42 45   ( NULL ) NOT BE
26200 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 2b  TWEEN NULL AND +
26210 20 74 61 62 31 2e 63 6f 6c 30 20 2f 20 2d 20 74   tab1.col0 / - t
26220 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  ab1.col1 + - col
26230 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  0..----....query
26240 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
26250 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
26260 20 2a 20 63 6f 6c 32 20 2b 20 74 61 62 32 2e 63   * col2 + tab2.c
26270 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
26280 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38   tab2..----..148
26290 32 0d 0a 37 30 32 0d 0a 37 35 36 0d 0a 0d 0a 71  2..702..756....q
262a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
262b0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 74 61  SELECT col0 - ta
262c0 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 46  b1.col0 * col1 F
262d0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
262e0 2d 35 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d  -576..-75..-960.
262f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26300 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
26310 20 63 6f 6c 30 20 2a 20 74 61 62 32 2e 63 6f 6c   col0 * tab2.col
26320 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
26330 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d  ab2..----..-189.
26340 0a 2d 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d  .-2028..-3002...
26350 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
26360 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
26370 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
26380 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
26390 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
263a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
263b0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
263c0 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1 col1 FROM tab1
263d0 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e   AS cor0 WHERE N
263e0 4f 54 20 28 20 4e 55 4c 4c 20 29 20 42 45 54 57  OT ( NULL ) BETW
263f0 45 45 4e 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c  EEN NULL AND NUL
26400 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69  L..----....skipi
26410 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
26420 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
26430 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
26440 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
26450 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
26460 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  ort..SELECT col0
26470 20 2d 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   - col1 col0 FRO
26480 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
26490 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75  ..-62..-62....qu
264a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
264b0 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 74  ELECT col0 + - t
264c0 61 62 32 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ab2.col0 * col0 
264d0 2b 20 2b 20 74 61 62 32 2e 63 6f 6c 32 20 41 53  + + tab2.col2 AS
264e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
264f0 0a 2d 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 35 39 38  .----..-15..-598
26500 30 0d 0a 2d 36 31 32 34 0d 0a 0d 0a 6f 6e 6c 79  0..-6124....only
26510 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
26520 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
26530 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
26540 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26550 74 20 6c 61 62 65 6c 2d 31 30 38 31 0d 0a 53 45  t label-1081..SE
26560 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 2b 20  LECT col2 DIV + 
26570 74 61 62 30 2e 63 6f 6c 30 20 2b 20 74 61 62 30  tab0.col0 + tab0
26580 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20  .col1 + col2 AS 
26590 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
265a0 2d 2d 2d 2d 0d 0a 31 32 30 0d 0a 31 37 33 0d 0a  ----..120..173..
265b0 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  98....skipif mys
265c0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
265d0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
265e0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 31 0d  sort label-1081.
265f0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 2b  .SELECT col2 / +
26600 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20 74 61 62   tab0.col0 + tab
26610 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53  0.col1 + col2 AS
26620 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
26630 0a 2d 2d 2d 2d 0d 0a 31 32 30 0d 0a 31 37 33 0d  .----..120..173.
26640 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .98....query I r
26650 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
26660 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol1 + + col2 AS 
26670 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 57  col0 FROM tab2 W
26680 48 45 52 45 20 4e 4f 54 20 2d 20 63 6f 6c 30 20  HERE NOT - col0 
26690 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f 6c 31 20  NOT IN ( + col1 
266a0 2b 20 2d 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d  + - col0 )..----
266b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
266c0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
266d0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
266e0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
266f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
26700 31 30 38 33 0d 0a 53 45 4c 45 43 54 20 74 61 62  1083..SELECT tab
26710 30 2e 63 6f 6c 32 20 44 49 56 20 63 6f 6c 32 20  0.col2 DIV col2 
26720 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
26730 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  .1..1..1....skip
26740 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
26750 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
26760 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26770 2d 31 30 38 33 0d 0a 53 45 4c 45 43 54 20 74 61  -1083..SELECT ta
26780 62 30 2e 63 6f 6c 32 20 2f 20 63 6f 6c 32 20 46  b0.col2 / col2 F
26790 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
267a0 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  1..1..1....query
267b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
267c0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
267d0 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
267e0 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20 63  tab0 WHERE NOT c
267f0 6f 6c 30 20 4e 4f 54 20 49 4e 20 28 20 2d 20 74  ol0 NOT IN ( - t
26800 61 62 30 2e 63 6f 6c 30 20 2b 20 74 61 62 30 2e  ab0.col0 + tab0.
26810 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20  col0 + - col0 * 
26820 2d 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 30 2e  - col1 * - tab0.
26830 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col2 )..----....
26840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26850 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b  .SELECT - col0 +
26860 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30   - col1 + + col0
26870 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
26880 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d  ..-17..-31..-59.
26890 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
268a0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
268b0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
268c0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
268d0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
268e0 30 38 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  086..SELECT col1
268f0 20 44 49 56 20 74 61 62 31 2e 63 6f 6c 30 20 2b   DIV tab1.col0 +
26900 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46   col2 + - col0 F
26910 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
26920 2d 37 0d 0a 31 36 0d 0a 35 39 0d 0a 0d 0a 73 6b  -7..16..59....sk
26930 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
26940 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
26950 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
26960 65 6c 2d 31 30 38 36 0d 0a 53 45 4c 45 43 54 20  el-1086..SELECT 
26970 63 6f 6c 31 20 2f 20 74 61 62 31 2e 63 6f 6c 30  col1 / tab1.col0
26980 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   + col2 + - col0
26990 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
269a0 0d 0a 2d 37 0d 0a 31 36 0d 0a 35 39 0d 0a 0d 0a  ..-7..16..59....
269b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
269c0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2d  .SELECT + col0 -
269d0 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20   - tab1.col0 AS 
269e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 57  col1 FROM tab1 W
269f0 48 45 52 45 20 28 20 2b 20 63 6f 6c 32 20 29 20  HERE ( + col2 ) 
26a00 42 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c 20 29  BETWEEN ( NULL )
26a10 20 41 4e 44 20 28 20 63 6f 6c 31 20 2a 20 2d 20   AND ( col1 * - 
26a20 63 6f 6c 32 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col2 )..----....
26a30 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
26a40 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
26a50 20 74 61 62 30 20 57 48 45 52 45 20 4e 4f 54 20   tab0 WHERE NOT 
26a60 63 6f 6c 30 20 49 4e 20 28 20 63 6f 6c 30 20 29  col0 IN ( col0 )
26a70 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66  ..----....skipif
26a80 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
26a90 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
26aa0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
26ab0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
26ac0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
26ad0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
26ae0 2b 20 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f  + col2 * tab1.co
26af0 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l0 col2 FROM tab
26b00 31 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d 0a 33 37  1..----..216..37
26b10 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 6f 6e 6c 79  05..7776....only
26b20 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
26b30 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
26b40 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
26b50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26b60 74 20 6c 61 62 65 6c 2d 31 30 39 30 0d 0a 53 45  t label-1090..SE
26b70 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 44 49  LECT - + col0 DI
26b80 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  V - col1 AS col2
26b90 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
26ba0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
26bb0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
26bc0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
26bd0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
26be0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 30 0d 0a  ort label-1090..
26bf0 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20  SELECT - + col0 
26c00 2f 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  / - col1 AS col2
26c10 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
26c20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
26c30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
26c40 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
26c50 20 2b 20 32 20 2b 20 2b 20 63 6f 6c 31 20 2a 20   + 2 + + col1 * 
26c60 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  - col0 * + col0 
26c70 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
26c80 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
26c90 30 36 30 39 35 0d 0a 2d 31 35 31 37 0d 0a 2d 33  06095..-1517..-3
26ca0 35 38 39 35 34 0d 0a 0d 0a 71 75 65 72 79 20 49  58954....query I
26cb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26cc0 20 41 4c 4c 20 2d 20 33 39 20 2a 20 63 6f 6c 31   ALL - 39 * col1
26cd0 20 2b 20 2d 20 36 35 20 2b 20 2d 20 63 6f 6c 30   + - 65 + - col0
26ce0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
26cf0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 32 0d  b1..----..-1082.
26d00 0a 2d 35 31 39 0d 0a 2d 36 35 32 0d 0a 0d 0a 71  .-519..-652....q
26d10 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26d20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
26d30 2b 20 34 39 20 2b 20 2d 20 63 6f 6c 31 20 41 53  + 49 + - col1 AS
26d40 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
26d50 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
26d60 33 0d 0a 33 36 0d 0a 33 39 0d 0a 0d 0a 71 75 65  3..36..39....que
26d70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26d80 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 28 20  LECT - col0 + ( 
26d90 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31  col1 ) FROM tab1
26da0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
26db0 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65  ..-67..23....que
26dc0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
26dd0 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  LECT - cor0.col2
26de0 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31   * - col1 - col1
26df0 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46   * + cor0.col0 F
26e00 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
26e10 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 36 38 0d 0a 2d  ..----..-3068..-
26e20 36 39 37 0d 0a 36 32 30 0d 0a 0d 0a 6f 6e 6c 79  697..620....only
26e30 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
26e40 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
26e50 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
26e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26e70 74 20 6c 61 62 65 6c 2d 31 30 39 36 0d 0a 53 45  t label-1096..SE
26e80 4c 45 43 54 20 2b 20 63 6f 6c 32 20 44 49 56 20  LECT + col2 DIV 
26e90 2d 20 39 32 20 2d 20 63 6f 6c 31 20 41 53 20 63  - 92 - col1 AS c
26ea0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
26eb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36   cor0..----..-86
26ec0 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b  ..-91..-97....sk
26ed0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
26ee0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
26ef0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
26f00 65 6c 2d 31 30 39 36 0d 0a 53 45 4c 45 43 54 20  el-1096..SELECT 
26f10 2b 20 63 6f 6c 32 20 2f 20 2d 20 39 32 20 2d 20  + col2 / - 92 - 
26f20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
26f30 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
26f40 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a  ----..-86..-91..
26f50 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -97....onlyif my
26f60 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
26f70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
26f80 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
26f90 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
26fa0 65 6c 2d 31 30 39 37 0d 0a 53 45 4c 45 43 54 20  el-1097..SELECT 
26fb0 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c  DISTINCT + - col
26fc0 30 20 44 49 56 20 2b 20 43 41 53 54 28 20 63 6f  0 DIV + CAST( co
26fd0 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l0 AS SIGNED ) A
26fe0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
26ff0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27000 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  -1....skipif mys
27010 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
27020 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
27030 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 37 0d  sort label-1097.
27040 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
27050 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2b 20 43 41   + - col0 / + CA
27060 53 54 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54  ST ( col0 AS INT
27070 45 47 45 52 20 29 20 41 53 20 63 6f 6c 30 20 46  EGER ) AS col0 F
27080 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
27090 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 0d 0a 71 75  ..----..-1....qu
270a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
270b0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
270c0 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 28 20  l1 * + col0 + ( 
270d0 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30  col0 ) FROM tab0
270e0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38   cor0..----..208
270f0 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a 0d  8..3430..8188...
27100 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27110 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
27120 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  T + col1 * cor0.
27130 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
27140 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
27150 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31 36 39 0d 0a  ----..100..169..
27160 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  676....query I r
27170 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
27180 4c 4c 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 32  LL + col2 - col2
27190 20 2a 20 28 20 63 6f 6c 30 20 29 20 46 52 4f 4d   * ( col0 ) FROM
271a0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab1..----..-10
271b0 38 0d 0a 2d 33 35 39 31 0d 0a 2d 37 35 38 34 0d  8..-3591..-7584.
271c0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
271d0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
271e0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
271f0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
27200 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
27210 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27220 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ECT + col1 * col
27230 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 + + col2 * col
27240 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  2 col2 FROM tab2
27250 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27260 32 37 38 37 0d 0a 35 32 37 38 0d 0a 39 34 36 0d  2787..5278..946.
27270 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27280 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
27290 4e 43 54 20 2d 20 31 37 20 2a 20 2d 20 63 6f 6c  NCT - 17 * - col
272a0 31 20 2d 20 31 39 20 46 52 4f 4d 20 74 61 62 30  1 - 19 FROM tab0
272b0 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 33 0d 0a 31 35  ..----..1443..15
272c0 32 38 0d 0a 31 36 33 30 0d 0a 0d 0a 71 75 65 72  28..1630....quer
272d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
272e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
272f0 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20  1.col0 * col1 + 
27300 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2d 20  - tab1.col0 * - 
27310 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  col2 - col2 FROM
27320 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 36   tab1..----..186
27330 0d 0a 34 32 33 31 0d 0a 38 36 32 34 0d 0a 0d 0a  ..4231..8624....
27340 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27350 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61  .SELECT ALL - ta
27360 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b0.col1 FROM tab
27370 30 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  0, tab2, tab2 AS
27380 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
27390 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
273a0 6f 20 64 34 63 36 37 33 62 37 34 34 34 65 62 39  o d4c673b7444eb9
273b0 39 32 37 65 63 36 33 31 37 35 62 34 33 63 36 62  927ec63175b43c6b
273c0 38 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  84....onlyif mys
273d0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
273e0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
273f0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
27400 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
27410 6c 2d 31 31 30 35 0d 0a 53 45 4c 45 43 54 20 2d  l-1105..SELECT -
27420 20 39 20 44 49 56 20 2b 20 74 61 62 31 2e 63 6f   9 DIV + tab1.co
27430 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
27440 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab1..----..0..0
27450 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
27460 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
27470 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
27480 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 35  wsort label-1105
27490 0d 0a 53 45 4c 45 43 54 20 2d 20 39 20 2f 20 2b  ..SELECT - 9 / +
274a0 20 74 61 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f   tab1.col1 AS co
274b0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
274c0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
274d0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
274e0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
274f0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
27500 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
27510 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
27520 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27530 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 38 38 20  DISTINCT + - 88 
27540 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  * cor0.col1 + co
27550 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f  r0.col2 col1 FRO
27560 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
27570 2d 0d 0a 2d 31 34 35 38 0d 0a 2d 32 37 30 31 0d  -..-1458..-2701.
27580 0a 2d 35 31 36 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-5166....onlyif
27590 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
275a0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
275b0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
275c0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
275d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
275e0 65 6c 2d 31 31 30 37 0d 0a 53 45 4c 45 43 54 20  el-1107..SELECT 
275f0 41 4c 4c 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  ALL - CAST( NULL
27600 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 37   AS SIGNED ) * 7
27610 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  3 col0 FROM tab0
27620 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27630 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
27640 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
27650 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
27660 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
27670 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
27680 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
27690 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
276a0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
276b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
276c0 6c 2d 31 31 30 37 0d 0a 53 45 4c 45 43 54 20 41  l-1107..SELECT A
276d0 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c  LL - CAST ( NULL
276e0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20   AS INTEGER ) * 
276f0 37 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  73 col0 FROM tab
27700 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
27710 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
27720 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
27730 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
27740 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
27750 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41  ort..SELECT - CA
27760 53 54 20 28 20 63 6f 6c 32 20 41 53 20 52 45 41  ST ( col2 AS REA
27770 4c 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  L ) AS col0 FROM
27780 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
27790 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d  ---..-54..-57..-
277a0 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  96....skipif pos
277b0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
277c0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
277d0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
277e0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
277f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27800 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27810 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  + col2 + + col0 
27820 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  + - cor0.col1 * 
27830 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col0 col1 FROM t
27840 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
27850 2d 0d 0a 2d 32 30 30 37 0d 0a 2d 33 33 35 39 0d  -..-2007..-3359.
27860 0a 2d 37 39 32 38 0d 0a 0d 0a 71 75 65 72 79 20  .-7928....query 
27870 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27880 54 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2b  T ALL ( col1 ) +
27890 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
278a0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
278b0 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a  .----..109..67..
278c0 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
278d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
278e0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
278f0 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  + col0 + - col1 
27900 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  * col2 * + cor0.
27910 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
27920 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
27930 32 37 38 38 0d 0a 2d 32 37 35 35 30 0d 0a 2d 34  2788..-27550..-4
27940 31 39 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  1912....query I 
27950 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27960 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ALL + col0 * + c
27970 6f 6c 32 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol2 - col0 * col
27980 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
27990 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 38 0d  or0..----..-448.
279a0 0a 31 32 38 30 0d 0a 31 35 33 0d 0a 0d 0a 71 75  .1280..153....qu
279b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
279c0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
279d0 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  l0 * col1 + col2
279e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
279f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 33 36 0d 0a  r0..----..1136..
27a00 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a 71 75 65 72  132..697....quer
27a10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27a20 45 43 54 20 2b 20 2d 20 34 39 20 2a 20 2b 20 63  ECT + - 49 * + c
27a30 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
27a40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
27a50 37 36 0d 0a 2d 31 37 31 35 0d 0a 2d 34 33 36 31  76..-1715..-4361
27a60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27a70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
27a80 2b 20 63 6f 6c 30 20 2b 20 33 38 20 2a 20 63 6f  + col0 + 38 * co
27a90 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
27aa0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 35  tab2..----..1185
27ab0 0d 0a 32 33 32 30 0d 0a 37 32 35 0d 0a 0d 0a 71  ..2320..725....q
27ac0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27ad0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
27ae0 32 36 20 2a 20 37 39 20 2a 20 2d 20 63 6f 6c 30  26 * 79 * - col0
27af0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63   + cor0.col0 * c
27b00 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
27b10 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
27b20 31 37 34 38 38 35 0d 0a 2d 34 38 37 32 30 0d 0a  174885..-48720..
27b30 2d 37 30 36 36 35 0d 0a 0d 0a 71 75 65 72 79 20  -70665....query 
27b40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27b50 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c  T ALL + cor0.col
27b60 30 20 2a 20 2d 20 36 38 20 2d 20 2b 20 63 6f 72  0 * - 68 - + cor
27b70 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52  0.col0 * col0 FR
27b80 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
27b90 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 34 30 0d 0a 2d  .----..-11840..-
27ba0 32 31 33 0d 0a 2d 38 34 34 38 0d 0a 0d 0a 71 75  213..-8448....qu
27bb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27bc0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f  ELECT ALL - - co
27bd0 6c 30 20 2a 20 63 6f 6c 31 20 2d 20 63 6f 6c 32  l0 * col1 - col2
27be0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
27bf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 33 31 0d 0a  r0..----..2031..
27c00 33 33 39 34 0d 0a 38 30 31 37 0d 0a 0d 0a 73 6b  3394..8017....sk
27c10 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
27c20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
27c30 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
27c40 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
27c50 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
27c60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
27c70 4c 4c 20 36 36 20 63 6f 6c 31 20 46 52 4f 4d 20  LL 66 col1 FROM 
27c80 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
27c90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
27ca0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 32 39  es hashing to 29
27cb0 37 39 34 39 31 35 62 35 38 35 65 65 61 38 34 38  794915b585eea848
27cc0 61 64 36 37 30 30 37 35 34 35 32 63 38 38 0d 0a  ad670075452c88..
27cd0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
27ce0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
27cf0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
27d00 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c  ..SELECT ( + col
27d10 32 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 43  2 ) * - col1 + C
27d20 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41 53 20  AST ( - col0 AS 
27d30 52 45 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46  REAL ) AS col0 F
27d40 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
27d50 2d 31 33 32 38 0d 0a 2d 31 34 30 37 0d 0a 2d 36  -1328..-1407..-6
27d60 33 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  34....onlyif mys
27d70 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
27d80 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
27d90 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
27da0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
27db0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
27dc0 31 32 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  121..SELECT DIST
27dd0 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  INCT - cor0.col1
27de0 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 43 41   * - col2 + - CA
27df0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
27e00 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30 20 63  ED ) FROM tab0 c
27e10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
27e20 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
27e30 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
27e40 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27e50 74 20 6c 61 62 65 6c 2d 31 31 32 31 0d 0a 53 45  t label-1121..SE
27e60 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
27e70 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
27e80 6c 32 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  l2 + - CAST ( NU
27e90 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
27ea0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
27eb0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
27ec0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
27ed0 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
27ee0 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
27ef0 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
27f00 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
27f10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
27f20 20 39 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63   90 * col2 + - c
27f30 6f 6c 32 20 2a 20 2b 20 32 31 20 63 6f 6c 32 20  ol2 * + 21 col2 
27f40 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
27f50 0a 2d 31 30 36 35 36 0d 0a 2d 35 39 39 34 0d 0a  .-10656..-5994..
27f60 2d 36 33 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  -6327....skipif 
27f70 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
27f80 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
27f90 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
27fa0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
27fb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27fc0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
27fd0 43 54 20 2d 20 2b 20 37 32 20 2a 20 63 6f 6c 32  CT - + 72 * col2
27fe0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
27ff0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
28000 32 33 37 36 0d 0a 2d 35 39 30 34 0d 0a 2d 37 32  2376..-5904..-72
28010 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28020 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
28030 2d 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  - ( + cor0.col0 
28040 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ) + + col1 FROM 
28050 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
28060 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36 32 0d 0a 0d  --..2..62..62...
28070 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
28080 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b 20 38  ..SELECT + ( + 8
28090 36 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  6 ) + cor0.col1 
280a0 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  * + col0 * - col
280b0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
280c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 33 39  or0..----..-3639
280d0 34 0d 0a 2d 34 31 32 36 0d 0a 2d 39 39 37 35 34  4..-4126..-99754
280e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
280f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
28100 49 4e 43 54 20 2d 20 28 20 2d 20 63 6f 72 30 2e  INCT - ( - cor0.
28110 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46  col0 ) AS col2 F
28120 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
28130 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37  ..----..7..78..7
28140 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
28150 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
28160 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
28170 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
28180 0d 0a 31 36 37 34 0d 0a 31 37 36 37 0d 0a 32 39  ..1674..1767..29
28190 37 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  76....onlyif mys
281a0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
281b0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
281c0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
281d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
281e0 6c 2d 31 31 32 38 0d 0a 53 45 4c 45 43 54 20 36  l-1128..SELECT 6
281f0 37 20 44 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c  7 DIV col1 + col
28200 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
28210 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
28220 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
28230 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
28240 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28250 6c 61 62 65 6c 2d 31 31 32 38 0d 0a 53 45 4c 45  label-1128..SELE
28260 43 54 20 36 37 20 2f 20 63 6f 6c 31 20 2b 20 63  CT 67 / col1 + c
28270 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
28280 2d 2d 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d  ---..24..35..89.
28290 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
282a0 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e  rt..SELECT tab0.
282b0 63 6f 6c 31 20 2b 20 2d 20 34 30 20 2a 20 63 6f  col1 + - 40 * co
282c0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
282d0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 35  tab0..----..-335
282e0 34 0d 0a 2d 33 35 34 39 0d 0a 2d 33 37 38 33 0d  4..-3549..-3783.
282f0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28300 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
28310 4e 43 54 20 2d 20 28 20 2d 20 38 20 29 20 2a 20  NCT - ( - 8 ) * 
28320 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41 53 20 63  col1 * col1 AS c
28330 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
28340 2d 2d 2d 0d 0a 31 33 35 32 0d 0a 35 34 30 38 0d  ---..1352..5408.
28350 0a 38 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .800....onlyif m
28360 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
28370 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
28380 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
28390 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
283a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
283b0 2d 31 31 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1131..SELECT - 
283c0 43 41 53 54 28 20 38 33 20 41 53 20 53 49 47 4e  CAST( 83 AS SIGN
283d0 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  ED ) FROM tab2..
283e0 2d 2d 2d 2d 0d 0a 2d 38 33 0d 0a 2d 38 33 0d 0a  ----..-83..-83..
283f0 2d 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -83....skipif my
28400 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
28410 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
28420 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 31  wsort label-1131
28430 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
28440 28 20 38 33 20 41 53 20 49 4e 54 45 47 45 52 20  ( 83 AS INTEGER 
28450 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
28460 2d 0d 0a 2d 38 33 0d 0a 2d 38 33 0d 0a 2d 38 33  -..-83..-83..-83
28470 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28480 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 32  ort..SELECT + 92
28490 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
284a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
284b0 0a 31 35 36 0d 0a 31 37 32 0d 0a 39 35 0d 0a 0d  .156..172..95...
284c0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
284d0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
284e0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
284f0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
28500 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
28510 6f 72 74 20 6c 61 62 65 6c 2d 31 31 33 33 0d 0a  ort label-1133..
28520 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53  SELECT ALL - CAS
28530 54 28 20 2d 20 63 6f 6c 32 20 41 53 20 53 49 47  T( - col2 AS SIG
28540 4e 45 44 20 29 20 2a 20 2d 20 74 61 62 30 2e 63  NED ) * - tab0.c
28550 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20  ol2 * + col0 AS 
28560 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
28570 2d 2d 2d 2d 0d 0a 2d 32 36 31 33 36 0d 0a 2d 33  ----..-26136..-3
28580 35 0d 0a 2d 35 39 38 34 33 36 0d 0a 0d 0a 73 6b  5..-598436....sk
28590 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
285a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
285b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
285c0 65 6c 2d 31 31 33 33 0d 0a 53 45 4c 45 43 54 20  el-1133..SELECT 
285d0 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 2d 20 63  ALL - CAST ( - c
285e0 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
285f0 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a   * - tab0.col2 *
28600 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
28610 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
28620 0a 2d 32 36 31 33 36 0d 0a 2d 33 35 0d 0a 2d 35  .-26136..-35..-5
28630 39 38 34 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  98436....query I
28640 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28650 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 2b   col0 * - col2 +
28660 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
28670 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
28680 0a 2d 31 39 36 0d 0a 2d 32 31 30 36 0d 0a 2d 33  .-196..-2106..-3
28690 30 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  081....skipif po
286a0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
286b0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
286c0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
286d0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
286e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
286f0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
28700 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 63   + col0 * col1 c
28710 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
28720 2d 2d 2d 0d 0a 32 30 33 31 0d 0a 33 33 39 34 0d  ---..2031..3394.
28730 0a 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  .8017....query I
28740 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28750 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20   ALL - col1 * - 
28760 28 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 29 20  ( + tab1.col2 ) 
28770 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
28780 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31  1..----..1248..1
28790 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72  404..570....quer
287a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
287b0 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 72 30  ECT ALL - - cor0
287c0 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d  .col2 * col0 + -
287d0 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63   cor0.col0 - - c
287e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol2 FROM tab2 co
287f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37 36 0d 0a  r0..----..1976..
28800 32 30 39 0d 0a 32 39 36 31 0d 0a 0d 0a 73 6b 69  209..2961....ski
28810 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
28820 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
28830 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
28840 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
28850 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
28860 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
28870 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  L + col2 + col2 
28880 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  * col1 col2 FROM
28890 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
288a0 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d  ---..2871..7544.
288b0 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .98....skipif po
288c0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
288d0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
288e0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
288f0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
28900 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
28910 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
28920 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  l0 - col2 * + co
28930 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l2 col0 FROM tab
28940 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
28950 31 31 33 0d 0a 2d 33 36 0d 0a 2d 36 38 31 33 0d  113..-36..-6813.
28960 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28970 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
28980 4e 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 63  NCT - - col0 + c
28990 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
289a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
289b0 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37  ---..171..36..57
289c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
289d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
289e0 49 4e 43 54 20 39 36 20 46 52 4f 4d 20 74 61 62  INCT 96 FROM tab
289f0 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
28a00 0a 2d 2d 2d 2d 0d 0a 39 36 0d 0a 0d 0a 71 75 65  .----..96....que
28a10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28a20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
28a30 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f  cor0.col0 * - co
28a40 6c 32 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29 20  l2 * - ( col0 ) 
28a50 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
28a60 2d 2d 2d 2d 0d 0a 2d 31 33 32 33 0d 0a 2d 31 35  ----..-1323..-15
28a70 38 31 38 34 0d 0a 2d 32 33 37 31 35 38 0d 0a 0d  8184..-237158...
28a80 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
28a90 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
28aa0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
28ab0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
28ac0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34  owsort label-114
28ad0 33 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f  3..SELECT - + co
28ae0 6c 32 20 44 49 56 20 38 39 20 63 6f 6c 32 20 46  l2 DIV 89 col2 F
28af0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
28b00 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30  ..----..-1..0..0
28b10 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
28b20 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
28b30 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
28b40 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
28b50 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
28b60 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
28b70 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
28b80 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28b90 6c 2d 31 31 34 33 0d 0a 53 45 4c 45 43 54 20 2d  l-1143..SELECT -
28ba0 20 2b 20 63 6f 6c 32 20 2f 20 38 39 20 63 6f 6c   + col2 / 89 col
28bb0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
28bc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 30  or0..----..-1..0
28bd0 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
28be0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
28bf0 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
28c00 31 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 41  1 + + ( col0 ) A
28c10 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
28c20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
28c30 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71  137..38..96....q
28c40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28c50 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20  SELECT + - col1 
28c60 2a 20 28 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63  * ( col1 ) + + c
28c70 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
28c80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
28c90 2d 2d 2d 0d 0a 2d 31 35 36 0d 0a 2d 36 35 30 0d  ---..-156..-650.
28ca0 0a 2d 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-90....skipif p
28cb0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
28cc0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
28cd0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
28ce0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
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 44 49 53 54 49 4e 43  ..SELECT DISTINC
28d10 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  T - col0 + col2 
28d20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  + col0 col2 FROM
28d30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
28d40 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
28d50 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28d60 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
28d70 4e 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d  NCT - + col2 + -
28d80 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63   col2 * + cor0.c
28d90 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
28da0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
28db0 2d 2d 2d 0d 0a 2d 31 34 38 32 0d 0a 2d 37 30 32  ---..-1482..-702
28dc0 0d 0a 2d 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20  ..-756....query 
28dd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28de0 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 38  T + + col0 * - 8
28df0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
28e00 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
28e10 2d 0d 0a 2d 31 39 34 34 0d 0a 2d 32 38 33 35 0d  -..-1944..-2835.
28e20 0a 2d 37 32 30 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-7209....onlyif
28e30 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
28e40 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
28e50 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
28e60 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
28e70 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28e80 65 6c 2d 31 31 34 39 0d 0a 53 45 4c 45 43 54 20  el-1149..SELECT 
28e90 41 4c 4c 20 2b 20 43 41 53 54 28 20 63 6f 6c 32  ALL + CAST( col2
28ea0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63   AS SIGNED ) - c
28eb0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
28ec0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   cor0..----..-53
28ed0 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b 69  ..-9..-96....ski
28ee0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
28ef0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
28f00 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28f10 6c 2d 31 31 34 39 0d 0a 53 45 4c 45 43 54 20 41  l-1149..SELECT A
28f20 4c 4c 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 32  LL + CAST ( col2
28f30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20   AS INTEGER ) - 
28f40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
28f50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
28f60 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e  3..-9..-96....on
28f70 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
28f80 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
28f90 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
28fa0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
28fb0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 35 30 0d 0a  ort label-1150..
28fc0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28fd0 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41  + CAST( + col1 A
28fe0 53 20 53 49 47 4e 45 44 20 29 20 44 49 56 20 2d  S SIGNED ) DIV -
28ff0 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63   col1 - - cor0.c
29000 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
29010 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a   cor0..----..6..
29020 37 37 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66  77..78....skipif
29030 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
29040 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
29050 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29060 31 35 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  150..SELECT DIST
29070 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20 2b 20  INCT + CAST ( + 
29080 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
29090 29 20 2f 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 63  ) / - col1 - - c
290a0 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
290b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
290c0 0d 0a 36 0d 0a 37 37 0d 0a 37 38 0d 0a 0d 0a 71  ..6..77..78....q
290d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
290e0 53 45 4c 45 43 54 20 28 20 34 31 20 29 20 2b 20  SELECT ( 41 ) + 
290f0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  + cor0.col2 * - 
29100 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
29110 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
29120 2d 0d 0a 2d 31 30 34 38 0d 0a 2d 36 36 38 33 0d  -..-1048..-6683.
29130 0a 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .40....query I r
29140 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
29150 20 36 30 20 2b 20 35 39 20 41 53 20 63 6f 6c 30   60 + 59 AS col0
29160 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
29170 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
29180 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..-1....skipif p
29190 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
291a0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
291b0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
291c0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
291d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
291e0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
291f0 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20  col2 * - col0 * 
29200 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20  - col1 + - col0 
29210 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  * col1 * col1 + 
29220 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col2 col2 FROM t
29230 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
29240 2d 0d 0a 2d 31 34 30 31 30 34 35 0d 0a 2d 32 34  -..-1401045..-24
29250 35 35 38 33 0d 0a 2d 33 33 32 37 30 39 0d 0a 0d  5583..-332709...
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 2d 20 28 20 63 6f 6c  ..SELECT - ( col
29280 31 20 29 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  1 ) * + col1 FRO
29290 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
292a0 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30  396..-8281..-940
292b0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
292c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33  sort..SELECT - 3
292d0 33 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  3 * - col1 FROM 
292e0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38  tab0..----..2838
292f0 0d 0a 33 30 30 33 0d 0a 33 32 30 31 0d 0a 0d 0a  ..3003..3201....
29300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29310 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63  .SELECT + cor0.c
29320 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 * cor0.col1 
29330 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53  * + cor0.col1 AS
29340 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c   col2 FROM tab0,
29350 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
29360 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
29370 73 68 69 6e 67 20 74 6f 20 66 65 66 35 35 66 65  shing to fef55fe
29380 31 65 32 64 66 33 39 30 63 66 33 64 39 30 35 38  1e2df390cf3d9058
29390 62 63 35 35 36 39 30 33 37 0d 0a 0d 0a 71 75 65  bc5569037....que
293a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
293b0 4c 45 43 54 20 41 4c 4c 20 2b 20 38 38 20 2a 20  LECT ALL + 88 * 
293c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
293d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  S cor0..----..21
293e0 31 32 0d 0a 33 30 38 30 0d 0a 37 38 33 32 0d 0a  12..3080..7832..
293f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29400 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
29410 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2a 20 63 6f  col0 * col1 * co
29420 72 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31  r0.col1 + - col1
29430 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
29440 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
29450 0d 0a 2d 31 33 35 33 33 0d 0a 2d 32 30 35 34 0d  ..-13533..-2054.
29460 0a 2d 36 34 31 30 0d 0a 0d 0a 71 75 65 72 79 20  .-6410....query 
29470 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29480 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  T col2 * col1 + 
29490 63 6f 6c 30 20 2a 20 2d 20 31 31 20 2a 20 2b 20  col0 * - 11 * + 
294a0 33 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  38 AS col2 FROM 
294b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
294c0 2d 2d 0d 0a 2d 31 34 35 33 33 0d 0a 2d 32 39 37  --..-14533..-297
294d0 34 30 0d 0a 2d 37 31 39 34 0d 0a 0d 0a 73 6b 69  40..-7194....ski
294e0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
294f0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
29500 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
29510 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
29520 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
29530 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
29540 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20  L cor0.col2 * - 
29550 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
29560 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
29570 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a  -..-162..-3648..
29580 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -7680....query I
29590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
295a0 20 2b 20 33 30 20 2b 20 34 20 46 52 4f 4d 20 74   + 30 + 4 FROM t
295b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
295c0 2d 0d 0a 33 34 0d 0a 33 34 0d 0a 33 34 0d 0a 0d  -..34..34..34...
295d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
295e0 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
295f0 32 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c  2 - - col2 * col
29600 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
29610 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
29620 2d 0d 0a 31 36 32 0d 0a 32 30 30 32 0d 0a 32 39  -..162..2002..29
29630 36 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  64....onlyif mys
29640 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
29650 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
29660 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
29670 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
29680 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29690 31 36 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  163..SELECT DIST
296a0 49 4e 43 54 20 2d 20 43 41 53 54 28 20 63 6f 6c  INCT - CAST( col
296b0 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  0 AS SIGNED ) + 
296c0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
296d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
296e0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
296f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
29700 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
29710 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36 33 0d 0a  ort label-1163..
29720 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
29730 2d 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53  - CAST ( col0 AS
29740 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2b 20 63   INTEGER ) + + c
29750 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
29760 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
29770 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29780 74 0d 0a 53 45 4c 45 43 54 20 39 33 20 2b 20 2b  t..SELECT 93 + +
29790 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   ( col2 ) FROM t
297a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
297b0 2d 0d 0a 31 34 37 0d 0a 31 35 30 0d 0a 31 38 39  -..147..150..189
297c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
297d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
297e0 49 4e 43 54 20 2b 20 37 35 20 2b 20 2b 20 28 20  INCT + 75 + + ( 
297f0 2d 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63 6f 72  - col1 ) + + cor
29800 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20  0.col0 * + col0 
29810 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * + col1 AS col2
29820 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
29830 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 30 33  r0..----..118803
29840 0d 0a 34 39 35 32 35 0d 0a 37 32 30 37 39 35 0d  ..49525..720795.
29850 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
29860 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
29870 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
29880 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
29890 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
298a0 31 36 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  166..SELECT ALL 
298b0 2b 20 74 61 62 31 2e 63 6f 6c 30 20 44 49 56 20  + tab1.col0 DIV 
298c0 63 6f 6c 32 20 2d 20 74 61 62 31 2e 63 6f 6c 30  col2 - tab1.col0
298d0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
298e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36  b1..----..-3..-6
298f0 33 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  3..-80....skipif
29900 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
29910 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
29920 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
29930 31 36 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  166..SELECT ALL 
29940 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2f 20 63 6f  + tab1.col0 / co
29950 6c 32 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 41  l2 - tab1.col0 A
29960 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
29970 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 33 0d  ..----..-3..-63.
29980 0a 2d 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-80....onlyif m
29990 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
299a0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
299b0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
299c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
299d0 62 65 6c 2d 31 31 36 37 0d 0a 53 45 4c 45 43 54  bel-1167..SELECT
299e0 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a   - col1 + col2 *
299f0 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31   + col1 DIV col1
29a00 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
29a10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37  r0..----..28..47
29a20 0d 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..83....skipif m
29a30 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29a40 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
29a50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 36  owsort label-116
29a60 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  7..SELECT - col1
29a70 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   + col2 * + col1
29a80 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   / col1 FROM tab
29a90 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
29aa0 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71  .28..47..83....q
29ab0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
29ac0 53 45 4c 45 43 54 20 2d 20 34 35 20 2b 20 2b 20  SELECT - 45 + + 
29ad0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
29ae0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
29af0 2d 2d 2d 2d 0d 0a 2d 34 32 0d 0a 31 39 0d 0a 33  ----..-42..19..3
29b00 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  5....query I row
29b10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
29b20 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63  TINCT + col1 + c
29b30 6f 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 31 20  ol1 * tab0.col1 
29b40 2a 20 31 38 20 41 53 20 63 6f 6c 30 20 46 52 4f  * 18 AS col0 FRO
29b50 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab0..----..13
29b60 33 32 31 34 0d 0a 31 34 39 31 34 39 0d 0a 31 36  3214..149149..16
29b70 39 34 35 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  9459....skipif m
29b80 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
29b90 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
29ba0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 43  owsort..SELECT C
29bb0 41 53 54 20 28 20 2b 20 39 20 41 53 20 52 45 41  AST ( + 9 AS REA
29bc0 4c 20 29 20 2d 20 2b 20 63 6f 6c 31 20 2f 20 2d  L ) - + col1 / -
29bd0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
29be0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
29bf0 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 39 0d 0a 39 0d  .----..17..9..9.
29c00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29c10 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34  rt..SELECT - - 4
29c20 35 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  5 + - col1 * - c
29c30 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
29c40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
29c50 36 0d 0a 33 33 34 0d 0a 33 35 32 36 0d 0a 0d 0a  6..334..3526....
29c60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29c70 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
29c80 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20   - cor0.col2 AS 
29c90 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
29ca0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
29cb0 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
29cc0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d  ----..-1..-33..-
29cd0 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
29ce0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
29cf0 28 20 2b 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63  ( + col1 ) + - c
29d00 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
29d10 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29d20 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a 2d  ---..-29..-74..-
29d30 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
29d40 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
29d50 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  + col0 + + col1 
29d60 2a 20 2b 20 28 20 2d 20 28 20 2d 20 63 6f 6c 30  * + ( - ( - col0
29d70 20 29 20 2a 20 2b 20 63 6f 6c 30 20 29 20 41 53   ) * + col0 ) AS
29d80 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
29d90 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
29da0 31 38 37 39 30 0d 0a 34 39 35 31 32 0d 0a 37 32  18790..49512..72
29db0 30 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0722....query I 
29dc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29dd0 2b 20 63 6f 6c 32 20 2a 20 28 20 28 20 2b 20 63  + col2 * ( ( + c
29de0 6f 6c 31 20 29 20 29 20 46 52 4f 4d 20 74 61 62  ol1 ) ) FROM tab
29df0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
29e00 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d  .2838..7462..97.
29e10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29e20 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  rt..SELECT col0 
29e30 2b 20 28 20 2b 20 32 30 20 2b 20 2b 20 63 6f 6c  + ( + 20 + + col
29e40 31 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  1 ) FROM tab0..-
29e50 2d 2d 2d 0d 0a 31 33 30 0d 0a 31 35 32 0d 0a 32  ---..130..152..2
29e60 30 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  00....onlyif mys
29e70 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
29e80 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
29e90 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
29ea0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
29eb0 6c 2d 31 31 37 37 0d 0a 53 45 4c 45 43 54 20 63  l-1177..SELECT c
29ec0 6f 6c 31 20 2b 20 2b 20 39 34 20 44 49 56 20 63  ol1 + + 94 DIV c
29ed0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
29ee0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29ef0 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 35 37 0d  ---..11..14..57.
29f00 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
29f10 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
29f20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29f30 74 20 6c 61 62 65 6c 2d 31 31 37 37 0d 0a 53 45  t label-1177..SE
29f40 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2b 20 39 34  LECT col1 + + 94
29f50 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   / col0 AS col0 
29f60 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29f70 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d  0..----..11..14.
29f80 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .57....query I r
29f90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 34  owsort..SELECT 4
29fa0 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  3 AS col0 FROM t
29fb0 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a  ab0, tab1 cor0..
29fc0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
29fd0 61 73 68 69 6e 67 20 74 6f 20 31 39 39 31 30 35  ashing to 199105
29fe0 36 31 39 30 34 39 32 37 31 31 34 37 39 35 36 64  619049271147956d
29ff0 65 35 32 65 37 66 35 65 64 34 0d 0a 0d 0a 6f 6e  e52e7f5ed4....on
2a000 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2a010 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2a020 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2a030 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2a040 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a050 20 6c 61 62 65 6c 2d 31 31 37 39 0d 0a 53 45 4c   label-1179..SEL
2a060 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2a070 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 4e 55  ol1 * + CAST( NU
2a080 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  LL AS SIGNED ) A
2a090 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2a0a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a0b0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2a0c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2a0d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2a0e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37  owsort label-117
2a0f0 39 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  9..SELECT DISTIN
2a100 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 43 41  CT + col1 * + CA
2a110 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
2a120 45 47 45 52 20 29 20 41 53 20 63 6f 6c 31 20 46  EGER ) AS col1 F
2a130 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2a140 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
2a150 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2a160 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2a170 20 63 6f 6c 32 20 2b 20 34 35 20 46 52 4f 4d 20   col2 + 45 FROM 
2a180 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2a190 2d 2d 0d 0a 37 31 0d 0a 37 32 0d 0a 38 33 0d 0a  --..71..72..83..
2a1a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a1b0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
2a1c0 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l1 + col0 * - co
2a1d0 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 * col0 FROM t
2a1e0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2a1f0 2d 0d 0a 2d 33 31 32 0d 0a 2d 34 37 34 34 39 33  -..-312..-474493
2a200 0d 0a 2d 34 39 33 30 32 32 0d 0a 0d 0a 71 75 65  ..-493022....que
2a210 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a220 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  LECT + cor0.col2
2a230 20 2b 20 36 33 20 41 53 20 63 6f 6c 31 20 46 52   + 63 AS col1 FR
2a240 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2a250 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 38 39 0d 0a  .----..101..89..
2a260 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
2a270 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2a280 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20  STINCT - col2 + 
2a290 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20 2d 20 63  + ( col0 ) * - c
2a2a0 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30  or0.col0 AS col0
2a2b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2a2c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 36 0d  r0..----..-1226.
2a2d0 0a 2d 36 30 39 0d 0a 2d 38 30 30 33 0d 0a 0d 0a  .-609..-8003....
2a2e0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2a2f0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2a300 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2a310 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2a320 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2a330 72 74 20 6c 61 62 65 6c 2d 31 31 38 34 0d 0a 53  rt label-1184..S
2a340 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
2a350 20 2b 20 2b 20 43 41 53 54 28 20 2b 20 34 36 20   + + CAST( + 46 
2a360 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d  AS SIGNED ) FROM
2a370 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2a380 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33 34 0d 0a 34  ---..-18..-34..4
2a390 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
2a3a0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2a3b0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2a3c0 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 34 0d 0a  ort label-1184..
2a3d0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
2a3e0 30 20 2b 20 2b 20 43 41 53 54 20 28 20 2b 20 34  0 + + CAST ( + 4
2a3f0 36 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  6 AS INTEGER ) F
2a400 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2a410 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33 34  ..----..-18..-34
2a420 0d 0a 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..43....query I 
2a430 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a440 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 37 39  + cor0.col0 + 79
2a450 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
2a460 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a470 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 30 0d 0a 32  0..----..1920..2
2a480 38 30 30 0d 0a 37 31 32 30 0d 0a 0d 0a 71 75 65  800..7120....que
2a490 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a4a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2a4b0 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  - col2 + col0 * 
2a4c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
2a4d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
2a4e0 33 36 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a  36..132..697....
2a4f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
2a500 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
2a510 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
2a520 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
2a530 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
2a540 72 74 20 6c 61 62 65 6c 2d 31 31 38 37 0d 0a 53  rt label-1187..S
2a550 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
2a560 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
2a570 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20  IGNED ) AS col0 
2a580 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2a590 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
2a5a0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
2a5b0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2a5c0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2a5d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2a5e0 6c 2d 31 31 38 37 0d 0a 53 45 4c 45 43 54 20 41  l-1187..SELECT A
2a5f0 4c 4c 20 63 6f 6c 32 20 2a 20 43 41 53 54 20 28  LL col2 * CAST (
2a600 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2a610 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2a620 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2a630 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
2a640 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  NULL....onlyif m
2a650 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2a660 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2a670 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2a680 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2a690 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2a6a0 2d 31 31 38 38 0d 0a 53 45 4c 45 43 54 20 41 4c  -1188..SELECT AL
2a6b0 4c 20 63 6f 6c 30 20 2b 20 2b 20 43 41 53 54 28  L col0 + + CAST(
2a6c0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
2a6d0 29 20 2f 20 2d 20 28 20 63 6f 6c 32 20 29 20 41  ) / - ( col2 ) A
2a6e0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2a6f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a700 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
2a710 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a720 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a730 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a740 72 74 20 6c 61 62 65 6c 2d 31 31 38 38 0d 0a 53  rt label-1188..S
2a750 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
2a760 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
2a770 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2d 20  S INTEGER ) / - 
2a780 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32  ( col2 ) AS col2
2a790 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2a7a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
2a7b0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....qu
2a7c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a7d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
2a7e0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41   col2 + - col1 A
2a7f0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2a800 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d   cor0..----..28.
2a810 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79  .47..83....query
2a820 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a830 43 54 20 2d 20 39 35 20 2b 20 63 6f 72 30 2e 63  CT - 95 + cor0.c
2a840 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
2a850 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2a860 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2a870 69 6e 67 20 74 6f 20 65 36 33 35 32 37 31 33 32  ing to e63527132
2a880 38 31 36 38 66 38 32 66 33 34 64 37 65 65 35 65  8168f82f34d7ee5e
2a890 64 39 30 33 63 34 30 0d 0a 0d 0a 71 75 65 72 79  d903c40....query
2a8a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a8b0 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  CT + cor0.col1 *
2a8c0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
2a8d0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2a8e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
2a8f0 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a  64..3395..8099..
2a900 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a910 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2a920 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f  cor0.col1 * - co
2a930 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l2 + + col2 AS c
2a940 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
2a950 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30 0d 0a  r0..----..1560..
2a960 36 38 34 0d 0a 38 36 34 0d 0a 0d 0a 71 75 65 72  684..864....quer
2a970 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a980 45 43 54 20 36 33 20 2a 20 2b 20 63 6f 6c 31 20  ECT 63 * + col1 
2a990 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2a9a0 2d 2d 2d 2d 0d 0a 35 34 31 38 0d 0a 35 37 33 33  ----..5418..5733
2a9b0 0d 0a 36 31 31 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6111....query 
2a9c0 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20  IIIIIIIIIIIIIII 
2a9d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2a9e0 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
2a9f0 74 61 62 32 20 63 6f 72 30 20 43 52 4f 53 53 20  tab2 cor0 CROSS 
2aa00 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 32 20  JOIN tab0, tab2 
2aa10 41 53 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53  AS cor1, tab2 AS
2aa20 20 63 6f 72 32 2c 20 74 61 62 30 20 41 53 20 63   cor2, tab0 AS c
2aa30 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20  or3..----..3645 
2aa40 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2aa50 6f 20 31 39 61 32 33 61 63 36 62 37 35 39 66 38  o 19a23ac6b759f8
2aa60 39 38 38 39 35 34 62 66 37 35 62 61 37 63 34 33  988954bf75ba7c43
2aa70 31 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  1a....query I ro
2aa80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2aa90 4c 20 2d 20 2d 20 31 34 20 2b 20 31 20 41 53 20  L - - 14 + 1 AS 
2aaa0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
2aab0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35  S cor0..----..15
2aac0 0d 0a 31 35 0d 0a 31 35 0d 0a 0d 0a 73 6b 69 70  ..15..15....skip
2aad0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2aae0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2aaf0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2ab00 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2ab10 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2ab20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34  sort..SELECT - 4
2ab30 34 20 2a 20 31 33 20 2a 20 2b 20 63 6f 6c 32 20  4 * 13 * + col2 
2ab40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2ab50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2ab60 38 38 37 36 0d 0a 2d 34 36 39 30 34 0d 0a 2d 35  8876..-46904..-5
2ab70 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  72....skipif pos
2ab80 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2ab90 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2aba0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2abb0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2abc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2abd0 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2d 20  SELECT + col1 - 
2abe0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
2abf0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab2..----..0..0.
2ac00 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
2ac10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2ac20 39 34 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46  94 + cor0.col2 F
2ac30 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2ac40 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a 2d 34 30  ..----..-37..-40
2ac50 0d 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..2....query I r
2ac60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2ac70 4c 4c 20 2d 20 2b 20 28 20 63 6f 6c 31 20 29 20  LL - + ( col1 ) 
2ac80 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20  + col1 * + col2 
2ac90 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * - col1 AS col2
2aca0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2acb0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 31 35  r0..----..-24415
2acc0 34 0d 0a 2d 36 37 39 31 33 33 0d 0a 2d 39 35 30  4..-679133..-950
2acd0 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  6....onlyif mysq
2ace0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2acf0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2ad00 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2ad10 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ad20 2d 31 32 30 30 0d 0a 53 45 4c 45 43 54 20 41 4c  -1200..SELECT AL
2ad30 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 63  L + col0 DIV - c
2ad40 6f 6c 30 20 2b 20 38 39 20 46 52 4f 4d 20 74 61  ol0 + 89 FROM ta
2ad50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ad60 0d 0a 38 38 0d 0a 38 38 0d 0a 38 38 0d 0a 0d 0a  ..88..88..88....
2ad70 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2ad80 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2ad90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2ada0 61 62 65 6c 2d 31 32 30 30 0d 0a 53 45 4c 45 43  abel-1200..SELEC
2adb0 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2f 20 2d  T ALL + col0 / -
2adc0 20 63 6f 6c 30 20 2b 20 38 39 20 46 52 4f 4d 20   col0 + 89 FROM 
2add0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ade0 2d 2d 0d 0a 38 38 0d 0a 38 38 0d 0a 38 38 0d 0a  --..88..88..88..
2adf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ae00 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
2ae10 20 2a 20 63 6f 6c 32 20 2b 20 36 38 20 46 52 4f   * col2 + 68 FRO
2ae20 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
2ae30 2d 0d 0a 2d 31 31 38 30 0d 0a 2d 31 33 33 36 0d  -..-1180..-1336.
2ae40 0a 2d 35 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-502....onlyif 
2ae50 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2ae60 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2ae70 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2ae80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2ae90 61 62 65 6c 2d 31 32 30 32 0d 0a 53 45 4c 45 43  abel-1202..SELEC
2aea0 54 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20  T col1 DIV col1 
2aeb0 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  + - cor0.col0 FR
2aec0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2aed0 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a 2d 37 37 0d 0a  .----..-6..-77..
2aee0 2d 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  -78....skipif my
2aef0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2af00 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2af10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 32  wsort label-1202
2af20 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20  ..SELECT col1 / 
2af30 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col1 + - cor0.co
2af40 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
2af50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 0d 0a  cor0..----..-6..
2af60 2d 37 37 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72  -77..-78....quer
2af70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2af80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
2af90 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 38  ol2 * + col2 * 8
2afa0 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  9 AS col1 FROM t
2afb0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2afc0 2d 0d 0a 2d 32 35 39 35 32 34 0d 0a 2d 32 38 39  -..-259524..-289
2afd0 31 36 31 0d 0a 2d 38 32 30 32 32 34 0d 0a 0d 0a  161..-820224....
2afe0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2aff0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2b000 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2b010 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2b020 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2b030 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b040 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a   + col0 + col2 *
2b050 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f   + col0 col0 FRO
2b060 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2b070 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32 0d  ----..165..3712.
2b080 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .7760....query I
2b090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b0a0 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 37 33 20   cor0.col2 * 73 
2b0b0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
2b0c0 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
2b0d0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
2b0e0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2b0f0 6f 20 64 61 66 31 30 64 39 36 33 37 63 35 31 38  o daf10d9637c518
2b100 64 36 30 34 36 66 62 62 30 34 65 39 35 33 63 65  d6046fbb04e953ce
2b110 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
2b120 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2b130 4c 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  L + - col1 + col
2b140 32 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  2 * - col0 FROM 
2b150 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2b160 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35 38 0d  --..-188..-3658.
2b170 0a 2d 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79 20  .-7693....query 
2b180 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b190 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b  T + col0 * - ( +
2b1a0 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 30 20   col2 ) AS col0 
2b1b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2b1c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d  0..----..-189..-
2b1d0 32 30 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71  2028..-3002....q
2b1e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b1f0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
2b200 31 20 2a 20 39 36 20 46 52 4f 4d 20 74 61 62 32  1 * 96 FROM tab2
2b210 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b220 2d 31 36 33 32 0d 0a 2d 32 39 37 36 0d 0a 2d 35  -1632..-2976..-5
2b230 36 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  664....query I r
2b240 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2b250 4c 4c 20 35 37 20 2b 20 2d 20 63 6f 6c 31 20 41  LL 57 + - col1 A
2b260 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2b270 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 33 34  ..----..-29..-34
2b280 0d 0a 2d 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-40....query I
2b290 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b2a0 20 41 4c 4c 20 2b 20 33 34 20 2a 20 2d 20 63 6f   ALL + 34 * - co
2b2b0 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
2b2c0 2d 2d 0d 0a 2d 31 31 39 30 0d 0a 2d 33 30 32 36  --..-1190..-3026
2b2d0 0d 0a 2d 38 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-816....onlyif
2b2e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2b2f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2b300 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2b310 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b320 6c 61 62 65 6c 2d 31 32 31 31 0d 0a 53 45 4c 45  label-1211..SELE
2b330 43 54 20 63 6f 6c 30 20 2b 20 36 33 20 44 49 56  CT col0 + 63 DIV
2b340 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2b350 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2b360 36 0d 0a 33 36 0d 0a 38 39 0d 0a 0d 0a 73 6b 69  6..36..89....ski
2b370 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2b380 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2b390 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2b3a0 6c 2d 31 32 31 31 0d 0a 53 45 4c 45 43 54 20 63  l-1211..SELECT c
2b3b0 6f 6c 30 20 2b 20 36 33 20 2f 20 63 6f 6c 30 20  ol0 + 63 / col0 
2b3c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2b3d0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 33 36 0d  0..----..26..36.
2b3e0 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .89....query I r
2b3f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2b400 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32  ISTINCT + + col2
2b410 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 32 20 46 52   - col0 * + 2 FR
2b420 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2b430 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 37 31 0d  .----..-64..-71.
2b440 0a 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .48....query I r
2b450 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
2b460 39 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  9 FROM tab1, tab
2b470 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  1 AS cor0, tab1 
2b480 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
2b490 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
2b4a0 20 74 6f 20 65 64 32 65 62 64 39 64 65 66 33 65   to ed2ebd9def3e
2b4b0 32 63 33 38 61 61 34 36 63 62 33 61 66 36 30 66  2c38aa46cb3af60f
2b4c0 65 32 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 49  e229....query II
2b4d0 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
2b4e0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2b4f0 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c  NCT * FROM tab2,
2b500 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 30   tab0 cor0, tab0
2b510 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53 20 63   cor1, tab1 AS c
2b520 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76  or2..----..972 v
2b530 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2b540 20 35 36 32 31 36 37 35 62 31 62 64 33 32 62 30   5621675b1bd32b0
2b550 36 31 64 32 38 34 64 30 34 34 34 63 37 36 36 30  61d284d0444c7660
2b560 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2b570 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2b580 54 49 4e 43 54 20 2d 20 2b 20 32 37 20 2a 20 2d  TINCT - + 27 * -
2b590 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
2b5a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2b5b0 34 30 33 0d 0a 36 34 38 0d 0a 39 34 35 0d 0a 0d  403..648..945...
2b5c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b5d0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
2b5e0 2b 20 28 20 36 32 20 29 20 2a 20 2d 20 63 6f 6c  + ( 62 ) * - col
2b5f0 30 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 31 20  0 + - tab2.col1 
2b600 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2b610 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 36 39 0d 0a  2..----..-3069..
2b620 2d 33 37 37 32 36 37 0d 0a 2d 33 38 36 39 35 39  -377267..-386959
2b630 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2b640 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2b650 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2b660 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2b670 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2b680 31 32 31 37 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1217..SELECT col
2b690 32 20 2a 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c  2 * col1 DIV col
2b6a0 31 20 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20  1 + - tab2.col2 
2b6b0 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52  + col1 * col2 FR
2b6c0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2b6d0 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d  534..646..837...
2b6e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2b6f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2b700 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b710 6c 61 62 65 6c 2d 31 32 31 37 0d 0a 53 45 4c 45  label-1217..SELE
2b720 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2f  CT col2 * col1 /
2b730 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 32 2e 63   col1 + - tab2.c
2b740 6f 6c 32 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol2 + col1 * col
2b750 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
2b760 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33  -..1534..646..83
2b770 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
2b780 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2b790 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2b   + tab0.col2 * +
2b7a0 20 63 6f 6c 32 20 2a 20 37 32 20 2b 20 2b 20 63   col2 * 72 + + c
2b7b0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
2b7c0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39   tab0..----..169
2b7d0 0d 0a 34 38 34 32 31 39 0d 0a 37 38 34 39 34 0d  ..484219..78494.
2b7e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2b7f0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
2b800 6f 6c 30 20 2b 20 2d 20 36 32 20 2a 20 2d 20 63  ol0 + - 62 * - c
2b810 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2b820 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33   cor0..----..183
2b830 0d 0a 33 39 30 34 0d 0a 34 38 38 30 0d 0a 0d 0a  ..3904..4880....
2b840 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b850 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2b860 6c 31 20 2a 20 28 20 2b 20 28 20 2b 20 63 6f 6c  l1 * ( + ( + col
2b870 32 20 29 20 29 20 46 52 4f 4d 20 74 61 62 32 20  2 ) ) FROM tab2 
2b880 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2b890 31 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37  1534..-646..-837
2b8a0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2b8b0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2b8c0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2b8d0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2b8e0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2b8f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2b900 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2b910 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 63 6f  col1 + - col2 co
2b920 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2b930 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39  cor0..----..-119
2b940 0d 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71  ..-173..-98....q
2b950 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b960 53 45 4c 45 43 54 20 41 4c 4c 20 39 31 20 46 52  SELECT ALL 91 FR
2b970 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41 53  OM tab0, tab0 AS
2b980 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63   cor0, tab2 AS c
2b990 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
2b9a0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2b9b0 64 65 65 62 62 63 66 62 39 63 37 38 30 33 61 33  deebbcfb9c7803a3
2b9c0 34 64 63 61 36 62 64 38 36 30 38 34 39 61 66 65  4dca6bd860849afe
2b9d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2b9e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
2b9f0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f  cor0.col2 + + co
2ba00 6c 32 20 2b 20 28 20 2d 20 63 6f 72 30 2e 63 6f  l2 + ( - cor0.co
2ba10 6c 30 20 2b 20 2b 20 34 20 29 20 2a 20 2d 20 63  l0 + + 4 ) * - c
2ba20 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
2ba30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38   cor0..----..108
2ba40 35 0d 0a 34 38 30 0d 0a 37 35 36 35 0d 0a 0d 0a  5..480..7565....
2ba50 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
2ba60 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
2ba70 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
2ba80 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
2ba90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 34  wsort label-1224
2baa0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 36 20  ..SELECT ALL 26 
2bab0 44 49 56 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  DIV col0 + - cor
2bac0 30 2e 63 6f 6c 31 20 44 49 56 20 2b 20 34 38 20  0.col1 DIV + 48 
2bad0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2bae0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d  0..----..-1..-2.
2baf0 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
2bb00 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2bb10 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2bb20 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 34 0d  sort label-1224.
2bb30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 32 36 20 2f  .SELECT ALL 26 /
2bb40 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63   col0 + - cor0.c
2bb50 6f 6c 31 20 2f 20 2b 20 34 38 20 46 52 4f 4d 20  ol1 / + 48 FROM 
2bb60 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2bb70 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d  --..-1..-2..0...
2bb80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bb90 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
2bba0 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 - - cor0.col
2bbb0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2bbc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a  or0..----..110..
2bbd0 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 73 6b 69 70  132..180....skip
2bbe0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2bbf0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2bc00 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2bc10 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2bc20 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2bc30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
2bc40 6f 6c 31 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20  ol1 + col1 col2 
2bc50 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2bc60 2d 2d 2d 2d 0d 0a 31 37 32 0d 0a 31 38 32 0d 0a  ----..172..182..
2bc70 31 39 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  194....onlyif my
2bc80 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2bc90 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2bca0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2bcb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2bcc0 65 6c 2d 31 32 32 37 0d 0a 53 45 4c 45 43 54 20  el-1227..SELECT 
2bcd0 41 4c 4c 20 2d 20 2d 20 43 41 53 54 28 20 63 6f  ALL - - CAST( co
2bce0 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a  l0 AS SIGNED ) *
2bcf0 20 2b 20 63 6f 6c 30 20 2b 20 33 32 20 44 49 56   + col0 + 32 DIV
2bd00 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
2bd10 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2bd20 0a 34 30 39 33 0d 0a 36 33 39 38 0d 0a 38 0d 0a  .4093..6398..8..
2bd30 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2bd40 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2bd50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2bd60 20 6c 61 62 65 6c 2d 31 32 32 37 0d 0a 53 45 4c   label-1227..SEL
2bd70 45 43 54 20 41 4c 4c 20 2d 20 2d 20 43 41 53 54  ECT ALL - - CAST
2bd80 20 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   ( col0 AS INTEG
2bd90 45 52 20 29 20 2a 20 2b 20 63 6f 6c 30 20 2b 20  ER ) * + col0 + 
2bda0 33 32 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  32 / - col1 FROM
2bdb0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2bdc0 2d 2d 2d 0d 0a 34 30 39 33 0d 0a 36 33 39 38 0d  ---..4093..6398.
2bdd0 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .8....query I ro
2bde0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2bdf0 53 54 49 4e 43 54 20 28 20 2b 20 63 6f 6c 31 20  STINCT ( + col1 
2be00 29 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  ) + col2 - col1 
2be10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2be20 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36  2 cor0..----..26
2be30 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 6f 6e 6c 79  ..27..38....only
2be40 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2be50 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2be60 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2be70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2be80 74 20 6c 61 62 65 6c 2d 31 32 32 39 0d 0a 53 45  t label-1229..SE
2be90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2bea0 63 6f 6c 32 20 44 49 56 20 33 37 20 46 52 4f 4d  col2 DIV 37 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 30 0d 0a 31 0d 0a 0d 0a 73 6b 69  ---..0..1....ski
2bed0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2bee0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2bef0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2bf00 6c 2d 31 32 32 39 0d 0a 53 45 4c 45 43 54 20 44  l-1229..SELECT D
2bf10 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2f  ISTINCT + col2 /
2bf20 20 33 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53   37 FROM tab2 AS
2bf30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
2bf40 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
2bf50 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  sort..SELECT - -
2bf60 20 38 39 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d   89 * + col1 + -
2bf70 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 41 53 20   col1 + col2 AS 
2bf80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2bf90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
2bfa0 34 30 0d 0a 32 33 34 32 0d 0a 39 33 37 0d 0a 0d  40..2342..937...
2bfb0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2bfc0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2bfd0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2bfe0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2bff0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33  owsort label-123
2c000 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  1..SELECT ALL - 
2c010 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20  col1 * + col2 + 
2c020 2d 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20  - col1 DIV col2 
2c030 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2c040 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2c050 0a 2d 31 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d  .-1248..-1404..-
2c060 35 37 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  570....skipif my
2c070 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2c080 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2c090 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 33 31  wsort label-1231
2c0a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
2c0b0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol1 * + col2 + -
2c0c0 20 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41 53 20   col1 / col2 AS 
2c0d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
2c0e0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
2c0f0 32 34 38 0d 0a 2d 31 34 30 34 0d 0a 2d 35 37 30  248..-1404..-570
2c100 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2c110 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2c120 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2c130 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2c140 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2c150 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c160 4c 45 43 54 20 2d 20 31 35 20 63 6f 6c 32 20 46  LECT - 15 col2 F
2c170 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
2c180 2d 2d 2d 0d 0a 2d 31 35 0d 0a 2d 31 35 0d 0a 2d  ---..-15..-15..-
2c190 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  15....query I ro
2c1a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2c1b0 53 54 49 4e 43 54 20 2d 20 2d 20 35 34 20 2a 20  STINCT - - 54 * 
2c1c0 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  + col2 + + col1 
2c1d0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
2c1e0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2c1f0 0a 31 35 31 0d 0a 31 38 36 38 0d 0a 34 35 31 39  .151..1868..4519
2c200 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c210 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20  ort..SELECT ( + 
2c220 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 63 6f  cor0.col0 ) * co
2c230 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2c240 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2c250 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37  --..162..3648..7
2c260 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  680....query I r
2c270 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2c280 4c 4c 20 2d 20 28 20 32 32 20 29 20 2a 20 2b 20  LL - ( 22 ) * + 
2c290 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col1 + + cor0.co
2c2a0 6c 31 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  l1 - + col2 * + 
2c2b0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2c2c0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2c2d0 2d 2d 2d 2d 0d 0a 2d 32 30 37 32 0d 0a 2d 32 35  ----..-2072..-25
2c2e0 39 38 0d 0a 2d 39 32 30 39 0d 0a 0d 0a 71 75 65  98..-9209....que
2c2f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2c300 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c  LECT ALL + - col
2c310 31 20 2b 20 2b 20 37 33 20 2a 20 63 6f 6c 30 20  1 + + 73 * col0 
2c320 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
2c330 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2c340 0d 0a 2d 2d 2d 2d 0d 0a 34 36 37 31 30 0d 0a 35  ..----..46710..5
2c350 36 36 38 0d 0a 37 35 39 30 37 0d 0a 0d 0a 71 75  668..75907....qu
2c360 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c370 45 4c 45 43 54 20 2d 20 39 39 20 2b 20 2b 20 63  ELECT - 99 + + c
2c380 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
2c390 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d  r0..----..-10..-
2c3a0 36 34 0d 0a 2d 37 35 0d 0a 0d 0a 71 75 65 72 79  64..-75....query
2c3b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c3c0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
2c3d0 20 2a 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   * col2 * col1 +
2c3e0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
2c3f0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2c400 31 30 32 30 0d 0a 32 35 39 37 34 0d 0a 39 30 35  1020..25974..905
2c410 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  32....onlyif mys
2c420 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2c430 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2c440 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2c450 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c460 6c 2d 31 32 33 39 0d 0a 53 45 4c 45 43 54 20 41  l-1239..SELECT A
2c470 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  LL + col0 + col2
2c480 20 2b 20 2d 20 39 35 20 2a 20 63 6f 6c 32 20 44   + - 95 * col2 D
2c490 49 56 20 2d 20 28 20 63 6f 6c 32 20 2b 20 63 6f  IV - ( col2 + co
2c4a0 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
2c4b0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  M tab0..----..21
2c4c0 36 0d 0a 33 36 0d 0a 38 33 0d 0a 0d 0a 73 6b 69  6..36..83....ski
2c4d0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2c4e0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2c4f0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2c500 6c 2d 31 32 33 39 0d 0a 53 45 4c 45 43 54 20 41  l-1239..SELECT A
2c510 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  LL + col0 + col2
2c520 20 2b 20 2d 20 39 35 20 2a 20 63 6f 6c 32 20 2f   + - 95 * col2 /
2c530 20 2d 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   - ( col2 + col1
2c540 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
2c550 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d  tab0..----..216.
2c560 0a 33 36 0d 0a 38 33 0d 0a 0d 0a 6f 6e 6c 79 69  .36..83....onlyi
2c570 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2c580 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2c590 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2c5a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2c5b0 20 6c 61 62 65 6c 2d 31 32 34 30 0d 0a 53 45 4c   label-1240..SEL
2c5c0 45 43 54 20 2b 20 2d 20 37 39 20 2a 20 2d 20 63  ECT + - 79 * - c
2c5d0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 44 49 56  ol2 + - col1 DIV
2c5e0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
2c5f0 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2c600 0a 2d 31 38 0d 0a 32 36 30 35 0d 0a 36 34 37 37  .-18..2605..6477
2c610 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2c620 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2c630 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2c640 72 74 20 6c 61 62 65 6c 2d 31 32 34 30 0d 0a 53  rt label-1240..S
2c650 45 4c 45 43 54 20 2b 20 2d 20 37 39 20 2a 20 2d  ELECT + - 79 * -
2c660 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2f   col2 + - col1 /
2c670 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
2c680 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2c690 0a 2d 31 38 0d 0a 32 36 30 35 0d 0a 36 34 37 37  .-18..2605..6477
2c6a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c6b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
2c6c0 2e 63 6f 6c 31 20 2a 20 33 38 20 46 52 4f 4d 20  .col1 * 38 FROM 
2c6d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2c6e0 2d 2d 0d 0a 33 38 30 0d 0a 34 39 34 0d 0a 39 38  --..380..494..98
2c6f0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2c700 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
2c710 30 20 2b 20 31 32 20 2b 20 2d 20 63 6f 6c 31 20  0 + 12 + - col1 
2c720 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  * + col2 FROM ta
2c730 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2c740 0d 0a 2d 31 31 35 36 0d 0a 2d 31 33 38 39 0d 0a  ..-1156..-1389..
2c750 2d 34 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -494....query I 
2c760 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c770 41 4c 4c 20 2b 20 31 31 20 2a 20 63 6f 6c 30 20  ALL + 11 * col0 
2c780 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2c790 30 0d 0a 2d 2d 2d 2d 0d 0a 37 37 0d 0a 38 35 38  0..----..77..858
2c7a0 0d 0a 38 36 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..869....skipif 
2c7b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2c7c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2c7d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2c7e0 2b 20 43 41 53 54 20 28 20 2b 20 28 20 63 6f 6c  + CAST ( + ( col
2c7f0 31 20 29 20 41 53 20 52 45 41 4c 20 29 20 2b 20  1 ) AS REAL ) + 
2c800 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  col2 + col0 FROM
2c810 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2c820 0d 0a 31 33 33 0d 0a 31 34 33 0d 0a 32 36 32 0d  ..133..143..262.
2c830 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c840 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 32  rt..SELECT - + 2
2c850 36 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72  6 * col1 + + cor
2c860 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  0.col2 FROM tab2
2c870 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2c880 2d 31 35 30 38 0d 0a 2d 34 30 34 0d 0a 2d 37 37  -1508..-404..-77
2c890 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2c8a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2c8b0 20 30 20 2a 20 74 61 62 30 2e 63 6f 6c 32 20 41   0 * tab0.col2 A
2c8c0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2c8d0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
2c8e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2c8f0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
2c900 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol1 + - col0 * c
2c910 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2c920 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30   cor0..----..-40
2c930 38 36 0d 0a 2d 36 33 38 37 0d 0a 31 37 0d 0a 0d  86..-6387..17...
2c940 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2c950 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2c960 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2c970 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2c980 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 34  owsort label-124
2c990 38 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  8..SELECT - col2
2c9a0 20 2a 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30   * col0 DIV col0
2c9b0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2c9c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2c9d0 0d 0a 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d  ..-26..-27..-38.
2c9e0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
2c9f0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
2ca00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ca10 74 20 6c 61 62 65 6c 2d 31 32 34 38 0d 0a 53 45  t label-1248..SE
2ca20 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  LECT - col2 * co
2ca30 6c 30 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l0 / col0 AS col
2ca40 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
2ca50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a  or0..----..-26..
2ca60 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a 73 6b 69 70  -27..-38....skip
2ca70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2ca80 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2ca90 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2caa0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2cab0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2cac0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 31 33 20  sort..SELECT 13 
2cad0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
2cae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 31  or0..----..13..1
2caf0 33 0d 0a 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..13....onlyif 
2cb00 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2cb10 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2cb20 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2cb30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2cb40 61 62 65 6c 2d 31 32 35 30 0d 0a 53 45 4c 45 43  abel-1250..SELEC
2cb50 54 20 41 4c 4c 20 34 31 20 44 49 56 20 39 37 20  T ALL 41 DIV 97 
2cb60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2cb70 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  1..----..0..0..0
2cb80 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2cb90 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2cba0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2cbb0 72 74 20 6c 61 62 65 6c 2d 31 32 35 30 0d 0a 53  rt label-1250..S
2cbc0 45 4c 45 43 54 20 41 4c 4c 20 34 31 20 2f 20 39  ELECT ALL 41 / 9
2cbd0 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  7 AS col2 FROM t
2cbe0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
2cbf0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
2cc00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2cc10 4c 20 39 30 20 2a 20 2d 20 63 6f 6c 31 20 41 53  L 90 * - col1 AS
2cc20 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
2cc30 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 30 0d 0a 2d 32  .----..-1170..-2
2cc40 33 34 30 0d 0a 2d 39 30 30 0d 0a 0d 0a 6f 6e 6c  340..-900....onl
2cc50 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2cc60 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2cc70 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2cc80 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2cc90 72 74 20 6c 61 62 65 6c 2d 31 32 35 32 0d 0a 53  rt label-1252..S
2cca0 45 4c 45 43 54 20 28 20 2b 20 63 6f 6c 32 20 29  ELECT ( + col2 )
2ccb0 20 2a 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32   * col0 DIV col2
2ccc0 20 2b 20 39 39 20 46 52 4f 4d 20 74 61 62 30 0d   + 99 FROM tab0.
2ccd0 0a 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a 31 33 34 0d  .----..123..134.
2cce0 0a 31 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .188....skipif m
2ccf0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2cd00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2cd10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35  owsort label-125
2cd20 32 0d 0a 53 45 4c 45 43 54 20 28 20 2b 20 63 6f  2..SELECT ( + co
2cd30 6c 32 20 29 20 2a 20 63 6f 6c 30 20 2f 20 63 6f  l2 ) * col0 / co
2cd40 6c 32 20 2b 20 39 39 20 46 52 4f 4d 20 74 61 62  l2 + 99 FROM tab
2cd50 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a 31 33  0..----..123..13
2cd60 34 0d 0a 31 38 38 0d 0a 0d 0a 71 75 65 72 79 20  4..188....query 
2cd70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2cd80 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 28 20 2b  T + col2 * + ( +
2cd90 20 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f   1 ) AS col0 FRO
2cda0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2cdb0 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38  ----..26..27..38
2cdc0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cdd0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2cde0 6c 32 20 2a 20 34 30 20 41 53 20 63 6f 6c 30 20  l2 * 40 AS col0 
2cdf0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2ce00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 30 0d 0a  0..----..-1320..
2ce10 2d 33 32 38 30 0d 0a 2d 34 30 0d 0a 0d 0a 71 75  -3280..-40....qu
2ce20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ce30 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63  ELECT ALL cor0.c
2ce40 6f 6c 30 20 2b 20 2b 20 28 20 63 6f 6c 31 20 29  ol0 + + ( col1 )
2ce50 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
2ce60 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d 0a  .----..137..38..
2ce70 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  96....query I ro
2ce80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2ce90 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b 20  STINCT col2 * + 
2cea0 36 33 20 2a 20 2b 20 35 34 20 46 52 4f 4d 20 74  63 * + 54 FROM t
2ceb0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2cec0 2d 0d 0a 31 32 39 32 37 36 0d 0a 38 38 34 35 32  -..129276..88452
2ced0 0d 0a 39 31 38 35 34 0d 0a 0d 0a 71 75 65 72 79  ..91854....query
2cee0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2cef0 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 34 34  CT + + col0 * 44
2cf00 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32   * col1 + - col2
2cf10 20 2b 20 2d 20 28 20 35 32 20 29 20 41 53 20 63   + - ( 52 ) AS c
2cf20 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
2cf30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 32   cor0..----..202
2cf40 34 31 30 0d 0a 35 39 30 30 32 0d 0a 39 34 36 39  410..59002..9469
2cf50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2cf60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
2cf70 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 2d 20 37 32   * - col1 - - 72
2cf80 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2cf90 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2cfa0 0d 0a 2d 32 35 0d 0a 2d 32 37 36 36 0d 0a 2d 37  ..-25..-2766..-7
2cfb0 33 39 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  390....onlyif my
2cfc0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2cfd0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2cfe0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2cff0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d000 65 6c 2d 31 32 35 39 0d 0a 53 45 4c 45 43 54 20  el-1259..SELECT 
2d010 74 61 62 32 2e 63 6f 6c 30 20 44 49 56 20 2b 20  tab2.col0 DIV + 
2d020 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab2.col0 AS col
2d030 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2d040 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b  -..1..1..1....sk
2d050 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2d060 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2d070 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d080 65 6c 2d 31 32 35 39 0d 0a 53 45 4c 45 43 54 20  el-1259..SELECT 
2d090 74 61 62 32 2e 63 6f 6c 30 20 2f 20 2b 20 74 61  tab2.col0 / + ta
2d0a0 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20  b2.col0 AS col1 
2d0b0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2d0c0 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72  .1..1..1....quer
2d0d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d0e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 35  ECT DISTINCT + 5
2d0f0 39 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  9 * col0 + + col
2d100 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2d110 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 32 0d  ab0..----..1502.
2d120 0a 32 31 36 32 0d 0a 35 33 34 32 0d 0a 0d 0a 6f  .2162..5342....o
2d130 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2d140 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2d150 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2d160 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2d170 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 31 0d  sort label-1261.
2d180 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2d190 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b   + + cor0.col1 +
2d1a0 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30   col1 DIV + col0
2d1b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2d1c0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  b0 cor0..----..8
2d1d0 39 0d 0a 39 32 0d 0a 39 39 0d 0a 0d 0a 73 6b 69  9..92..99....ski
2d1e0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2d1f0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2d200 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d210 6c 2d 31 32 36 31 0d 0a 53 45 4c 45 43 54 20 44  l-1261..SELECT D
2d220 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30  ISTINCT + + cor0
2d230 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f 20 2b  .col1 + col1 / +
2d240 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2d250 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2d260 2d 2d 0d 0a 38 39 0d 0a 39 32 0d 0a 39 39 0d 0a  --..89..92..99..
2d270 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d280 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
2d290 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32   + col2 * + col2
2d2a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2d2b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 30 0d 0a  r0..----..2890..
2d2c0 33 32 33 39 0d 0a 39 32 30 33 0d 0a 0d 0a 71 75  3239..9203....qu
2d2d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2d2e0 45 4c 45 43 54 20 36 31 20 46 52 4f 4d 20 74 61  ELECT 61 FROM ta
2d2f0 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b2, tab1 AS cor0
2d300 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a  , tab1 AS cor1..
2d310 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
2d320 68 61 73 68 69 6e 67 20 74 6f 20 38 64 34 64 66  hashing to 8d4df
2d330 65 36 34 39 34 33 33 61 35 39 39 66 63 34 62 31  e649433a599fc4b1
2d340 30 38 33 30 63 63 37 63 65 35 35 0d 0a 0d 0a 71  0830cc7ce55....q
2d350 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d360 53 45 4c 45 43 54 20 28 20 74 61 62 30 2e 63 6f  SELECT ( tab0.co
2d370 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 30 2c 20  l2 ) FROM tab0, 
2d380 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2d390 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2d3a0 68 69 6e 67 20 74 6f 20 63 38 66 39 66 61 39 65  hing to c8f9fa9e
2d3b0 66 30 66 38 37 30 32 62 64 33 38 32 65 38 32 31  f0f8702bd382e821
2d3c0 33 37 38 61 39 36 64 38 0d 0a 0d 0a 71 75 65 72  378a96d8....quer
2d3d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2d3e0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
2d3f0 20 34 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63   42 * col0 + + c
2d400 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2d410 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36   cor0..----..-26
2d420 37 0d 0a 2d 33 32 35 30 0d 0a 2d 33 32 38 30 0d  7..-3250..-3280.
2d430 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d440 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2d450 4e 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  NCT - col2 + col
2d460 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  1 * - cor0.col1 
2d470 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2d480 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 34 32 39 0d 0a  0..----..-7429..
2d490 2d 38 33 36 33 0d 0a 2d 39 34 31 30 0d 0a 0d 0a  -8363..-9410....
2d4a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2d4b0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30  .SELECT + + col0
2d4c0 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
2d4d0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
2d4e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a  or0..----..110..
2d4f0 31 33 32 0d 0a 31 38 30 0d 0a 0d 0a 73 6b 69 70  132..180....skip
2d500 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2d510 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2d520 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2d530 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2d540 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
2d550 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
2d560 32 2e 63 6f 6c 31 20 2b 20 2d 20 31 34 20 63 6f  2.col1 + - 14 co
2d570 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l2 FROM tab2, ta
2d580 62 30 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  b0 cor0, tab1 AS
2d590 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
2d5a0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2d5b0 6f 20 31 66 34 38 33 37 31 33 36 61 61 37 34 32  o 1f4837136aa742
2d5c0 35 64 39 32 39 36 34 62 63 32 31 39 66 38 35 63  5d92964bc219f85c
2d5d0 30 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  0c....query I ro
2d5e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2d5f0 53 54 49 4e 43 54 20 33 39 20 2b 20 63 6f 72 30  STINCT 39 + cor0
2d600 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20  .col2 FROM tab1 
2d610 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 0d  cor0..----..135.
2d620 0a 39 33 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .93..96....query
2d630 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d640 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20  CT ALL col2 + + 
2d650 63 6f 6c 32 20 2a 20 37 32 20 41 53 20 63 6f 6c  col2 * 72 AS col
2d660 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2d670 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 34 32 0d  or0..----..3942.
2d680 0a 34 31 36 31 0d 0a 37 30 30 38 0d 0a 0d 0a 6f  .4161..7008....o
2d690 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2d6a0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2d6b0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
2d6c0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
2d6d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 37 31 0d  sort label-1271.
2d6e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2d6f0 6c 30 20 44 49 56 20 63 6f 6c 31 20 41 53 20 63  l0 DIV col1 AS c
2d700 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
2d710 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
2d720 0a 2d 34 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-4..0....skipif
2d730 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2d740 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2d750 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2d760 32 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  271..SELECT ALL 
2d770 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53  - col0 / col1 AS
2d780 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
2d790 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2d7a0 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79  1..-4..0....only
2d7b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
2d7c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
2d7d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
2d7e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d7f0 74 20 6c 61 62 65 6c 2d 31 32 37 32 0d 0a 53 45  t label-1272..SE
2d800 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
2d810 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c  - col2 DIV - col
2d820 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  0 + col0 * col1 
2d830 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2d840 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2d850 0a 31 33 34 33 0d 0a 32 31 34 0d 0a 34 36 30 32  .1343..214..4602
2d860 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2d870 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2d880 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2d890 72 74 20 6c 61 62 65 6c 2d 31 32 37 32 0d 0a 53  rt label-1272..S
2d8a0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
2d8b0 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30   - col2 / - col0
2d8c0 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41   + col0 * col1 A
2d8d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2d8e0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d8f0 31 33 34 33 0d 0a 32 31 34 0d 0a 34 36 30 32 0d  1343..214..4602.
2d900 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d910 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2d920 4e 43 54 20 28 20 63 6f 6c 31 20 2a 20 63 6f 6c  NCT ( col1 * col
2d930 30 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  0 ) FROM tab2..-
2d940 2d 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a  ---..1343..217..
2d950 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4602....query I 
2d960 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d970 44 49 53 54 49 4e 43 54 20 32 32 20 41 53 20 63  DISTINCT 22 AS c
2d980 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
2d990 2d 2d 2d 0d 0a 32 32 0d 0a 0d 0a 71 75 65 72 79  ---..22....query
2d9a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d9b0 43 54 20 41 4c 4c 20 2d 20 32 30 20 2d 20 32 32  CT ALL - 20 - 22
2d9c0 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 20   FROM tab1 cor0 
2d9d0 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20  CROSS JOIN tab2 
2d9e0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor1..----..9
2d9f0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2da00 74 6f 20 39 38 39 34 30 39 33 66 32 39 63 30 64  to 9894093f29c0d
2da10 65 66 61 65 39 31 33 34 37 39 33 34 66 30 36 30  efae91347934f060
2da20 33 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  329....onlyif my
2da30 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2da40 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2da50 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2da60 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2da70 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2da80 31 32 37 36 0d 0a 53 45 4c 45 43 54 20 2b 20 43  1276..SELECT + C
2da90 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
2daa0 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
2dab0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
2dac0 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
2dad0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2dae0 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31  hing to cd7a7901
2daf0 65 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30  e47c15155404aff0
2db00 64 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70  d216fe0b....skip
2db10 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2db20 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2db30 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2db40 2d 31 32 37 36 0d 0a 53 45 4c 45 43 54 20 2b 20  -1276..SELECT + 
2db50 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
2db60 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
2db70 62 31 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b1 cor0 CROSS JO
2db80 49 4e 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  IN tab2 AS cor1.
2db90 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
2dba0 68 61 73 68 69 6e 67 20 74 6f 20 63 64 37 61 37  hashing to cd7a7
2dbb0 39 30 31 65 34 37 63 31 35 31 35 35 34 30 34 61  901e47c15155404a
2dbc0 66 66 30 64 32 31 36 66 65 30 62 0d 0a 0d 0a 71  ff0d216fe0b....q
2dbd0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2dbe0 53 45 4c 45 43 54 20 2b 20 2b 20 37 38 20 41 53  SELECT + + 78 AS
2dbf0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
2dc00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
2dc10 38 0d 0a 37 38 0d 0a 37 38 0d 0a 0d 0a 71 75 65  8..78..78....que
2dc20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2dc30 4c 45 43 54 20 38 33 20 2a 20 2d 20 63 6f 6c 31  LECT 83 * - col1
2dc40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2dc50 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2dc60 0d 0a 2d 31 30 37 39 0d 0a 2d 32 31 35 38 0d 0a  ..-1079..-2158..
2dc70 2d 38 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -830....skipif p
2dc80 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
2dc90 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
2dca0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
2dcb0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
2dcc0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2dcd0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 39 20  ..SELECT ALL 49 
2dce0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20  col1 FROM tab1, 
2dcf0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2dd00 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2dd10 68 69 6e 67 20 74 6f 20 63 62 34 30 37 38 33 63  hing to cb40783c
2dd20 30 66 66 66 37 32 65 38 38 30 32 63 64 66 30 36  0fff72e8802cdf06
2dd30 38 32 65 37 63 62 35 35 0d 0a 0d 0a 71 75 65 72  82e7cb55....quer
2dd40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dd50 45 43 54 20 41 4c 4c 20 2d 20 36 34 20 41 53 20  ECT ALL - 64 AS 
2dd60 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
2dd70 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36 34 0d 0a  ----..-64..-64..
2dd80 2d 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -64....query I r
2dd90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2dda0 20 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor1.col0 FROM 
2ddb0 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
2ddc0 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31  r0, tab2 AS cor1
2ddd0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
2dde0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 65 31  s hashing to 1e1
2ddf0 66 31 30 39 35 33 65 62 38 65 66 66 65 39 62 32  f10953eb8effe9b2
2de00 30 65 37 34 36 66 38 61 37 66 64 38 33 0d 0a 0d  0e746f8a7fd83...
2de10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2de20 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
2de30 63 6f 6c 30 20 2a 20 37 34 20 2b 20 2d 20 63 6f  col0 * 74 + - co
2de40 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
2de50 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2de60 2d 2d 0d 0a 31 36 38 0d 0a 34 36 37 39 0d 0a 35  --..168..4679..5
2de70 38 32 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  824....skipif po
2de80 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2de90 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2dea0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2deb0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2dec0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ded0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2dee0 20 2b 20 38 34 20 63 6f 6c 31 20 46 52 4f 4d 20   + 84 col1 FROM 
2def0 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
2df00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 34 0d 0a 0d 0a  r0..----..84....
2df10 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2df20 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 72 30  .SELECT + ( cor0
2df30 2e 63 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 31  .col0 ) * + col1
2df40 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2df50 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2df60 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30  ..1343..217..460
2df70 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2df80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2df90 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20 28  TINCT + col2 + (
2dfa0 20 63 6f 6c 31 20 29 20 2a 20 2b 20 39 39 20 2b   col1 ) * + 99 +
2dfb0 20 2b 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d   + ( col2 ) FROM
2dfc0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 35 38   tab0..----..858
2dfd0 30 0d 0a 39 31 37 33 0d 0a 39 36 30 35 0d 0a 0d  0..9173..9605...
2dfe0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2dff0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2e000 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2e010 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2e020 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2e030 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e040 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
2e050 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 * - cor0.col
2e060 30 20 2a 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20  0 * + col0 col2 
2e070 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2e080 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 34 0d 0a 2d  0..----..-234..-
2e090 34 30 39 36 30 0d 0a 2d 38 33 32 30 30 0d 0a 0d  40960..-83200...
2e0a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2e0b0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
2e0c0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
2e0d0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
2e0e0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
2e0f0 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38 37 0d 0a  ort label-1287..
2e100 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e110 2b 20 38 35 20 2b 20 2d 20 63 6f 6c 31 20 2f 20  + 85 + - col1 / 
2e120 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
2e130 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 30  GNED ) FROM tab0
2e140 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e150 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
2e160 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2e170 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2e180 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 38  owsort label-128
2e190 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  7..SELECT DISTIN
2e1a0 43 54 20 2b 20 38 35 20 2b 20 2d 20 63 6f 6c 31  CT + 85 + - col1
2e1b0 20 2f 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   / CAST ( NULL A
2e1c0 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
2e1d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2e1e0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
2e1f0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2e200 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2b  LECT tab2.col2 +
2e210 20 2d 20 63 6f 6c 31 20 2a 20 38 38 20 41 53 20   - col1 * 88 AS 
2e220 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
2e230 2d 2d 2d 2d 0d 0a 2d 31 34 35 38 0d 0a 2d 32 37  ----..-1458..-27
2e240 30 31 0d 0a 2d 35 31 36 36 0d 0a 0d 0a 73 6b 69  01..-5166....ski
2e250 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2e260 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2e270 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2e280 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2e290 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2e2a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2e2b0 4c 20 31 36 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  L 16 + - cor0.co
2e2c0 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
2e2d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2e2e0 0a 2d 31 39 0d 0a 2d 37 33 0d 0a 2d 38 0d 0a 0d  .-19..-73..-8...
2e2f0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2e300 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2e310 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2e320 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2e330 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39  owsort label-129
2e340 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  0..SELECT ALL co
2e350 72 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30  r0.col0 DIV col0
2e360 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2e370 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2e380 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
2e390 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2e3a0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2e3b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e3c0 6c 2d 31 32 39 30 0d 0a 53 45 4c 45 43 54 20 41  l-1290..SELECT A
2e3d0 4c 4c 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 63  LL cor0.col0 / c
2e3e0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
2e3f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2e400 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a  ---..1..1..1....
2e410 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2e420 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
2e430 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 35 36 20 2b   + col0 + + 56 +
2e440 20 63 6f 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 32   col0 * ( - col2
2e450 20 29 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63   ) * - col1 AS c
2e460 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2e470 2d 2d 2d 0d 0a 31 32 31 37 33 36 0d 0a 35 34 30  ---..121736..540
2e480 39 32 0d 0a 36 31 30 34 0d 0a 0d 0a 71 75 65 72  92..6104....quer
2e490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e4a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2e4b0 31 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20  1 * col2 + col0 
2e4c0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
2e4d0 0d 0a 2d 2d 2d 2d 0d 0a 31 36 37 0d 0a 32 38 38  ..----..167..288
2e4e0 36 0d 0a 37 36 34 30 0d 0a 0d 0a 73 6b 69 70 69  6..7640....skipi
2e4f0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
2e500 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
2e510 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
2e520 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
2e530 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
2e540 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2e550 2b 20 63 6f 6c 30 20 2a 20 39 31 20 2b 20 2d 20  + col0 * 91 + - 
2e560 35 35 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  55 col1 FROM tab
2e570 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31  1 cor0..----..21
2e580 38 0d 0a 35 37 36 39 0d 0a 37 32 32 35 0d 0a 0d  8..5769..7225...
2e590 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e5a0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
2e5b0 31 20 2b 20 2d 20 37 37 20 2a 20 2b 20 63 6f 6c  1 + - 77 * + col
2e5c0 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * - col2 FROM 
2e5d0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2e5e0 2d 2d 0d 0a 31 31 31 32 30 35 0d 0a 35 32 31 31  --..111205..5211
2e5f0 31 0d 0a 35 36 31 36 34 0d 0a 0d 0a 71 75 65 72  1..56164....quer
2e600 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e610 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
2e620 20 35 35 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   55 AS col0 FROM
2e630 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
2e640 2d 2d 2d 0d 0a 2d 33 38 35 0d 0a 2d 34 32 39 30  ---..-385..-4290
2e650 0d 0a 2d 34 33 34 35 0d 0a 0d 0a 71 75 65 72 79  ..-4345....query
2e660 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e670 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
2e680 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2e690 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
2e6a0 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
2e6b0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
2e6c0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 32 39  s hashing to 729
2e6d0 63 31 65 64 64 61 39 33 33 32 33 39 38 32 39 39  c1edda9332398299
2e6e0 66 33 39 63 64 31 37 34 65 64 38 34 30 0d 0a 0d  f39cd174ed840...
2e6f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e700 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2e710 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  T - cor0.col2 + 
2e720 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
2e730 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
2e740 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79  ..33..4....query
2e750 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2e760 43 54 20 63 6f 6c 32 20 2a 20 2d 20 34 39 20 2b  CT col2 * - 49 +
2e770 20 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d   + ( col1 ) FROM
2e780 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2e790 2d 2d 2d 0d 0a 2d 32 36 32 30 0d 0a 2d 32 37 38  ---..-2620..-278
2e7a0 33 0d 0a 2d 34 36 39 31 0d 0a 0d 0a 71 75 65 72  3..-4691....quer
2e7b0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e7c0 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 28 20 2b  ECT col2 + + ( +
2e7d0 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62   col0 ) FROM tab
2e7e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2e7f0 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d  .104..117..34...
2e800 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e810 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72  ..SELECT + - cor
2e820 30 2e 63 6f 6c 32 20 2a 20 2d 20 63 6f 72 30 2e  0.col2 * - cor0.
2e830 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col0 + - cor0.co
2e840 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
2e850 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 37  cor0..----..0..7
2e860 32 30 39 0d 0a 37 36 38 0d 0a 0d 0a 71 75 65 72  209..768....quer
2e870 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2e880 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
2e890 20 63 6f 6c 30 20 2b 20 2d 20 28 20 63 6f 6c 30   col0 + - ( col0
2e8a0 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
2e8b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d  cor0..----..0...
2e8c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e8d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2e8e0 54 20 2d 20 2d 20 31 36 20 2a 20 2b 20 63 6f 6c  T - - 16 * + col
2e8f0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
2e900 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2e910 2d 0d 0a 31 31 32 0d 0a 31 32 34 38 0d 0a 31 32  -..112..1248..12
2e920 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  64....skipif pos
2e930 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2e940 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2e950 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2e960 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2e970 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e980 53 45 4c 45 43 54 20 2d 20 2d 20 36 31 20 2a 20  SELECT - - 61 * 
2e990 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  + col1 + - col2 
2e9a0 2a 20 2d 20 63 6f 6c 30 20 2b 20 28 20 2b 20 63  * - col0 + ( + c
2e9b0 6f 6c 30 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 ) col2 FROM 
2e9c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2e9d0 2d 2d 0d 0a 31 32 39 33 38 0d 0a 35 39 38 37 0d  --..12938..5987.
2e9e0 0a 36 30 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .6062....query I
2e9f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ea00 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20   + ( + col2 ) * 
2ea10 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
2ea20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2ea30 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  162..3648..7680.
2ea40 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2ea50 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2ea60 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2ea70 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2ea80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2ea90 33 30 35 0d 0a 53 45 4c 45 43 54 20 2d 20 34 38  305..SELECT - 48
2eaa0 20 2b 20 63 6f 6c 31 20 44 49 56 20 63 6f 6c 31   + col1 DIV col1
2eab0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2eac0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d 0a 2d  r0..----..-47..-
2ead0 34 37 0d 0a 2d 34 37 0d 0a 0d 0a 73 6b 69 70 69  47..-47....skipi
2eae0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2eaf0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2eb00 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2eb10 31 33 30 35 0d 0a 53 45 4c 45 43 54 20 2d 20 34  1305..SELECT - 4
2eb20 38 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 31 20  8 + col1 / col1 
2eb30 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2eb40 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 37 0d 0a 2d 34  0..----..-47..-4
2eb50 37 0d 0a 2d 34 37 0d 0a 0d 0a 71 75 65 72 79 20  7..-47....query 
2eb60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2eb70 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
2eb80 31 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63  1 + + col0 * - c
2eb90 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
2eba0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2ebb0 2d 2d 2d 0d 0a 2d 31 38 38 0d 0a 2d 33 36 35 38  ---..-188..-3658
2ebc0 0d 0a 2d 37 36 39 33 0d 0a 0d 0a 71 75 65 72 79  ..-7693....query
2ebd0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ebe0 43 54 20 41 4c 4c 20 2b 20 34 39 20 2a 20 63 6f  CT ALL + 49 * co
2ebf0 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63  r0.col2 + cor0.c
2ec00 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
2ec10 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2ec20 2d 2d 2d 0d 0a 32 36 34 39 0d 0a 32 38 35 37 0d  ---..2649..2857.
2ec30 0a 34 37 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .4784....query I
2ec40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2ec50 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 63   cor0.col0 + - c
2ec60 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2ec70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ec80 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d 0a  ---..-9..34..7..
2ec90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2eca0 74 0d 0a 53 45 4c 45 43 54 20 35 32 20 2b 20 2b  t..SELECT 52 + +
2ecb0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41   col1 * + col2 A
2ecc0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
2ecd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2ece0 31 33 30 30 0d 0a 31 34 35 36 0d 0a 36 32 32 0d  1300..1456..622.
2ecf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2ed00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2ed10 4e 43 54 20 2b 20 35 31 20 41 53 20 63 6f 6c 31  NCT + 51 AS col1
2ed20 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2ed30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 31 0d 0a 0d 0a  r0..----..51....
2ed40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ed50 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2ed60 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 30 20 29   col0 * ( col0 )
2ed70 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2ed80 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d 0a  b1..----..4096..
2ed90 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72 79  6400..9....query
2eda0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2edb0 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 37 35  CT - col0 * - 75
2edc0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
2edd0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 30 30 0d 0a  b0..----..1800..
2ede0 32 36 32 35 0d 0a 36 36 37 35 0d 0a 0d 0a 71 75  2625..6675....qu
2edf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2ee00 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 37 30 20  ELECT col0 * 70 
2ee10 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
2ee20 32 0d 0a 2d 2d 2d 2d 0d 0a 34 39 30 0d 0a 35 34  2..----..490..54
2ee30 36 30 0d 0a 35 35 33 30 0d 0a 0d 0a 71 75 65 72  60..5530....quer
2ee40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ee50 45 43 54 20 63 6f 6c 30 20 2a 20 28 20 2d 20 74  ECT col0 * ( - t
2ee60 61 62 32 2e 63 6f 6c 30 20 29 20 2a 20 63 6f 6c  ab2.col0 ) * col
2ee70 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2ee80 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 30  ab2..----..-1060
2ee90 39 37 0d 0a 2d 31 35 31 39 0d 0a 2d 33 35 38 39  97..-1519..-3589
2eea0 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
2eeb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2eec0 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 28 20  col1 + col0 * ( 
2eed0 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 31  col0 ) FROM tab1
2eee0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2eef0 33 35 0d 0a 34 31 30 36 0d 0a 36 34 31 33 0d 0a  35..4106..6413..
2ef00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ef10 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
2ef20 20 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   7 FROM tab2 AS 
2ef30 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d 0a  cor0..----..14..
2ef40 38 35 0d 0a 38 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  85..86....onlyif
2ef50 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2ef60 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2ef70 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2ef80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2ef90 6c 61 62 65 6c 2d 31 33 31 37 0d 0a 53 45 4c 45  label-1317..SELE
2efa0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
2efb0 20 44 49 56 20 36 34 20 2b 20 35 39 20 63 6f 6c   DIV 64 + 59 col
2efc0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
2efd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 0d 0a 36  or0..----..59..6
2efe0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
2eff0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2f000 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2f010 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2f020 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
2f030 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2f040 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2f050 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2f060 65 6c 2d 31 33 31 37 0d 0a 53 45 4c 45 43 54 20  el-1317..SELECT 
2f070 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2f 20  DISTINCT col2 / 
2f080 36 34 20 2b 20 35 39 20 63 6f 6c 31 20 46 52 4f  64 + 59 col1 FRO
2f090 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2f0a0 2d 2d 2d 2d 0d 0a 35 39 0d 0a 36 30 0d 0a 0d 0a  ----..59..60....
2f0b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f0c0 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
2f0d0 20 35 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   51 + col1 FROM 
2f0e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2f0f0 2d 2d 0d 0a 2d 31 33 30 30 0d 0a 2d 35 30 30 0d  --..-1300..-500.
2f100 0a 2d 36 35 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .-650....onlyif 
2f110 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2f120 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2f130 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2f140 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2f150 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f160 6c 2d 31 33 31 39 0d 0a 53 45 4c 45 43 54 20 41  l-1319..SELECT A
2f170 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 43 41  LL + col0 * + CA
2f180 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
2f190 45 44 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a  ED ) FROM tab2..
2f1a0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
2f1b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2f1c0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2f1d0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2f1e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f1f0 33 31 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  319..SELECT ALL 
2f200 2b 20 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 20  + col0 * + CAST 
2f210 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
2f220 52 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  R ) FROM tab2..-
2f230 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
2f240 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
2f250 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f260 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
2f270 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2d  l0 * cor0.col1 -
2f280 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
2f290 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
2f2a0 2d 2d 0d 0a 31 30 32 37 0d 0a 35 32 0d 0a 36 33  --..1027..52..63
2f2b0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
2f2c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2f2d0 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 33  TINCT + col2 * 3
2f2e0 31 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  1 + + col2 AS co
2f2f0 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
2f300 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 35 36  cor0..----..1056
2f310 0d 0a 32 36 32 34 0d 0a 33 32 0d 0a 0d 0a 71 75  ..2624..32....qu
2f320 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f330 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30  ELECT ALL - col0
2f340 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 34 32 20 2a   * col0 + + 42 *
2f350 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
2f360 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f370 0a 2d 31 33 35 0d 0a 2d 36 37 38 34 0d 0a 2d 39  .-135..-6784..-9
2f380 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  760....query I r
2f390 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2f3a0 4c 4c 20 28 20 2d 20 35 32 20 29 20 41 53 20 63  LL ( - 52 ) AS c
2f3b0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol0 FROM tab1, t
2f3c0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2f3d0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2f3e0 69 6e 67 20 74 6f 20 39 35 30 30 61 66 65 35 36  ing to 9500afe56
2f3f0 34 36 64 36 32 30 64 35 65 38 39 34 33 33 35 31  46d620d5e8943351
2f400 61 32 39 64 30 38 32 0d 0a 0d 0a 71 75 65 72 79  a29d082....query
2f410 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f420 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20  CT DISTINCT + - 
2f430 63 6f 6c 30 20 2a 20 2d 20 39 36 20 2d 20 63 6f  col0 * - 96 - co
2f440 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
2f450 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 34 35 0d  cor0..----..645.
2f460 0a 37 34 36 32 0d 0a 37 35 34 36 0d 0a 0d 0a 71  .7462..7546....q
2f470 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f480 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72  SELECT ALL - cor
2f490 30 2e 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20  0.col1 + + col0 
2f4a0 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + + col1 FROM ta
2f4b0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  b1 cor0..----..3
2f4c0 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79  ..64..80....only
2f4d0 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2f4e0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2f4f0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2f500 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2f510 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f520 61 62 65 6c 2d 31 33 32 36 0d 0a 53 45 4c 45 43  abel-1326..SELEC
2f530 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
2f540 31 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c  1 * - CAST( NULL
2f550 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2d 20   AS DECIMAL ) - 
2f560 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2f570 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
2f580 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
2f590 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2f5a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2f5b0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 36 0d  sort label-1326.
2f5c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2f5d0 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54   + col1 * - CAST
2f5e0 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
2f5f0 29 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) - col0 FROM ta
2f600 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
2f610 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
2f620 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f630 54 20 63 6f 6c 31 20 2b 20 2d 20 28 20 2d 20 63  T col1 + - ( - c
2f640 6f 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol2 + - cor0.col
2f650 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
2f660 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
2f670 0d 0a 31 33 33 0d 0a 31 34 33 0d 0a 32 36 32 0d  ..133..143..262.
2f680 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2f690 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
2f6a0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
2f6b0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
2f6c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2f6d0 33 32 38 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  328..SELECT col0
2f6e0 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44   + col0 + col1 D
2f6f0 49 56 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53  IV ( - col0 ) AS
2f700 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
2f710 0a 2d 2d 2d 2d 0d 0a 31 37 37 0d 0a 34 35 0d 0a  .----..177..45..
2f720 36 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  68....skipif mys
2f730 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2f740 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2f750 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 38 0d  sort label-1328.
2f760 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 63  .SELECT col0 + c
2f770 6f 6c 30 20 2b 20 63 6f 6c 31 20 2f 20 28 20 2d  ol0 + col1 / ( -
2f780 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20   col0 ) AS col0 
2f790 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2f7a0 0a 31 37 37 0d 0a 34 35 0d 0a 36 38 0d 0a 0d 0a  .177..45..68....
2f7b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f7c0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2f7d0 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 32  l0 * col1 + col2
2f7e0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2f7f0 0d 0a 32 30 39 37 0d 0a 33 33 39 36 0d 0a 38 31  ..2097..3396..81
2f800 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  81....query I ro
2f810 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2f820 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63  r0.col1 * cor0.c
2f830 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 - - cor0.col
2f840 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
2f850 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 32 37 0d 0a  or0..----..327..
2f860 33 35 30 37 0d 0a 39 38 38 0d 0a 0d 0a 6f 6e 6c  3507..988....onl
2f870 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
2f880 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
2f890 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
2f8a0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
2f8b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2f8c0 6c 61 62 65 6c 2d 31 33 33 31 0d 0a 53 45 4c 45  label-1331..SELE
2f8d0 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20  CT + CAST( NULL 
2f8e0 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f  AS SIGNED ) + co
2f8f0 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  l1 + - col0 * + 
2f900 35 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  58 AS col2 FROM 
2f910 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab1..----..NULL
2f920 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2f930 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2f940 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2f950 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f960 61 62 65 6c 2d 31 33 33 31 0d 0a 53 45 4c 45 43  abel-1331..SELEC
2f970 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  T + CAST ( NULL 
2f980 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 63  AS INTEGER ) + c
2f990 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b  ol1 + - col0 * +
2f9a0 20 35 38 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   58 AS col2 FROM
2f9b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab1..----..NUL
2f9c0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
2f9d0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2f9e0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2f9f0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2fa00 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2fa10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33  owsort label-133
2fa20 32 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  2..SELECT col1 *
2fa30 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20 46   col0 DIV col2 F
2fa40 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2fa50 33 33 39 35 0d 0a 36 32 0d 0a 39 38 0d 0a 0d 0a  3395..62..98....
2fa60 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2fa70 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2fa80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2fa90 61 62 65 6c 2d 31 33 33 32 0d 0a 53 45 4c 45 43  abel-1332..SELEC
2faa0 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2f 20  T col1 * col0 / 
2fab0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
2fac0 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36 32 0d 0a  ----..3395..62..
2fad0 39 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  98....onlyif mys
2fae0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2faf0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2fb00 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2fb10 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2fb20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2fb30 33 33 33 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  333..SELECT ALL 
2fb40 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20  + CAST( col0 AS 
2fb50 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c  SIGNED ) + - col
2fb60 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
2fb70 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a  -..-24..19..62..
2fb80 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
2fb90 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
2fba0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2fbb0 20 6c 61 62 65 6c 2d 31 33 33 33 0d 0a 53 45 4c   label-1333..SEL
2fbc0 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20 28  ECT ALL + CAST (
2fbd0 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
2fbe0 20 29 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   ) + - col1 FROM
2fbf0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   tab2..----..-24
2fc00 0d 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72  ..19..62....quer
2fc10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fc20 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ECT + col2 * col
2fc30 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  0 + col0 * - col
2fc40 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2fc50 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2fc60 2d 0d 0a 2d 32 35 37 34 0d 0a 2d 32 38 0d 0a 31  -..-2574..-28..1
2fc70 36 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  659....query I r
2fc80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
2fc90 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2b 20 63  ol2 * + col2 + c
2fca0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
2fcb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   cor0..----..291
2fcc0 39 0d 0a 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d  9..3313..9296...
2fcd0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2fce0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2fcf0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2fd00 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2fd10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 33  owsort label-133
2fd20 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
2fd30 43 54 20 2b 20 34 31 20 44 49 56 20 2d 20 63 6f  CT + 41 DIV - co
2fd40 6c 32 20 2b 20 28 20 2d 20 28 20 2d 20 63 6f 6c  l2 + ( - ( - col
2fd50 32 20 29 20 2b 20 2d 20 63 6f 6c 31 20 29 20 41  2 ) + - col1 ) A
2fd60 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2fd70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
2fd80 37 0d 0a 2d 35 34 0d 0a 2d 39 0d 0a 0d 0a 73 6b  7..-54..-9....sk
2fd90 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2fda0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2fdb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2fdc0 65 6c 2d 31 33 33 36 0d 0a 53 45 4c 45 43 54 20  el-1336..SELECT 
2fdd0 44 49 53 54 49 4e 43 54 20 2b 20 34 31 20 2f 20  DISTINCT + 41 / 
2fde0 2d 20 63 6f 6c 32 20 2b 20 28 20 2d 20 28 20 2d  - col2 + ( - ( -
2fdf0 20 63 6f 6c 32 20 29 20 2b 20 2d 20 63 6f 6c 31   col2 ) + - col1
2fe00 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
2fe10 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2fe20 0a 2d 31 33 37 0d 0a 2d 35 34 0d 0a 2d 39 0d 0a  .-137..-54..-9..
2fe30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fe40 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 32 30  t..SELECT - - 20
2fe50 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
2fe60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2fe70 0a 32 37 0d 0a 39 38 0d 0a 39 39 0d 0a 0d 0a 73  .27..98..99....s
2fe80 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2fe90 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2fea0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2feb0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2fec0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2fed0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2fee0 41 4c 4c 20 36 37 20 2d 20 63 6f 6c 30 20 63 6f  ALL 67 - col0 co
2fef0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
2ff00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d  cor0..----..-11.
2ff10 0a 2d 31 32 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72  .-12..60....quer
2ff20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ff30 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2ff40 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d  ol0 * + col0 + -
2ff50 20 36 38 20 46 52 4f 4d 20 74 61 62 31 20 63 6f   68 FROM tab1 co
2ff60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 39 0d 0a 34  r0..----..-59..4
2ff70 30 32 38 0d 0a 36 33 33 32 0d 0a 0d 0a 71 75 65  028..6332....que
2ff80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ff90 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 39 38 20  LECT ALL - - 98 
2ffa0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
2ffb0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2ffc0 0a 39 38 0d 0a 39 38 0d 0a 39 38 0d 0a 0d 0a 6f  .98..98..98....o
2ffd0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
2ffe0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
2fff0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
30000 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
30010 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34 31 0d  sort label-1341.
30020 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
30030 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 44 49 56   col2 * col2 DIV
30040 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
30050 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
30060 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a 33 32 34 0d  .----..112..324.
30070 0a 37 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .708....skipif m
30080 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
30090 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
300a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 34  owsort label-134
300b0 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
300c0 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2f  CT col2 * col2 /
300d0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
300e0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
300f0 0a 2d 2d 2d 2d 0d 0a 31 31 32 0d 0a 33 32 34 0d  .----..112..324.
30100 0a 37 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .708....query I 
30110 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30120 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 6c 31 20 29  ALL + ( - col1 )
30130 20 2a 20 37 36 20 46 52 4f 4d 20 74 61 62 31 20   * 76 FROM tab1 
30140 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
30150 31 39 37 36 0d 0a 2d 37 36 30 0d 0a 2d 39 38 38  1976..-760..-988
30160 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30170 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
30180 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
30190 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
301a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
301b0 31 33 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1343..SELECT + c
301c0 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 28 20 2b  ol0 * col2 - ( +
301d0 20 36 31 20 29 20 44 49 56 20 2d 20 63 6f 6c 30   61 ) DIV - col0
301e0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
301f0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 33  r0..----..182..3
30200 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 73 6b 69  648..7680....ski
30210 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
30220 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
30230 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
30240 6c 2d 31 33 34 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1343..SELECT +
30250 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2d 20 28   col0 * col2 - (
30260 20 2b 20 36 31 20 29 20 2f 20 2d 20 63 6f 6c 30   + 61 ) / - col0
30270 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
30280 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a 33  r0..----..182..3
30290 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65  648..7680....que
302a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
302b0 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  LECT + col2 * co
302c0 6c 30 20 2d 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 - - col1 FROM
302d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
302e0 2d 2d 2d 0d 0a 31 38 38 0d 0a 33 36 35 38 0d 0a  ---..188..3658..
302f0 37 36 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  7693....onlyif m
30300 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
30310 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
30320 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
30330 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
30340 62 65 6c 2d 31 33 34 35 0d 0a 53 45 4c 45 43 54  bel-1345..SELECT
30350 20 2b 20 36 37 20 2a 20 63 6f 6c 32 20 2b 20 2b   + 67 * col2 + +
30360 20 37 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c   72 DIV cor0.col
30370 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
30380 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 31 31 0d  or0..----..2211.
30390 0a 35 34 39 34 0d 0a 36 37 0d 0a 0d 0a 73 6b 69  .5494..67....ski
303a0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
303b0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
303c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
303d0 6c 2d 31 33 34 35 0d 0a 53 45 4c 45 43 54 20 2b  l-1345..SELECT +
303e0 20 36 37 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 37   67 * col2 + + 7
303f0 32 20 2f 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  2 / cor0.col1 FR
30400 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
30410 0a 2d 2d 2d 2d 0d 0a 32 32 31 31 0d 0a 35 34 39  .----..2211..549
30420 34 0d 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49  4..67....query I
30430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30440 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 34 37   DISTINCT - + 47
30450 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
30460 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
30470 2d 0d 0a 2d 31 32 32 32 0d 0a 2d 34 37 30 0d 0a  -..-1222..-470..
30480 2d 36 31 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  -611....skipif p
30490 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
304a0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
304b0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
304c0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
304d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
304e0 0d 0a 53 45 4c 45 43 54 20 38 30 20 2b 20 2b 20  ..SELECT 80 + + 
304f0 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
30500 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
30510 2d 0d 0a 31 30 36 0d 0a 31 30 37 0d 0a 31 31 38  -..106..107..118
30520 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
30530 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
30540 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
30550 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
30560 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
30570 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30580 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
30590 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
305a0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
305b0 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d  -17..-31..-59...
305c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
305d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 38  ..SELECT ALL - 8
305e0 34 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  4 AS col0 FROM t
305f0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
30600 2d 38 34 0d 0a 2d 38 34 0d 0a 2d 38 34 0d 0a 0d  -84..-84..-84...
30610 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30620 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
30630 2b 20 34 32 20 46 52 4f 4d 20 74 61 62 32 20 41  + 42 FROM tab2 A
30640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
30650 36 0d 0a 2d 33 37 0d 0a 33 35 0d 0a 0d 0a 71 75  6..-37..35....qu
30660 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30670 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
30680 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b   col1 * - col2 +
30690 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
306a0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
306b0 2d 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37  --..194..2924..7
306c0 35 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  553....query I r
306d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
306e0 20 33 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f   30 * col0 AS co
306f0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
30700 2d 2d 0d 0a 2d 31 39 32 30 0d 0a 2d 32 34 30 30  --..-1920..-2400
30710 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-90....query I
30720 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30730 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a   + col0 * col2 *
30740 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74   ( col1 ) FROM t
30750 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
30760 2d 0d 0a 31 31 39 36 35 32 0d 0a 35 31 30 33 34  -..119652..51034
30770 0d 0a 35 38 35 39 0d 0a 0d 0a 71 75 65 72 79 20  ..5859....query 
30780 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30790 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 35 30 20  T + + col1 * 50 
307a0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  + cor0.col0 FROM
307b0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
307c0 2d 2d 2d 0d 0a 31 35 35 37 0d 0a 33 30 32 38 0d  ---..1557..3028.
307d0 0a 39 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .929....query I 
307e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
307f0 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  - col2 + + col0 
30800 2a 20 38 36 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 86 AS col1 FRO
30810 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
30820 2d 2d 2d 2d 0d 0a 32 30 33 31 0d 0a 33 30 30 39  ----..2031..3009
30830 0d 0a 37 35 37 32 0d 0a 0d 0a 71 75 65 72 79 20  ..7572....query 
30840 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30850 54 20 63 6f 6c 32 20 2b 20 2d 20 32 39 20 2a 20  T col2 + - 29 * 
30860 2d 20 31 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53  - 10 * + col0 AS
30870 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
30880 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
30890 30 31 35 31 0d 0a 32 35 38 39 32 0d 0a 36 39 39  0151..25892..699
308a0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
308b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
308c0 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ol1 + col2 * col
308d0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
308e0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
308f0 2d 0d 0a 31 34 37 35 0d 0a 36 32 39 0d 0a 38 30  -..1475..629..80
30900 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
30910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
30920 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol0 + col1 * col
30930 30 20 2a 20 38 36 20 46 52 4f 4d 20 74 61 62 30  0 * 86 FROM tab0
30940 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30950 31 37 37 35 32 38 0d 0a 32 39 32 30 30 35 0d 0a  177528..292005..
30960 36 39 36 36 30 33 0d 0a 0d 0a 71 75 65 72 79 20  696603....query 
30970 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30980 54 20 41 4c 4c 20 2d 20 2d 20 33 30 20 46 52 4f  T ALL - - 30 FRO
30990 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
309a0 2d 0d 0a 33 30 0d 0a 33 30 0d 0a 33 30 0d 0a 0d  -..30..30..30...
309b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
309c0 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 28 20 28  ..SELECT + - ( (
309d0 20 63 6f 6c 32 20 29 20 29 20 46 52 4f 4d 20 74   col2 ) ) FROM t
309e0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
309f0 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36  -..-54..-57..-96
30a00 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30a10 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
30a20 49 4e 43 54 20 2d 20 31 30 20 2a 20 63 6f 6c 32  INCT - 10 * col2
30a30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
30a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 30 0d 0a  r0..----..-260..
30a50 2d 32 37 30 0d 0a 2d 33 38 30 0d 0a 0d 0a 71 75  -270..-380....qu
30a60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30a70 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34  ELECT DISTINCT 4
30a80 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  0 + - col1 FROM 
30a90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
30aa0 2d 2d 0d 0a 31 34 0d 0a 32 37 0d 0a 33 30 0d 0a  --..14..27..30..
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 41 4c 4c 20 2b 20  t..SELECT ALL + 
30ad0 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e  - col0 * + cor0.
30ae0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
30af0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
30b00 32 32 35 0d 0a 2d 35 37 36 0d 0a 2d 37 39 32 31  225..-576..-7921
30b10 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
30b20 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
30b30 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
30b40 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
30b50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
30b60 31 33 36 34 0d 0a 53 45 4c 45 43 54 20 63 6f 72  1364..SELECT cor
30b70 30 2e 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  0.col0 * cor0.co
30b80 6c 31 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d  l1 DIV col1 FROM
30b90 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
30ba0 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..7..78..79..
30bb0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
30bc0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
30bd0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
30be0 20 6c 61 62 65 6c 2d 31 33 36 34 0d 0a 53 45 4c   label-1364..SEL
30bf0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20  ECT cor0.col0 * 
30c00 63 6f 72 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31  cor0.col1 / col1
30c10 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
30c20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d  r0..----..7..78.
30c30 0a 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .79....skipif my
30c40 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
30c50 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
30c60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
30c70 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20  STINCT + CAST ( 
30c80 2b 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29  + col2 AS REAL )
30c90 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
30ca0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37  r0..----..54..57
30cb0 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..96....onlyif m
30cc0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
30cd0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
30ce0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
30cf0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
30d00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30d10 2d 31 33 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20  -1366..SELECT + 
30d20 2b 20 43 41 53 54 28 20 2d 20 63 6f 72 30 2e 63  + CAST( - cor0.c
30d30 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol1 AS SIGNED ) 
30d40 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * - col2 AS col0
30d50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
30d60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a  r0..----..2838..
30d70 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70  7462..97....skip
30d80 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
30d90 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
30da0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30db0 2d 31 33 36 36 0d 0a 53 45 4c 45 43 54 20 2b 20  -1366..SELECT + 
30dc0 2b 20 43 41 53 54 20 28 20 2d 20 63 6f 72 30 2e  + CAST ( - cor0.
30dd0 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20  col1 AS INTEGER 
30de0 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ) * - col2 AS co
30df0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
30e00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38  cor0..----..2838
30e10 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75  ..7462..97....qu
30e20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30e30 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
30e40 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
30e50 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
30e60 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
30e70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30e80 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
30e90 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 63  ol2 + + col0 + c
30ea0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
30eb0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
30ec0 2d 2d 2d 0d 0a 31 38 32 0d 0a 31 39 36 0d 0a 34  ---..182..196..4
30ed0 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
30ee0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
30ef0 54 49 4e 43 54 20 28 20 31 32 20 29 20 2a 20 2d  TINCT ( 12 ) * -
30f00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
30f10 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
30f20 32 30 34 0d 0a 2d 33 37 32 0d 0a 2d 37 30 38 0d  204..-372..-708.
30f30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
30f40 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
30f50 20 37 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c   7 * col1 AS col
30f60 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
30f70 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 0d 0a  or0..----..182..
30f80 37 30 0d 0a 39 31 0d 0a 0d 0a 71 75 65 72 79 20  70..91....query 
30f90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
30fa0 54 20 37 38 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  T 78 * col0 + co
30fb0 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
30fc0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
30fd0 2d 2d 0d 0a 31 38 39 36 0d 0a 32 37 36 35 0d 0a  --..1896..2765..
30fe0 37 30 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7031....query I 
30ff0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31000 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  ALL col0 * - col
31010 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  0 * col2 AS col1
31020 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
31030 0d 0a 2d 31 33 32 33 0d 0a 2d 31 35 38 31 38 34  ..-1323..-158184
31040 0d 0a 2d 32 33 37 31 35 38 0d 0a 0d 0a 71 75 65  ..-237158....que
31050 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
31060 4c 45 43 54 20 41 4c 4c 20 34 35 20 46 52 4f 4d  LECT ALL 45 FROM
31070 20 74 61 62 32 2c 20 74 61 62 30 20 63 6f 72 30   tab2, tab0 cor0
31080 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
31090 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
310a0 68 61 73 68 69 6e 67 20 74 6f 20 31 34 63 65 63  hashing to 14cec
310b0 38 37 31 65 64 63 33 37 62 35 30 35 36 63 64 61  871edc37b5056cda
310c0 30 31 63 38 33 33 31 66 64 63 61 0d 0a 0d 0a 6f  01c8331fdca....o
310d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
310e0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
310f0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
31100 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
31110 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37 34 0d  sort label-1374.
31120 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
31130 20 2d 20 31 33 20 2a 20 2b 20 63 6f 6c 30 20 44   - 13 * + col0 D
31140 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c  IV - col0 AS col
31150 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
31160 2d 0d 0a 31 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  -..13....skipif 
31170 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31180 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31190 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
311a0 37 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  74..SELECT DISTI
311b0 4e 43 54 20 2d 20 31 33 20 2a 20 2b 20 63 6f 6c  NCT - 13 * + col
311c0 30 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 / - col0 AS co
311d0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
311e0 2d 2d 0d 0a 31 33 0d 0a 0d 0a 71 75 65 72 79 20  --..13....query 
311f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31200 54 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20  T + tab2.col0 + 
31210 74 61 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab2.col2 FROM t
31220 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a  ab2..----..104..
31230 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79  117..34....query
31240 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31250 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20  CT ALL col0 + + 
31260 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
31270 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
31280 2d 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32 0d 0a  ---..132..2862..
31290 37 35 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7551....query I 
312a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
312b0 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 30 20 2b 20  ALL tab1.col0 + 
312c0 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  - col2 * - col2 
312d0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
312e0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 39 0d 0a 33  1..----..2919..3
312f0 33 31 33 0d 0a 39 32 39 36 0d 0a 0d 0a 71 75 65  313..9296....que
31300 72 79 20 49 49 49 49 49 49 20 72 6f 77 73 6f 72  ry IIIIII rowsor
31310 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20  t..SELECT ALL * 
31320 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
31330 63 6f 72 30 20 57 48 45 52 45 20 4e 4f 54 20 28  cor0 WHERE NOT (
31340 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 3c   + cor0.col0 ) <
31350 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  > NULL..----....
31360 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
31370 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30  .SELECT ALL col0
31380 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30   + - col0 * col0
31390 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41   * + cor0.col1 A
313a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
313b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
313c0 2d 31 31 38 37 39 30 0d 0a 2d 34 39 35 31 32 0d  -118790..-49512.
313d0 0a 2d 37 32 30 37 32 32 0d 0a 0d 0a 73 6b 69 70  .-720722....skip
313e0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
313f0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
31400 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
31410 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
31420 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
31430 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
31440 32 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20  2 * - col1 col1 
31450 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
31460 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a  0..----..-2838..
31470 2d 37 34 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75  -7462..-97....qu
31480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31490 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
314a0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2b   col1 * + col2 +
314b0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
314c0 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
314d0 2d 2d 0d 0a 31 33 34 34 0d 0a 31 34 35 38 0d 0a  --..1344..1458..
314e0 36 32 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  627....onlyif my
314f0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
31500 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
31510 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
31520 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31530 65 6c 2d 31 33 38 32 0d 0a 53 45 4c 45 43 54 20  el-1382..SELECT 
31540 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63  ALL - col0 - - c
31550 6f 6c 31 20 44 49 56 20 63 6f 6c 31 20 41 53 20  ol1 DIV col1 AS 
31560 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
31570 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
31580 33 0d 0a 2d 33 34 0d 0a 2d 38 38 0d 0a 0d 0a 73  3..-34..-88....s
31590 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
315a0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
315b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
315c0 62 65 6c 2d 31 33 38 32 0d 0a 53 45 4c 45 43 54  bel-1382..SELECT
315d0 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20 2d 20   ALL - col0 - - 
315e0 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 41 53 20 63  col1 / col1 AS c
315f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
31600 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33   cor0..----..-23
31610 0d 0a 2d 33 34 0d 0a 2d 38 38 0d 0a 0d 0a 71 75  ..-34..-88....qu
31620 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72 74 0d  ery III rowsort.
31630 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
31640 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20  OM tab2 AS cor0 
31650 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20 49  WHERE NOT NULL I
31660 4e 20 28 20 63 6f 6c 30 20 29 20 4f 52 20 4e 55  N ( col0 ) OR NU
31670 4c 4c 20 3e 20 28 20 63 6f 6c 30 20 29 0d 0a 2d  LL > ( col0 )..-
31680 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ---....onlyif my
31690 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
316a0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
316b0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
316c0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
316d0 65 6c 2d 31 33 38 34 0d 0a 53 45 4c 45 43 54 20  el-1384..SELECT 
316e0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
316f0 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20  + col0 DIV col0 
31700 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53  + col1 * col2 AS
31710 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
31720 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
31730 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a 0d  560..684..864...
31740 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
31750 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
31760 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31770 6c 61 62 65 6c 2d 31 33 38 34 0d 0a 53 45 4c 45  label-1384..SELE
31780 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
31790 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30   * + col0 / col0
317a0 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41   + col1 * col2 A
317b0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
317c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
317d0 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a  1560..684..864..
317e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
317f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
31800 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 30   * + col2 - col0
31810 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
31820 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
31830 31 39 36 0d 0a 2d 32 31 30 36 0d 0a 2d 33 30 38  196..-2106..-308
31840 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
31850 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
31860 20 2d 20 39 32 20 41 53 20 63 6f 6c 30 20 46 52   - 92 AS col0 FR
31870 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
31880 39 32 0d 0a 2d 39 32 0d 0a 2d 39 32 0d 0a 0d 0a  92..-92..-92....
31890 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
318a0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b  .SELECT + col0 +
318b0 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   - col0 * col0 A
318c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
318d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
318e0 2d 31 31 39 30 0d 0a 2d 35 35 32 0d 0a 2d 37 38  -1190..-552..-78
318f0 33 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  32....onlyif mys
31900 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
31910 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
31920 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
31930 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31940 6c 2d 31 33 38 38 0d 0a 53 45 4c 45 43 54 20 2b  l-1388..SELECT +
31950 20 2b 20 38 35 20 44 49 56 20 63 6f 72 30 2e 63   + 85 DIV cor0.c
31960 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20  ol1 - + col1 AS 
31970 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
31980 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a  or0..----..-12..
31990 2d 32 39 0d 0a 2d 35 38 0d 0a 0d 0a 73 6b 69 70  -29..-58....skip
319a0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
319b0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
319c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
319d0 2d 31 33 38 38 0d 0a 53 45 4c 45 43 54 20 2b 20  -1388..SELECT + 
319e0 2b 20 38 35 20 2f 20 63 6f 72 30 2e 63 6f 6c 31  + 85 / cor0.col1
319f0 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   - + col1 AS col
31a00 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
31a10 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 32 39  ..----..-12..-29
31a20 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-58....query I
31a30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31a40 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
31a50 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46   * col1 * col0 F
31a60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
31a70 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 38 30 0d 0a 34  ..----..36480..4
31a80 32 31 32 0d 0a 39 39 38 34 30 0d 0a 0d 0a 71 75  212..99840....qu
31a90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31aa0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
31ab0 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 63   cor0.col2 + - c
31ac0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32  or0.col2 AS col2
31ad0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
31ae0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a  r0..----..-164..
31af0 2d 32 0d 0a 2d 36 36 0d 0a 0d 0a 71 75 65 72 79  -2..-66....query
31b00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31b10 43 54 20 41 4c 4c 20 2d 20 31 20 2b 20 2b 20 63  CT ALL - 1 + + c
31b20 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
31b30 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
31b40 2d 2d 2d 0d 0a 36 0d 0a 37 37 0d 0a 37 38 0d 0a  ---..6..77..78..
31b50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31b60 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 37 20  t..SELECT - - 7 
31b70 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  * + col0 + col0 
31b80 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
31b90 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32 0d 0a 32 38  0..----..192..28
31ba0 30 0d 0a 37 31 32 0d 0a 0d 0a 71 75 65 72 79 20  0..712....query 
31bb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31bc0 54 20 63 6f 6c 31 20 2d 20 2d 20 74 61 62 30 2e  T col1 - - tab0.
31bd0 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col0 * + col0 AS
31be0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
31bf0 57 48 45 52 45 20 28 20 2d 20 63 6f 6c 32 20 29  WHERE ( - col2 )
31c00 20 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d   > NULL..----...
31c10 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f  .query III rowso
31c20 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f  rt..SELECT * FRO
31c30 4d 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54  M tab1 WHERE NOT
31c40 20 28 20 2b 20 63 6f 6c 31 20 29 20 3c 3e 20 28   ( + col1 ) <> (
31c50 20 2b 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d   + col0 )..----.
31c60 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
31c70 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
31c80 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
31c90 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
31ca0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
31cb0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31cc0 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c  ECT - col1 + col
31cd0 31 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 * + col1 * col
31ce0 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  1 col1 FROM tab1
31cf0 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35 35 30 0d 0a 32  ..----..17550..2
31d00 31 38 34 0d 0a 39 39 30 0d 0a 0d 0a 71 75 65 72  184..990....quer
31d10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
31d20 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
31d30 30 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20 2a 20  0 + tab0.col0 * 
31d40 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  tab0.col2 AS col
31d50 30 20 46 52 4f 4d 20 74 61 62 30 20 57 48 45 52  0 FROM tab0 WHER
31d60 45 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 3e 20  E + tab0.col2 > 
31d70 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( NULL )..----..
31d80 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
31d90 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
31da0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
31db0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
31dc0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
31dd0 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  97..SELECT ALL c
31de0 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56  ol1 + + col2 DIV
31df0 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 41   - col1 - col2 A
31e00 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
31e10 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d 35 32  ..----..-30..-52
31e20 0d 0a 2d 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-90....skipif 
31e30 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
31e40 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
31e50 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
31e60 39 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  97..SELECT ALL c
31e70 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d  ol1 + + col2 / -
31e80 20 63 6f 6c 31 20 2d 20 63 6f 6c 32 20 41 53 20   col1 - col2 AS 
31e90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
31ea0 2d 2d 2d 2d 0d 0a 2d 33 30 0d 0a 2d 35 32 0d 0a  ----..-30..-52..
31eb0 2d 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -90....query I r
31ec0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
31ed0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d  ol0 * + col2 * -
31ee0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 46   col1 + - col1 F
31ef0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
31f00 2d 33 34 39 32 0d 0a 2d 36 36 34 32 30 39 0d 0a  -3492..-664209..
31f10 2d 36 38 31 39 38 0d 0a 0d 0a 73 6b 69 70 69 66  -68198....skipif
31f20 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
31f30 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
31f40 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
31f50 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
31f60 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
31f70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
31f80 4e 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  NCT col1 + + col
31f90 30 20 2b 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52  0 + col2 col1 FR
31fa0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
31fb0 33 31 0d 0a 31 38 39 0d 0a 38 33 0d 0a 0d 0a 6f  31..189..83....o
31fc0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
31fd0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
31fe0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
31ff0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
32000 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 30 0d  sort label-1400.
32010 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 74  .SELECT col2 * t
32020 61 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  ab0.col1 + col1 
32030 44 49 56 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20  DIV + tab0.col1 
32040 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  + + col1 AS col0
32050 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
32060 0d 0a 31 39 35 0d 0a 32 39 32 35 0d 0a 37 35 35  ..195..2925..755
32070 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
32080 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
32090 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
320a0 6f 72 74 20 6c 61 62 65 6c 2d 31 34 30 30 0d 0a  ort label-1400..
320b0 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 74 61  SELECT col2 * ta
320c0 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2f  b0.col1 + col1 /
320d0 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 2b 20 2b   + tab0.col1 + +
320e0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
320f0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
32100 39 35 0d 0a 32 39 32 35 0d 0a 37 35 35 34 0d 0a  95..2925..7554..
32110 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
32120 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
32130 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
32140 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
32150 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
32160 30 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  01..SELECT + col
32170 31 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20  1 * + tab1.col1 
32180 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c  + col2 DIV - col
32190 32 20 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52  2 + col0 col0 FR
321a0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
321b0 36 33 0d 0a 32 34 38 0d 0a 36 37 38 0d 0a 0d 0a  63..248..678....
321c0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
321d0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
321e0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
321f0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
32200 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
32210 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
32220 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
32230 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
32240 30 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  01..SELECT + col
32250 31 20 2a 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20  1 * + tab1.col1 
32260 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 32 20  + col2 / - col2 
32270 2b 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d  + col0 col0 FROM
32280 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 33   tab1..----..163
32290 0d 0a 32 34 38 0d 0a 36 37 38 0d 0a 0d 0a 71 75  ..248..678....qu
322a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
322b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
322c0 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41   col1 * + col2 A
322d0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
322e0 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20   WHERE NOT NULL 
322f0 4e 4f 54 20 42 45 54 57 45 45 4e 20 28 20 4e 55  NOT BETWEEN ( NU
32300 4c 4c 20 29 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d  LL ) AND NULL..-
32310 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
32320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32330 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63  ISTINCT col1 * c
32340 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f  ol1 * + col2 FRO
32350 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  M tab0..----..24
32360 34 30 36 38 0d 0a 36 37 39 30 34 32 0d 0a 39 34  4068..679042..94
32370 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  09....query I ro
32380 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
32390 62 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a  b0.col1 + col0 *
323a0 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f   col0 * col2 FRO
323b0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab0..----..13
323c0 32 32 0d 0a 31 39 30 39 34 0d 0a 36 34 39 36 31  22..19094..64961
323d0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
323e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
323f0 54 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 32 20  TINCT tab2.col2 
32400 2a 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  * col2 * + col2 
32410 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
32420 32 0d 0a 2d 2d 2d 2d 0d 0a 31 37 35 37 36 0d 0a  2..----..17576..
32430 31 39 36 38 33 0d 0a 35 34 38 37 32 0d 0a 0d 0a  19683..54872....
32440 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32450 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
32460 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
32470 20 74 61 62 32 20 57 48 45 52 45 20 4e 55 4c 4c   tab2 WHERE NULL
32480 20 42 45 54 57 45 45 4e 20 28 20 4e 55 4c 4c 20   BETWEEN ( NULL 
32490 29 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d  ) AND NULL..----
324a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
324b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
324c0 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  INCT col0 + - co
324d0 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l2 * - col2 FROM
324e0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31   tab1..----..291
324f0 39 0d 0a 33 33 31 33 0d 0a 39 32 39 36 0d 0a 0d  9..3313..9296...
32500 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32510 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
32520 2a 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 2b 20  * tab0.col2 + + 
32530 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
32540 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
32550 38 31 34 0d 0a 2d 36 32 0d 0a 2d 37 33 37 33 0d  814..-62..-7373.
32560 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32570 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
32580 31 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  1 + col2 AS col2
32590 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45 52 45   FROM tab1 WHERE
325a0 20 28 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   ( + col2 + col1
325b0 20 29 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20   ) BETWEEN NULL 
325c0 41 4e 44 20 28 20 4e 55 4c 4c 20 29 0d 0a 2d 2d  AND ( NULL )..--
325d0 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  --....query I ro
325e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
325f0 63 6f 6c 31 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col1 + - tab1.co
32600 6c 30 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l0 + col1 FROM t
32610 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a  ab1..----..-44..
32620 2d 35 34 0d 0a 34 39 0d 0a 0d 0a 71 75 65 72 79  -54..49....query
32630 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
32640 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2b  CT col2 * col2 +
32650 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
32660 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
32670 54 20 4e 55 4c 4c 20 3c 3d 20 28 20 4e 55 4c 4c  T NULL <= ( NULL
32680 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
32690 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
326a0 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63  ECT ALL col0 + c
326b0 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
326c0 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
326d0 28 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  ( - col1 + col1 
326e0 2b 20 63 6f 6c 32 20 29 20 4e 4f 54 20 49 4e 20  + col2 ) NOT IN 
326f0 28 20 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( col0 )..----..
32700 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32710 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32720 43 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31  CT col2 * + col1
32730 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32740 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  b2..----..1534..
32750 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72  646..837....quer
32760 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32770 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  ECT col2 * - col
32780 30 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 74 61 62  0 * col0 - + tab
32790 32 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  2.col2 AS col0 F
327a0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
327b0 2d 31 33 35 30 0d 0a 2d 31 35 38 32 31 30 0d 0a  -1350..-158210..
327c0 2d 32 33 37 31 39 36 0d 0a 0d 0a 71 75 65 72 79  -237196....query
327d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
327e0 43 54 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20 2a  CT + tab2.col0 *
327f0 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2d 20 2b   col0 * col1 - +
32800 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
32810 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
32820 30 36 30 31 38 0d 0a 31 35 31 32 0d 0a 33 35 38  06018..1512..358
32830 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  878....query I r
32840 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
32850 20 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c   col2 * tab1.col
32860 30 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52  0 - tab1.col2 FR
32870 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
32880 32 31 36 0d 0a 2d 33 37 30 35 0d 0a 2d 37 37 37  216..-3705..-777
32890 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
328a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
328b0 32 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  2 * + col2 FROM 
328c0 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20 2d  tab1 WHERE NOT -
328d0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 42 45 54   col0 + col1 BET
328e0 57 45 45 4e 20 28 20 4e 55 4c 4c 20 29 20 41 4e  WEEN ( NULL ) AN
328f0 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  D NULL..----....
32900 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
32910 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 63  .SELECT col1 * c
32920 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 57 48  ol2 FROM tab0 WH
32930 45 52 45 20 63 6f 6c 32 20 3c 3d 20 2d 20 63 6f  ERE col2 <= - co
32940 6c 31 20 2d 20 63 6f 6c 31 0d 0a 2d 2d 2d 2d 0d  l1 - col1..----.
32950 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
32960 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
32970 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
32980 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
32990 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
329a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
329b0 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  ECT cor0.col2 * 
329c0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30  + cor0.col0 col0
329d0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
329e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32  r0..----..35..72
329f0 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79  98..792....query
32a00 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
32a10 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  LECT * FROM tab1
32a20 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20   WHERE NOT col1 
32a30 2b 20 63 6f 6c 32 20 3c 3e 20 4e 55 4c 4c 0d 0a  + col2 <> NULL..
32a40 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
32a50 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32a60 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30  tab0.col2 * col0
32a70 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
32a80 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
32a90 0a 33 33 39 35 0d 0a 36 36 34 31 31 38 0d 0a 36  .3395..664118..6
32aa0 38 31 31 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8112....query I 
32ab0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32ac0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 63 6f  col0 * col1 + co
32ad0 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l0 * col2 FROM t
32ae0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
32af0 2d 0d 0a 32 34 30 0d 0a 34 32 38 38 0d 0a 38 37  -..240..4288..87
32b00 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  20....onlyif mys
32b10 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
32b20 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
32b30 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
32b40 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
32b50 6c 2d 31 34 32 33 0d 0a 53 45 4c 45 43 54 20 41  l-1423..SELECT A
32b60 4c 4c 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30  LL col2 DIV col0
32b70 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31   + - col2 + col1
32b80 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
32b90 0d 0a 2d 31 30 0d 0a 2d 34 37 0d 0a 2d 38 32 0d  ..-10..-47..-82.
32ba0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
32bb0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
32bc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32bd0 74 20 6c 61 62 65 6c 2d 31 34 32 33 0d 0a 53 45  t label-1423..SE
32be0 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20  LECT ALL col2 / 
32bf0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2b 20  col0 + - col2 + 
32c00 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
32c10 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 34 37 0d 0a  ----..-10..-47..
32c20 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -82....query I r
32c30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
32c40 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol0 * + col1 + c
32c50 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 + col0 FROM 
32c60 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 32 31  tab0..----..2121
32c70 0d 0a 33 34 33 31 0d 0a 38 32 37 30 0d 0a 0d 0a  ..3431..8270....
32c80 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
32c90 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
32ca0 20 74 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c   tab1 WHERE NULL
32cb0 20 49 4e 20 28 20 2b 20 63 6f 6c 32 20 29 0d 0a   IN ( + col2 )..
32cc0 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ----....query II
32cd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32ce0 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62  T ALL * FROM tab
32cf0 30 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  0 AS cor0 WHERE 
32d00 4e 4f 54 20 4e 55 4c 4c 20 42 45 54 57 45 45 4e  NOT NULL BETWEEN
32d10 20 4e 55 4c 4c 20 41 4e 44 20 28 20 63 6f 6c 31   NULL AND ( col1
32d20 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   + col0 + + col1
32d30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
32d40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32d50 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2b  ECT ALL - col0 +
32d60 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41   - col1 * col1 A
32d70 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
32d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32d90 2d 33 35 35 39 0d 0a 2d 33 36 38 0d 0a 2d 39 36  -3559..-368..-96
32da0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72  8....query III r
32db0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32dc0 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74  ISTINCT * FROM t
32dd0 61 62 30 20 41 53 20 63 6f 72 30 20 57 48 45 52  ab0 AS cor0 WHER
32de0 45 20 4e 55 4c 4c 20 3e 3d 20 2b 20 63 6f 6c 32  E NULL >= + col2
32df0 20 2f 20 63 6f 6c 32 0d 0a 2d 2d 2d 2d 0d 0a 0d   / col2..----...
32e00 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
32e10 0d 0a 53 45 4c 45 43 54 20 2d 20 33 38 20 2b 20  ..SELECT - 38 + 
32e20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2b 20  col2 * col0 * + 
32e30 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
32e40 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32e50 2d 2d 2d 2d 0d 0a 31 31 34 30 33 38 0d 0a 35 30  ----..114038..50
32e60 36 35 0d 0a 35 32 36 39 30 0d 0a 0d 0a 73 6b 69  65..52690....ski
32e70 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
32e80 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
32e90 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
32ea0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
32eb0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
32ec0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32ed0 53 54 49 4e 43 54 20 32 33 20 2b 20 63 6f 6c 31  STINCT 23 + col1
32ee0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
32ef0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a  cor0..----..33..
32f00 33 36 0d 0a 34 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  36..49....onlyif
32f10 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
32f20 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
32f30 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
32f40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
32f50 6c 61 62 65 6c 2d 31 34 33 31 0d 0a 53 45 4c 45  label-1431..SELE
32f60 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20  CT ALL - + col0 
32f70 44 49 56 20 33 34 20 63 6f 6c 32 20 46 52 4f 4d  DIV 34 col2 FROM
32f80 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
32f90 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a  ---..-1..-2..0..
32fa0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
32fb0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
32fc0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
32fd0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
32fe0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
32ff0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
33000 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
33010 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33020 31 34 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1431..SELECT ALL
33030 20 2d 20 2b 20 63 6f 6c 30 20 2f 20 33 34 20 63   - + col0 / 34 c
33040 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
33050 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
33060 0a 2d 32 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  .-2..0....query 
33070 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33080 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  T - col1 * col0 
33090 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  - col1 AS col1 F
330a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
330b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 0d 0a 2d 31  ..----..-104..-1
330c0 30 35 33 0d 0a 2d 36 35 30 0d 0a 0d 0a 71 75 65  053..-650....que
330d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
330e0 4c 45 43 54 20 41 4c 4c 20 31 34 20 41 53 20 63  LECT ALL 14 AS c
330f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
33100 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
33110 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
33120 69 6e 67 20 74 6f 20 38 33 65 35 37 37 39 64 32  ing to 83e5779d2
33130 34 38 37 64 31 32 34 39 35 65 37 64 38 31 36 63  487d12495e7d816c
33140 37 39 37 32 36 34 66 0d 0a 0d 0a 6f 6e 6c 79 69  797264f....onlyi
33150 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
33160 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
33170 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
33180 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
33190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
331a0 62 65 6c 2d 31 34 33 34 0d 0a 53 45 4c 45 43 54  bel-1434..SELECT
331b0 20 41 4c 4c 20 43 41 53 54 28 20 2b 20 63 6f 6c   ALL CAST( + col
331c0 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  1 AS SIGNED ) * 
331d0 63 6f 6c 31 20 2a 20 74 61 62 32 2e 63 6f 6c 30  col1 * tab2.col0
331e0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
331f0 0d 0a 32 32 38 33 31 0d 0a 32 37 31 35 31 38 0d  ..22831..271518.
33200 0a 36 37 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  .6727....skipif 
33210 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
33220 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
33230 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
33240 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43  34..SELECT ALL C
33250 41 53 54 20 28 20 2b 20 63 6f 6c 31 20 41 53 20  AST ( + col1 AS 
33260 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 31  INTEGER ) * col1
33270 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 46 52 4f   * tab2.col0 FRO
33280 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32  M tab2..----..22
33290 38 33 31 0d 0a 32 37 31 35 31 38 0d 0a 36 37 32  831..271518..672
332a0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
332b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
332c0 30 20 2a 20 2b 20 74 61 62 32 2e 63 6f 6c 30 20  0 * + tab2.col0 
332d0 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  * col1 AS col0 F
332e0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
332f0 31 30 36 30 39 37 0d 0a 31 35 31 39 0d 0a 33 35  106097..1519..35
33300 38 39 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8956....query I 
33310 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33320 2b 20 30 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f  + 0 - + col1 FRO
33330 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
33340 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 33 0d 0a  ----..-10..-13..
33350 2d 32 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -26....onlyif my
33360 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
33370 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
33380 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
33390 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
333a0 65 6c 2d 31 34 33 37 0d 0a 53 45 4c 45 43 54 20  el-1437..SELECT 
333b0 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49  + - cor0.col2 DI
333c0 56 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  V col0 AS col2 F
333d0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
333e0 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a 0d  ---..-3..0..0...
333f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
33400 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
33410 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
33420 6c 61 62 65 6c 2d 31 34 33 37 0d 0a 53 45 4c 45  label-1437..SELE
33430 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  CT + - cor0.col2
33440 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   / col0 AS col2 
33450 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
33460 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 30 0d 0a 30 0d 0a  ----..-3..0..0..
33470 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
33480 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
33490 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
334a0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
334b0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
334c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
334d0 43 54 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20  CT ( + col2 ) * 
334e0 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  + col0 col1 FROM
334f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33500 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37  ---..35..7298..7
33510 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
33520 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
33530 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2b 20 63  ( - col0 ) * + c
33540 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  or0.col2 + + col
33550 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
33560 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 38 0d  or0..----..-158.
33570 0a 2d 31 39 36 39 0d 0a 2d 32 39 38 35 0d 0a 0d  .-1969..-2985...
33580 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33590 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 36 31 20  ..SELECT - - 61 
335a0 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  + + cor0.col0 AS
335b0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
335c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
335d0 35 30 0d 0a 38 35 0d 0a 39 36 0d 0a 0d 0a 6f 6e  50..85..96....on
335e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
335f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
33600 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
33610 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
33620 6f 72 74 20 6c 61 62 65 6c 2d 31 34 34 31 0d 0a  ort label-1441..
33630 53 45 4c 45 43 54 20 36 36 20 44 49 56 20 63 6f  SELECT 66 DIV co
33640 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 + col2 FROM t
33650 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
33660 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 36 0d 0a 0d  -..55..58..96...
33670 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
33680 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
33690 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
336a0 6c 61 62 65 6c 2d 31 34 34 31 0d 0a 53 45 4c 45  label-1441..SELE
336b0 43 54 20 36 36 20 2f 20 63 6f 6c 32 20 2b 20 63  CT 66 / col2 + c
336c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
336d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
336e0 0a 35 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .58..96....query
336f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33700 43 54 20 2d 20 2d 20 38 20 2b 20 63 6f 6c 31 20  CT - - 8 + col1 
33710 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
33720 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 32 31 0d  0..----..18..21.
33730 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .34....query I r
33740 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28  owsort..SELECT (
33750 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f   - col1 ) + - co
33760 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
33770 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  tab2..----..-118
33780 0d 0a 2d 33 34 0d 0a 2d 36 32 0d 0a 0d 0a 71 75  ..-34..-62....qu
33790 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
337a0 45 4c 45 43 54 20 2d 20 28 20 34 33 20 29 20 46  ELECT - ( 43 ) F
337b0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
337c0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
337d0 4e 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  N tab0..----..27
337e0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
337f0 74 6f 20 32 66 37 32 62 64 39 63 61 62 36 38 63  to 2f72bd9cab68c
33800 38 64 38 63 33 38 38 37 34 35 31 30 61 32 39 30  8d8c38874510a290
33810 61 33 63 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  a3c....query I r
33820 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
33830 49 53 54 49 4e 43 54 20 28 20 2b 20 74 61 62 31  ISTINCT ( + tab1
33840 2e 63 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31  .col2 ) + + col1
33850 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
33860 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  b1..----..109..6
33870 37 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  7..80....query I
33880 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33890 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 39 20   ALL col0 * - 9 
338a0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
338b0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
338c0 0a 2d 36 33 0d 0a 2d 37 30 32 0d 0a 2d 37 31 31  .-63..-702..-711
338d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
338e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
338f0 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41  .col1 + - col0 A
33900 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
33910 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33920 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a  -54..-67..23....
33930 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
33940 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
33950 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
33960 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
33970 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
33980 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
33990 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d   + col2 * col2 -
339a0 20 28 20 37 31 20 29 20 63 6f 6c 32 20 46 52 4f   ( 71 ) col2 FRO
339b0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  M tab0..----..-7
339c0 30 0d 0a 31 30 31 38 0d 0a 36 36 35 33 0d 0a 0d  0..1018..6653...
339d0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
339e0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
339f0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
33a00 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
33a10 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
33a20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33a30 54 20 2b 20 63 6f 6c 32 20 2b 20 38 36 20 63 6f  T + col2 + 86 co
33a40 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
33a50 2d 2d 0d 0a 31 31 39 0d 0a 31 36 38 0d 0a 38 37  --..119..168..87
33a60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33a70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
33a80 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20 39 30  INCT col0 + - 90
33a90 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
33aa0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d  b2..----..-11..-
33ab0 31 32 0d 0a 2d 38 33 0d 0a 0d 0a 6f 6e 6c 79 69  12..-83....onlyi
33ac0 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
33ad0 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
33ae0 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
33af0 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
33b00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
33b10 62 65 6c 2d 31 34 35 31 0d 0a 53 45 4c 45 43 54  bel-1451..SELECT
33b20 20 63 6f 6c 31 20 2b 20 43 41 53 54 28 20 4e 55   col1 + CAST( NU
33b30 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b  LL AS SIGNED ) +
33b40 20 2d 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f   - col0 col0 FRO
33b50 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
33b60 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
33b70 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
33b80 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
33b90 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
33ba0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
33bb0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69  t columns..skipi
33bc0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
33bd0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
33be0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
33bf0 31 34 35 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1451..SELECT col
33c00 31 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  1 + CAST ( NULL 
33c10 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20 2d  AS INTEGER ) + -
33c20 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
33c30 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  tab0..----..NULL
33c40 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
33c50 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
33c60 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
33c70 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
33c80 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
33c90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 32  wsort label-1452
33ca0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
33cb0 44 49 56 20 33 36 20 46 52 4f 4d 20 74 61 62 30  DIV 36 FROM tab0
33cc0 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 32 0d 0a 32 0d  ..----..2..2..2.
33cd0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
33ce0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
33cf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33d00 74 20 6c 61 62 65 6c 2d 31 34 35 32 0d 0a 53 45  t label-1452..SE
33d10 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2f 20 33 36  LECT + col1 / 36
33d20 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
33d30 0d 0a 32 0d 0a 32 0d 0a 32 0d 0a 0d 0a 71 75 65  ..2..2..2....que
33d40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
33d50 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a  LECT tab2.col2 *
33d60 20 2d 20 37 35 20 2b 20 63 6f 6c 32 20 2a 20 2b   - 75 + col2 * +
33d70 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 46   col2 - + col2 F
33d80 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
33d90 2d 31 33 30 30 0d 0a 2d 31 33 32 33 0d 0a 2d 31  -1300..-1323..-1
33da0 34 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  444....query I r
33db0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
33dc0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b  ISTINCT + col2 +
33dd0 20 63 6f 6c 30 20 2a 20 2d 20 28 20 2b 20 63 6f   col0 * - ( + co
33de0 6c 30 20 2b 20 32 35 20 29 20 41 53 20 63 6f 6c  l0 + 25 ) AS col
33df0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
33e00 2d 0d 0a 2d 31 39 37 0d 0a 2d 38 30 30 38 0d 0a  -..-197..-8008..
33e10 2d 38 31 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  -8178....skipif 
33e20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
33e30 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
33e40 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
33e50 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
33e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33e70 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
33e80 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32  CT col1 + - col2
33e90 20 2b 20 2b 20 28 20 2b 20 63 6f 6c 30 20 2a 20   + + ( + col0 * 
33ea0 2d 20 63 6f 6c 32 20 2b 20 37 30 20 29 20 63 6f  - col2 + 70 ) co
33eb0 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
33ec0 2d 2d 0d 0a 2d 36 36 39 0d 0a 2d 37 32 31 39 0d  --..-669..-7219.
33ed0 0a 31 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .131....query I 
33ee0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33ef0 2b 20 63 6f 6c 31 20 2b 20 39 35 20 2a 20 2d 20  + col1 + 95 * - 
33f00 28 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 29 20  ( col2 * col2 ) 
33f10 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
33f20 0a 2d 31 30 33 33 36 39 0d 0a 2d 36 33 38 36 38  .-103369..-63868
33f30 39 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  9..2....skipif p
33f40 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
33f50 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
33f60 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
33f70 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
33f80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33f90 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
33fa0 74 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 31 20 46  tab1.col2 col1 F
33fb0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
33fc0 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30 0d  162..3648..7680.
33fd0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
33fe0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
33ff0 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63  NCT - col1 + - c
34000 6f 6c 32 20 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c  ol2 * col1 * col
34010 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
34020 2d 0d 0a 2d 33 36 34 39 30 0d 0a 2d 34 32 33 38  -..-36490..-4238
34030 0d 0a 2d 39 39 38 35 33 0d 0a 0d 0a 71 75 65 72  ..-99853....quer
34040 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34050 45 43 54 20 2d 20 2d 20 35 20 2b 20 2d 20 39 35  ECT - - 5 + - 95
34060 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
34070 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 30 0d 0a 2d  r0..----..-90..-
34080 39 30 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79  90..-90....query
34090 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
340a0 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 72 31 2e  CT ALL + + cor1.
340b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
340c0 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
340d0 4e 20 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a  N tab0 AS cor1..
340e0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
340f0 61 73 68 69 6e 67 20 74 6f 20 35 38 35 61 34 31  ashing to 585a41
34100 61 35 32 63 30 63 36 63 30 64 36 39 37 62 35 64  a52c0c6c0d697b5d
34110 33 39 32 36 35 62 37 34 64 63 0d 0a 0d 0a 6f 6e  39265b74dc....on
34120 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
34130 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
34140 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
34150 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
34160 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 31 0d 0a  ort label-1461..
34170 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
34180 30 20 44 49 56 20 34 20 46 52 4f 4d 20 74 61 62  0 DIV 4 FROM tab
34190 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 39 0d 0a  2..----..1..19..
341a0 31 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  19....skipif mys
341b0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
341c0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
341d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 31 0d  sort label-1461.
341e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
341f0 6c 30 20 2f 20 34 20 46 52 4f 4d 20 74 61 62 32  l0 / 4 FROM tab2
34200 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 39 0d 0a 31  ..----..1..19..1
34210 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
34220 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
34230 6f 6c 31 20 2a 20 2d 20 30 20 41 53 20 63 6f 6c  ol1 * - 0 AS col
34240 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
34250 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
34260 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34270 45 4c 45 43 54 20 2b 20 31 35 20 41 53 20 63 6f  ELECT + 15 AS co
34280 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
34290 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
342a0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
342b0 6e 67 20 74 6f 20 64 31 64 32 38 30 64 33 38 62  ng to d1d280d38b
342c0 66 39 63 32 64 35 64 35 65 63 39 30 64 64 34 33  f9c2d5d5ec90dd43
342d0 61 65 61 66 66 64 0d 0a 0d 0a 71 75 65 72 79 20  aeaffd....query 
342e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
342f0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
34300 31 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 74 61 62  1 - col2 * + tab
34310 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  1.col2 AS col2 F
34320 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
34330 2d 32 39 34 32 0d 0a 2d 33 32 35 39 0d 0a 2d 39  -2942..-3259..-9
34340 32 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  229....skipif po
34350 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
34360 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
34370 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
34380 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
34390 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
343a0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
343b0 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 63   + + cor0.col1 c
343c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
343d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32   cor0..----..172
343e0 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71 75  ..182..194....qu
343f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34400 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
34410 20 33 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   32 AS col2 FROM
34420 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63   tab1, tab0 AS c
34430 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31 0d 0a  or0, tab1 cor1..
34440 2d 2d 2d 2d 0d 0a 33 32 0d 0a 0d 0a 71 75 65 72  ----..32....quer
34450 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34460 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37  ECT DISTINCT - 7
34470 38 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  8 * tab2.col2 * 
34480 38 36 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  86 AS col0 FROM 
34490 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 34  tab2..----..-174
344a0 34 30 38 0d 0a 2d 31 38 31 31 31 36 0d 0a 2d 32  408..-181116..-2
344b0 35 34 39 30 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  54904....onlyif 
344c0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
344d0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
344e0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
344f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
34500 61 62 65 6c 2d 31 34 36 38 0d 0a 53 45 4c 45 43  abel-1468..SELEC
34510 54 20 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c  T col0 DIV + col
34520 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 + col2 FROM ta
34530 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d  b0..----..1..33.
34540 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .82....skipif my
34550 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
34560 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
34570 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 38  wsort label-1468
34580 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20  ..SELECT col0 / 
34590 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52  + col1 + col2 FR
345a0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
345b0 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72  ..33..82....quer
345c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
345d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
345e0 6f 6c 32 20 2a 20 2d 20 34 35 20 2a 20 28 20 63  ol2 * - 45 * ( c
345f0 6f 6c 32 20 2a 20 63 6f 6c 31 20 29 20 46 52 4f  ol2 * col1 ) FRO
34600 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
34610 30 31 36 39 35 35 0d 0a 2d 31 31 30 34 36 36 30  016955..-1104660
34620 0d 0a 2d 31 37 39 34 37 38 30 0d 0a 0d 0a 71 75  ..-1794780....qu
34630 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34640 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b  ELECT - - col2 +
34650 20 36 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   60 AS col1 FROM
34660 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
34670 0d 0a 38 36 0d 0a 38 37 0d 0a 39 38 0d 0a 0d 0a  ..86..87..98....
34680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34690 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20  .SELECT ALL - + 
346a0 63 6f 6c 32 20 2b 20 28 20 2b 20 28 20 63 6f 6c  col2 + ( + ( col
346b0 30 20 29 20 2a 20 2d 20 63 6f 6c 30 20 29 20 46  0 ) * - col0 ) F
346c0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
346d0 2d 2d 2d 0d 0a 2d 34 31 35 33 0d 0a 2d 36 33 0d  ---..-4153..-63.
346e0 0a 2d 36 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20  .-6496....query 
346f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34700 54 20 2b 20 63 6f 6c 32 20 2b 20 37 38 20 2a 20  T + col2 + 78 * 
34710 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
34720 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
34730 2d 2d 2d 2d 0d 0a 31 31 31 30 0d 0a 32 30 38 32  ----..1110..2082
34740 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..837....query I
34750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
34760 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63   tab1.col1 * - c
34770 6f 6c 32 20 2a 20 36 31 20 46 52 4f 4d 20 74 61  ol2 * 61 FROM ta
34780 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 34 37 37 30  b1..----..-34770
34790 0d 0a 2d 37 36 31 32 38 0d 0a 2d 38 35 36 34 34  ..-76128..-85644
347a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
347b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
347c0 37 34 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  74 FROM tab2, ta
347d0 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b2 AS cor0, tab2
347e0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
347f0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
34800 67 20 74 6f 20 64 63 32 32 39 37 39 65 36 64 32  g to dc22979e6d2
34810 36 31 37 39 35 62 64 33 63 65 32 39 39 30 66 64  61795bd3ce2990fd
34820 62 62 66 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  bbf82....skipif 
34830 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
34840 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
34850 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
34860 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
34870 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34880 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32  t..SELECT - col2
34890 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   + + col1 * col0
348a0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
348b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
348c0 35 38 33 0d 0a 39 34 34 0d 0a 0d 0a 71 75 65 72  583..944....quer
348d0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
348e0 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ECT + col2 * + c
348f0 6f 6c 31 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a  ol1 + ( col0 ) *
34900 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
34910 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 38 0d 0a  0..----..-1128..
34920 2d 34 35 39 0d 0a 32 32 36 32 0d 0a 0d 0a 73 6b  -459..2262....sk
34930 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
34940 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
34950 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
34960 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
34970 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
34980 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
34990 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 30 2e 63   col0 * - tab0.c
349a0 6f 6c 31 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  ol1 + tab0.col0 
349b0 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52  - + col1 col0 FR
349c0 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
349d0 30 30 32 0d 0a 33 33 33 33 0d 0a 38 30 39 37 0d  002..3333..8097.
349e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
349f0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
34a00 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 38 39 20  2 + - col0 * 89 
34a10 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
34a20 0a 2d 33 32 31 0d 0a 2d 35 37 35 33 0d 0a 2d 37  .-321..-5753..-7
34a30 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  216....query I r
34a40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
34a50 4c 4c 20 34 33 20 2b 20 74 61 62 30 2e 63 6f 6c  LL 43 + tab0.col
34a60 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  2 * col2 + col1 
34a70 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
34a80 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 32 0d  b0..----..-1332.
34a90 0a 2d 33 33 35 31 0d 0a 2d 39 33 32 0d 0a 0d 0a  .-3351..-932....
34aa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34ab0 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b  .SELECT col0 + +
34ac0 20 39 38 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f   98 * - col0 FRO
34ad0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
34ae0 2d 0d 0a 2d 32 33 32 38 0d 0a 2d 33 33 39 35 0d  -..-2328..-3395.
34af0 0a 2d 38 36 33 33 0d 0a 0d 0a 71 75 65 72 79 20  .-8633....query 
34b00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34b10 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 38 30 20  T - - col2 + 80 
34b20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
34b30 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
34b40 0a 31 33 34 0d 0a 31 33 37 0d 0a 31 37 36 0d 0a  .134..137..176..
34b50 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34b60 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34b70 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 28 20  CT + col2 * - ( 
34b80 36 20 29 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2d  6 ) + + col1 * -
34b90 20 28 20 2d 20 63 6f 6c 31 20 29 20 46 52 4f 4d   ( - col1 ) FROM
34ba0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 37 31 39   tab0..----..719
34bb0 38 0d 0a 37 37 38 39 0d 0a 39 34 30 33 0d 0a 0d  8..7789..9403...
34bc0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
34bd0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
34be0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
34bf0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
34c00 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
34c10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34c20 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c  T + - col2 + col
34c30 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  1 col0 FROM tab0
34c40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   cor0..----..53.
34c50 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  .9..96....query 
34c60 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34c70 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 28 20 28  T + - col1 * ( (
34c80 20 63 6f 6c 32 20 29 20 29 20 41 53 20 63 6f 6c   col2 ) ) AS col
34c90 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
34ca0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34  or0..----..-1534
34cb0 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a  ..-646..-837....
34cc0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
34cd0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
34ce0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
34cf0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
34d00 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38 35  wsort label-1485
34d10 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
34d20 6f 72 30 2e 63 6f 6c 30 20 44 49 56 20 2d 20 37  or0.col0 DIV - 7
34d30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
34d40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31  r0..----..-1..-1
34d50 31 0d 0a 2d 31 31 0d 0a 0d 0a 73 6b 69 70 69 66  1..-11....skipif
34d60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
34d70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
34d80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
34d90 34 38 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  485..SELECT ALL 
34da0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2f 20 2d 20  + cor0.col0 / - 
34db0 37 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  7 FROM tab2 AS c
34dc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
34dd0 31 31 0d 0a 2d 31 31 0d 0a 0d 0a 71 75 65 72 79  11..-11....query
34de0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34df0 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30  CT col2 * - col0
34e00 20 2b 20 2b 20 39 35 20 46 52 4f 4d 20 74 61 62   + + 95 FROM tab
34e10 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
34e20 0a 2d 36 39 37 0d 0a 2d 37 32 30 33 0d 0a 36 30  .-697..-7203..60
34e30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
34e40 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
34e50 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
34e60 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
34e70 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
34e80 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 38  owsort label-148
34e90 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  7..SELECT ALL - 
34ea0 63 6f 6c 30 20 2a 20 2b 20 43 41 53 54 28 20 4e  col0 * + CAST( N
34eb0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
34ec0 2a 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29 20 2d  * - ( + col1 ) -
34ed0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
34ee0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
34ef0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
34f00 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
34f10 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
34f20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34f30 74 20 6c 61 62 65 6c 2d 31 34 38 37 0d 0a 53 45  t label-1487..SE
34f40 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
34f50 2a 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * + CAST ( NULL 
34f60 41 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d  AS INTEGER ) * -
34f70 20 28 20 2b 20 63 6f 6c 31 20 29 20 2d 20 63 6f   ( + col1 ) - co
34f80 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
34f90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
34fa0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
34fb0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34fc0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
34fd0 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30   + col1 + + cor0
34fe0 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 46  .col1 * - col2 F
34ff0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35000 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 35 32 0d 0a 2d  ..----..-2752..-
35010 37 33 37 31 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  7371..0....skipi
35020 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
35030 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
35040 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
35050 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
35060 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
35070 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
35080 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63   + + cor0.col0 c
35090 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
350a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d   cor0..----..29.
350b0 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 71 75 65 72 79  .74..93....query
350c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
350d0 43 54 20 32 38 20 2a 20 2b 20 63 6f 6c 32 20 46  CT 28 * + col2 F
350e0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
350f0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 34 0d 0a 37 32  ..----..1064..72
35100 38 0d 0a 37 35 36 0d 0a 0d 0a 71 75 65 72 79 20  8..756....query 
35110 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35120 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72  T DISTINCT - cor
35130 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
35140 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
35150 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d   tab0 cor1..----
35160 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d  ..-54..-57..-96.
35170 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
35180 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 39 20  rt..SELECT - 19 
35190 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
351a0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
351b0 0d 0a 2d 31 30 35 0d 0a 2d 31 31 30 0d 0a 2d 31  ..-105..-110..-1
351c0 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
351d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
351e0 28 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 6c  ( col1 ) + - col
351f0 32 20 2a 20 32 35 20 46 52 4f 4d 20 74 61 62 30  2 * 25 FROM tab0
35200 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
35210 32 0d 0a 2d 32 31 34 31 0d 0a 2d 39 31 31 0d 0a  2..-2141..-911..
35220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35230 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
35240 43 54 20 39 34 20 2a 20 63 6f 6c 32 20 41 53 20  CT 94 * col2 AS 
35250 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
35260 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34  S cor0..----..24
35270 34 34 0d 0a 32 35 33 38 0d 0a 33 35 37 32 0d 0a  44..2538..3572..
35280 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
35290 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
352a0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
352b0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
352c0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
352d0 39 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  95..SELECT + + c
352e0 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b  ol2 DIV - col0 +
352f0 20 2d 20 34 33 20 46 52 4f 4d 20 74 61 62 30 20   - 43 FROM tab0 
35300 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
35310 34 33 0d 0a 2d 34 33 0d 0a 2d 34 34 0d 0a 0d 0a  43..-43..-44....
35320 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35330 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
35340 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35350 61 62 65 6c 2d 31 34 39 35 0d 0a 53 45 4c 45 43  abel-1495..SELEC
35360 54 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63  T + + col2 / - c
35370 6f 6c 30 20 2b 20 2d 20 34 33 20 46 52 4f 4d 20  ol0 + - 43 FROM 
35380 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
35390 2d 2d 0d 0a 2d 34 33 0d 0a 2d 34 33 0d 0a 2d 34  --..-43..-43..-4
353a0 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  4....onlyif mysq
353b0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
353c0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
353d0 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
353e0 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
353f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
35400 39 36 0d 0a 53 45 4c 45 43 54 20 2b 20 37 32 20  96..SELECT + 72 
35410 2a 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 43 41 53  * + col2 + + CAS
35420 54 28 20 35 37 20 41 53 20 53 49 47 4e 45 44 20  T( 57 AS SIGNED 
35430 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
35440 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 39 34 35 0d  or0..----..3945.
35450 0a 34 31 36 31 0d 0a 36 39 36 39 0d 0a 0d 0a 73  .4161..6969....s
35460 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
35470 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
35480 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
35490 62 65 6c 2d 31 34 39 36 0d 0a 53 45 4c 45 43 54  bel-1496..SELECT
354a0 20 2b 20 37 32 20 2a 20 2b 20 63 6f 6c 32 20 2b   + 72 * + col2 +
354b0 20 2b 20 43 41 53 54 20 28 20 35 37 20 41 53 20   + CAST ( 57 AS 
354c0 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74  INTEGER ) FROM t
354d0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
354e0 2d 0d 0a 33 39 34 35 0d 0a 34 31 36 31 0d 0a 36  -..3945..4161..6
354f0 39 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  969....query I r
35500 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
35510 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
35520 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
35530 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31  b2 AS cor0, tab1
35540 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
35550 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
35560 67 20 74 6f 20 66 39 64 34 62 62 38 36 37 37 64  g to f9d4bb8677d
35570 62 37 62 39 38 63 37 65 64 38 39 64 30 36 65 36  b7b98c7ed89d06e6
35580 65 38 63 64 36 0d 0a 0d 0a 71 75 65 72 79 20 49  e8cd6....query I
35590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
355a0 20 44 49 53 54 49 4e 43 54 20 2d 20 33 31 20 2a   DISTINCT - 31 *
355b0 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
355c0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
355d0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 35 0d 0a  0..----..-1085..
355e0 2d 32 37 35 39 0d 0a 2d 37 34 34 0d 0a 0d 0a 71  -2759..-744....q
355f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35600 53 45 4c 45 43 54 20 2d 20 31 20 2a 20 63 6f 6c  SELECT - 1 * col
35610 31 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  1 - col2 * col2 
35620 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
35630 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
35640 0a 2d 32 39 34 32 0d 0a 2d 33 32 35 39 0d 0a 2d  .-2942..-3259..-
35650 39 32 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9229....query I 
35660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35670 44 49 53 54 49 4e 43 54 20 2b 20 39 35 20 41 53  DISTINCT + 95 AS
35680 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
35690 0a 2d 2d 2d 2d 0d 0a 39 35 0d 0a 0d 0a 71 75 65  .----..95....que
356a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
356b0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 30  LECT DISTINCT 40
356c0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
356d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 0d   cor0..----..40.
356e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
356f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
35700 20 63 6f 72 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor1.col0 FROM 
35710 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
35720 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
35730 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
35740 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
35750 38 62 34 39 37 39 39 39 34 32 61 39 65 33 35 33  8b49799942a9e353
35760 61 33 64 32 37 39 63 66 36 34 65 66 33 66 36 33  a3d279cf64ef3f63
35770 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35780 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
35790 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  col0 + + col1 * 
357a0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
357b0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
357c0 2d 2d 2d 2d 0d 0a 37 33 37 32 0d 0a 38 31 39 32  ----..7372..8192
357d0 0d 0a 39 33 37 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..9374....onlyif
357e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
357f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
35800 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
35810 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35820 6c 61 62 65 6c 2d 31 35 30 34 0d 0a 53 45 4c 45  label-1504..SELE
35830 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
35840 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 44 49 56 20  col2 + col1 DIV 
35850 2d 20 28 20 35 33 20 29 20 46 52 4f 4d 20 74 61  - ( 53 ) FROM ta
35860 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
35870 0d 0a 32 35 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a  ..25..27..38....
35880 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
35890 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
358a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
358b0 61 62 65 6c 2d 31 35 30 34 0d 0a 53 45 4c 45 43  abel-1504..SELEC
358c0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
358d0 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 2d 20 28  ol2 + col1 / - (
358e0 20 35 33 20 29 20 46 52 4f 4d 20 74 61 62 32 20   53 ) FROM tab2 
358f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
35900 35 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75 65  5..27..38....que
35910 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35920 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 31 31  LECT DISTINCT 11
35930 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30   * + col0 + col0
35940 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
35950 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
35960 0d 0a 33 36 0d 0a 37 36 38 0d 0a 39 36 30 0d 0a  ..36..768..960..
35970 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35980 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
35990 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 32   * + col2 - col2
359a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
359b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 35 34 0d  r0..----..-2054.
359c0 0a 2d 32 31 36 0d 0a 2d 33 30 34 30 0d 0a 0d 0a  .-216..-3040....
359d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
359e0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
359f0 63 6f 6c 30 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  col0 * + cor0.co
35a00 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
35a10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34 33  cor0..----..1343
35a20 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a 0d 0a 71  ..217..4602....q
35a30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35a40 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35a50 2b 20 34 35 20 41 53 20 63 6f 6c 32 20 46 52 4f  + 45 AS col2 FRO
35a60 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35a70 2d 2d 2d 2d 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72  ----..45....quer
35a80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35a90 45 43 54 20 2d 20 38 36 20 2d 20 2b 20 63 6f 6c  ECT - 86 - + col
35aa0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
35ab0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 0d  or0..----..-112.
35ac0 0a 2d 39 36 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65  .-96..-99....que
35ad0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35ae0 4c 45 43 54 20 2d 20 33 34 20 2b 20 2b 20 63 6f  LECT - 34 + + co
35af0 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  l1 * cor0.col1 *
35b00 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
35b10 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
35b20 0a 2d 2d 2d 2d 0d 0a 31 37 37 34 37 30 0d 0a 33  .----..177470..3
35b30 32 39 32 38 31 0d 0a 37 33 36 39 37 35 0d 0a 0d  29281..736975...
35b40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35b50 0d 0a 53 45 4c 45 43 54 20 2b 20 31 35 20 2a 20  ..SELECT + 15 * 
35b60 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
35b70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
35b80 2d 2d 2d 2d 0d 0a 32 35 35 0d 0a 34 36 35 0d 0a  ----..255..465..
35b90 38 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  885....query I r
35ba0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35bb0 4c 4c 20 2d 20 28 20 2d 20 63 6f 6c 32 20 29 20  LL - ( - col2 ) 
35bc0 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
35bd0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
35be0 0d 0a 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a  ..-53..-9..-96..
35bf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35c00 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  t..SELECT + + co
35c10 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41  l1 + cor0.col0 A
35c20 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
35c30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
35c40 31 33 37 0d 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 73  137..38..96....s
35c50 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
35c60 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
35c70 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
35c80 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
35c90 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
35ca0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35cb0 44 49 53 54 49 4e 43 54 20 2d 20 36 20 2b 20 2b  DISTINCT - 6 + +
35cc0 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 63   col0 * + col0 c
35cd0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
35ce0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a   cor0..----..3..
35cf0 34 30 39 30 0d 0a 36 33 39 34 0d 0a 0d 0a 71 75  4090..6394....qu
35d00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
35d10 45 4c 45 43 54 20 2d 20 2b 20 35 35 20 2d 20 63  ELECT - + 55 - c
35d20 6f 6c 30 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 31  ol0 * - ( - col1
35d30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
35d40 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
35d50 2d 2d 0d 0a 2d 31 33 39 38 0d 0a 2d 32 37 32 0d  --..-1398..-272.
35d60 0a 2d 34 36 35 37 0d 0a 0d 0a 71 75 65 72 79 20  .-4657....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 2b 20 63 6f 6c  T DISTINCT + col
35d90 32 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 33 34 20  2 * - col1 + 34 
35da0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
35db0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
35dc0 0a 2d 31 32 31 34 0d 0a 2d 31 33 37 30 0d 0a 2d  .-1214..-1370..-
35dd0 35 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  536....query I r
35de0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
35df0 4c 4c 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 63  LL tab2.col2 * c
35e00 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f  ol0 - + col2 FRO
35e10 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36  M tab2..----..16
35e20 32 0d 0a 32 30 30 32 0d 0a 32 39 36 34 0d 0a 0d  2..2002..2964...
35e30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35e40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
35e50 31 20 2b 20 2d 20 38 38 20 41 53 20 63 6f 6c 31  1 + - 88 AS col1
35e60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
35e70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 33 0d  r0..----..-2..3.
35e80 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
35e90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
35ea0 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2b 20  - cor0.col2 - + 
35eb0 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
35ec0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
35ed0 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37 36  ----..-121..-176
35ee0 0d 0a 2d 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-57....onlyif 
35ef0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
35f00 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
35f10 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
35f20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
35f30 61 62 65 6c 2d 31 35 32 30 0d 0a 53 45 4c 45 43  abel-1520..SELEC
35f40 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e  T DISTINCT tab0.
35f50 63 6f 6c 32 20 2a 20 74 61 62 30 2e 63 6f 6c 30  col2 * tab0.col0
35f60 20 2b 20 63 6f 6c 30 20 44 49 56 20 2d 20 28 20   + col0 DIV - ( 
35f70 63 6f 6c 32 20 2b 20 2d 20 38 36 20 29 20 41 53  col2 + - 86 ) AS
35f80 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
35f90 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 33 32 30 0d  .----..35..7320.
35fa0 0a 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .792....skipif m
35fb0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
35fc0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
35fd0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32  owsort label-152
35fe0 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  0..SELECT DISTIN
35ff0 43 54 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 74  CT tab0.col2 * t
36000 61 62 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30 20  ab0.col0 + col0 
36010 2f 20 2d 20 28 20 63 6f 6c 32 20 2b 20 2d 20 38  / - ( col2 + - 8
36020 36 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  6 ) AS col0 FROM
36030 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d   tab0..----..35.
36040 0a 37 33 32 30 0d 0a 37 39 32 0d 0a 0d 0a 73 6b  .7320..792....sk
36050 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
36060 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
36070 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
36080 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
36090 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
360a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
360b0 4c 4c 20 2d 20 37 37 20 63 6f 6c 30 20 46 52 4f  LL - 77 col0 FRO
360c0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
360d0 2d 2d 2d 2d 0d 0a 2d 37 37 0d 0a 2d 37 37 0d 0a  ----..-77..-77..
360e0 2d 37 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  -77....skipif po
360f0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
36100 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
36110 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
36120 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
36130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36140 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36150 20 2d 20 2d 20 31 33 20 2b 20 63 6f 6c 32 20 63   - - 13 + col2 c
36160 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
36170 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  r0..----..109..6
36180 37 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  7..70....onlyif 
36190 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
361a0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
361b0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
361c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
361d0 61 62 65 6c 2d 31 35 32 33 0d 0a 53 45 4c 45 43  abel-1523..SELEC
361e0 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 30 20 29  T ALL - ( col0 )
361f0 20 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 39 33   + col2 DIV - 93
36200 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36210 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36220 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a  ..-7..-78..-79..
36230 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
36240 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
36250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36260 20 6c 61 62 65 6c 2d 31 35 32 33 0d 0a 53 45 4c   label-1523..SEL
36270 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 30  ECT ALL - ( col0
36280 20 29 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 39 33   ) + col2 / - 93
36290 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
362a0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
362b0 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a  ..-7..-78..-79..
362c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
362d0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
362e0 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 34 38  CT + col0 * - 48
362f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
36300 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
36310 33 33 36 0d 0a 2d 33 37 34 34 0d 0a 2d 33 37 39  336..-3744..-379
36320 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
36330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36340 20 2b 20 2b 20 38 37 20 41 53 20 63 6f 6c 30 20   + + 87 AS col0 
36350 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
36360 30 0d 0a 2d 2d 2d 2d 0d 0a 38 37 0d 0a 38 37 0d  0..----..87..87.
36370 0a 38 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .87....onlyif my
36380 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
36390 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
363a0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
363b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
363c0 65 6c 2d 31 35 32 36 0d 0a 53 45 4c 45 43 54 20  el-1526..SELECT 
363d0 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 44 49  col1 - + col0 DI
363e0 56 20 74 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 30  V tab1.col2 col0
363f0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
36400 0d 0a 31 33 0d 0a 32 36 0d 0a 39 0d 0a 0d 0a 73  ..13..26..9....s
36410 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
36420 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
36430 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
36440 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
36450 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
36460 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36470 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36480 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 32  owsort label-152
36490 36 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2d  6..SELECT col1 -
364a0 20 2b 20 63 6f 6c 30 20 2f 20 74 61 62 31 2e 63   + col0 / tab1.c
364b0 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol2 col0 FROM ta
364c0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 36  b1..----..13..26
364d0 0d 0a 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..9....skipif po
364e0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
364f0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
36500 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
36510 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
36520 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36530 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
36540 39 38 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74  98 ) col1 FROM t
36550 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 38 0d 0a  ab2..----..-98..
36560 2d 39 38 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72  -98..-98....quer
36570 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36580 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b  ECT ALL col1 * +
36590 20 34 33 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   43 FROM tab2..-
365a0 2d 2d 2d 0d 0a 31 33 33 33 0d 0a 32 35 33 37 0d  ---..1333..2537.
365b0 0a 37 33 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .731....skipif p
365c0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
365d0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
365e0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
365f0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
36600 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36610 0d 0a 53 45 4c 45 43 54 20 2b 20 31 30 20 2a 20  ..SELECT + 10 * 
36620 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 2a 20  col2 - + col1 * 
36630 28 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29 20 29  ( + ( + col0 ) )
36640 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 31 20 46   * - col2 col1 F
36650 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
36660 31 30 30 38 30 30 0d 0a 33 37 30 35 30 0d 0a 34  100800..37050..4
36670 37 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  752....query I r
36680 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 37  owsort..SELECT 7
36690 37 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  7 * + col0 + - c
366a0 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
366b0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 31 32   tab2..----..512
366c0 0d 0a 35 39 38 30 0d 0a 36 30 34 35 0d 0a 0d 0a  ..5980..6045....
366d0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
366e0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
366f0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
36700 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
36710 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
36720 72 74 20 6c 61 62 65 6c 2d 31 35 33 31 0d 0a 53  rt label-1531..S
36730 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 2b 20  ELECT - CAST( + 
36740 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
36750 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36760 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36770 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a  ..-7..-78..-79..
36780 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
36790 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
367a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
367b0 20 6c 61 62 65 6c 2d 31 35 33 31 0d 0a 53 45 4c   label-1531..SEL
367c0 45 43 54 20 2d 20 43 41 53 54 20 28 20 2b 20 63  ECT - CAST ( + c
367d0 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
367e0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
367f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
36800 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a  ..-7..-78..-79..
36810 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36820 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
36830 6c 32 20 2a 20 2b 20 28 20 63 6f 6c 32 20 29 20  l2 * + ( col2 ) 
36840 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
36850 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a 36  0..----..1444..6
36860 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65 72 79  76..729....query
36870 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36880 43 54 20 2d 20 32 37 20 2b 20 63 6f 72 30 2e 63  CT - 27 + cor0.c
36890 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
368a0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
368b0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
368c0 69 6e 67 20 74 6f 20 34 30 39 36 38 31 62 65 31  ing to 409681be1
368d0 61 62 34 61 66 65 32 34 38 32 62 31 39 31 39 64  ab4afe2482b1919d
368e0 63 37 30 31 61 61 63 0d 0a 0d 0a 71 75 65 72 79  c701aac....query
368f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36900 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61  CT DISTINCT + ta
36910 62 32 2e 63 6f 6c 32 20 2a 20 2d 20 28 20 63 6f  b2.col2 * - ( co
36920 6c 31 20 2b 20 63 6f 6c 30 20 29 20 46 52 4f 4d  l1 + col0 ) FROM
36930 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab2..----..-10
36940 32 36 0d 0a 2d 33 35 36 32 0d 0a 2d 33 36 34 38  26..-3562..-3648
36950 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36960 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31 38  ort..SELECT - 18
36970 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
36980 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
36990 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
369a0 20 74 6f 20 30 39 61 66 61 66 65 63 36 35 37 61   to 09afafec657a
369b0 35 65 39 66 30 38 32 62 65 62 36 61 31 36 65 63  5e9f082beb6a16ec
369c0 38 35 64 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20  85de....query I 
369d0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
369e0 2b 20 63 6f 6c 30 20 2b 20 37 33 20 41 53 20 63  + col0 + 73 AS c
369f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
36a00 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 36 32 0d 0a 39  ---..108..162..9
36a10 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
36a20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
36a30 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63  TINCT col1 + - c
36a40 6f 6c 31 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol1 * + cor0.col
36a50 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
36a60 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 38  or0..----..-1978
36a70 0d 0a 2d 33 32 39 38 0d 0a 2d 38 30 30 38 0d 0a  ..-3298..-8008..
36a80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36a90 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
36aa0 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 46 52  + col0 + col1 FR
36ab0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
36ac0 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38  --..110..132..18
36ad0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
36ae0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
36af0 20 2d 20 63 6f 6c 31 20 2a 20 35 32 20 41 53 20   - col1 * 52 AS 
36b00 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
36b10 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
36b20 36 31 32 0d 0a 2d 33 30 36 38 0d 0a 2d 38 38 34  612..-3068..-884
36b30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36b40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
36b50 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  INCT - col2 * - 
36b60 35 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  52 FROM tab1 AS 
36b70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 30 38  cor0..----..2808
36b80 0d 0a 32 39 36 34 0d 0a 34 39 39 32 0d 0a 0d 0a  ..2964..4992....
36b90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
36ba0 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 32  .SELECT - - col2
36bb0 20 2a 20 39 34 20 2a 20 63 6f 6c 31 20 41 53 20   * 94 * col1 AS 
36bc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
36bd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
36be0 37 33 31 32 0d 0a 31 33 31 39 37 36 0d 0a 35 33  7312..131976..53
36bf0 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  580....query I r
36c00 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
36c10 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  LL - col1 * col2
36c20 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
36c30 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
36c40 32 38 33 38 0d 0a 2d 37 34 36 32 0d 0a 2d 39 37  2838..-7462..-97
36c50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
36c60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 30  ort..SELECT tab0
36c70 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
36c80 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
36c90 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72 31   cor0, tab1 cor1
36ca0 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
36cb0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 37 38  s hashing to 778
36cc0 36 37 31 38 62 64 38 30 34 32 30 32 32 35 33 37  6718bd8042022537
36cd0 33 37 38 64 34 30 65 63 38 37 34 37 35 0d 0a 0d  378d40ec87475...
36ce0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
36cf0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
36d00 31 20 2a 20 2d 20 37 20 46 52 4f 4d 20 74 61 62  1 * - 7 FROM tab
36d10 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  2 cor0..----..-1
36d20 31 39 0d 0a 2d 32 31 37 0d 0a 2d 34 31 33 0d 0a  19..-217..-413..
36d30 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36d40 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
36d50 63 6f 6c 31 20 2a 20 2b 20 28 20 2d 20 63 6f 72  col1 * + ( - cor
36d60 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32  0.col1 ) AS col2
36d70 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
36d80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a  r0..----..-289..
36d90 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 71  -3481..-961....q
36da0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36db0 53 45 4c 45 43 54 20 2d 20 2b 20 28 20 63 6f 6c  SELECT - + ( col
36dc0 30 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 28  0 ) * - col1 + (
36dd0 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 30   col1 ) * + col0
36de0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
36df0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 30 0d 0a  r0..----..1280..
36e00 31 35 36 0d 0a 32 30 38 30 0d 0a 0d 0a 71 75 65  156..2080....que
36e10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
36e20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
36e30 34 33 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  43 + col0 AS col
36e40 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
36e50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 0d 0a  or0..----..-40..
36e60 32 31 0d 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20  21..37....query 
36e70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36e80 54 20 2b 20 28 20 37 39 20 29 20 2b 20 2d 20 63  T + ( 79 ) + - c
36e90 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol2 AS col1 FROM
36ea0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
36eb0 2d 2d 2d 0d 0a 2d 33 0d 0a 34 36 0d 0a 37 38 0d  ---..-3..46..78.
36ec0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
36ed0 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
36ee0 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
36ef0 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
36f00 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
36f10 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34 39  wsort label-1549
36f20 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53  ..SELECT ALL CAS
36f30 54 28 20 2b 20 37 38 20 41 53 20 53 49 47 4e 45  T( + 78 AS SIGNE
36f40 44 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20  D ) * col1 FROM 
36f50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
36f60 2d 2d 0d 0a 36 37 30 38 0d 0a 37 30 39 38 0d 0a  --..6708..7098..
36f70 37 35 36 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  7566....skipif m
36f80 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
36f90 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
36fa0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 34  owsort label-154
36fb0 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 43 41  9..SELECT ALL CA
36fc0 53 54 20 28 20 2b 20 37 38 20 41 53 20 49 4e 54  ST ( + 78 AS INT
36fd0 45 47 45 52 20 29 20 2a 20 63 6f 6c 31 20 46 52  EGER ) * col1 FR
36fe0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
36ff0 0a 2d 2d 2d 2d 0d 0a 36 37 30 38 0d 0a 37 30 39  .----..6708..709
37000 38 0d 0a 37 35 36 36 0d 0a 0d 0a 71 75 65 72 79  8..7566....query
37010 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37020 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
37030 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  l2 * col1 + col0
37040 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
37050 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
37060 0a 31 34 31 33 0d 0a 34 36 36 36 0d 0a 37 36 34  .1413..4666..764
37070 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
37080 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 30  sort..SELECT + 0
37090 20 2b 20 2d 20 39 35 20 2a 20 63 6f 6c 30 20 41   + - 95 * col0 A
370a0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
370b0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
370c0 2d 32 32 38 30 0d 0a 2d 33 33 32 35 0d 0a 2d 38  -2280..-3325..-8
370d0 34 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  455....query I r
370e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
370f0 4c 4c 20 2d 20 28 20 2d 20 35 33 20 29 20 2b 20  LL - ( - 53 ) + 
37100 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  + col1 AS col2 F
37110 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
37120 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a 36 36 0d 0a  ..----..63..66..
37130 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
37140 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
37150 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2d 20  col1 + + col0 - 
37160 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
37170 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
37180 2d 34 30 0d 0a 2d 35 35 0d 0a 34 35 0d 0a 0d 0a  -40..-55..45....
37190 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
371a0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 33 20  .SELECT ALL - 3 
371b0 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  * col2 AS col1 F
371c0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
371d0 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 31 37 31 0d  ---..-162..-171.
371e0 0a 2d 32 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-288....query I
371f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37200 20 2b 20 38 37 20 2a 20 2b 20 63 6f 6c 30 20 46   + 87 * + col0 F
37210 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
37220 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 38 0d 0a 33 30  ..----..2088..30
37230 34 35 0d 0a 37 37 34 33 0d 0a 0d 0a 73 6b 69 70  45..7743....skip
37240 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
37250 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
37260 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
37270 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
37280 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
37290 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
372a0 32 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20  2.col1 * + col1 
372b0 2b 20 28 20 2d 20 37 31 20 29 20 2a 20 2b 20 74  + ( - 71 ) * + t
372c0 61 62 32 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52  ab2.col2 col1 FR
372d0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
372e0 32 34 30 39 0d 0a 2d 39 35 36 0d 0a 31 36 33 35  2409..-956..1635
372f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
37300 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
37310 49 4e 43 54 20 2d 20 2d 20 38 39 20 2b 20 63 6f  INCT - - 89 + co
37320 6c 31 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29 20  l1 * - ( col0 ) 
37330 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
37340 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37 35 0d 0a  0..----..-1975..
37350 2d 33 33 30 36 0d 0a 2d 38 30 31 30 0d 0a 0d 0a  -3306..-8010....
37360 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37370 0a 53 45 4c 45 43 54 20 38 38 20 2d 20 2b 20 63  .SELECT 88 - + c
37380 6f 72 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or1.col0 AS col2
37390 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
373a0 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41   AS cor0, tab1 A
373b0 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
373c0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
373d0 74 6f 20 63 37 62 35 66 63 61 31 34 34 64 31 63  to c7b5fca144d1c
373e0 37 31 37 35 64 39 30 61 61 62 61 31 31 37 66 61  7175d90aaba117fa
373f0 32 62 64 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  2bd....skipif po
37400 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
37410 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
37420 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
37430 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
37440 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37450 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31  .SELECT ALL col1
37460 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a   - col2 * col2 *
37470 20 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f   - col0 col1 FRO
37480 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab2..----..11
37490 34 30 39 33 0d 0a 35 31 33 34 0d 0a 35 32 37 38  4093..5134..5278
374a0 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  7....onlyif mysq
374b0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
374c0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
374d0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
374e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
374f0 2d 31 35 36 30 0d 0a 53 45 4c 45 43 54 20 28 20  -1560..SELECT ( 
37500 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 44 49  - cor0.col2 ) DI
37510 56 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  V - col1 AS col1
37520 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
37530 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 32 0d 0a  .----..0..0..2..
37540 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
37550 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
37560 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37570 20 6c 61 62 65 6c 2d 31 35 36 30 0d 0a 53 45 4c   label-1560..SEL
37580 45 43 54 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  ECT ( - cor0.col
37590 32 20 29 20 2f 20 2d 20 63 6f 6c 31 20 41 53 20  2 ) / - col1 AS 
375a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63  col1 FROM tab2 c
375b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
375c0 0a 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .2....query I ro
375d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
375e0 53 54 49 4e 43 54 20 2b 20 31 30 20 2b 20 2d 20  STINCT + 10 + - 
375f0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
37600 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37610 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 31 37 0d 0a  ----..-16..-17..
37620 2d 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -28....query I r
37630 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
37640 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2b  ISTINCT - col0 +
37650 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   - cor0.col1 * -
37660 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
37670 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
37680 37 36 0d 0a 37 35 0d 0a 39 36 30 0d 0a 0d 0a 6f  76..75..960....o
37690 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
376a0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
376b0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
376c0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
376d0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36 33 0d  sort label-1563.
376e0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31  .SELECT + + col1
376f0 20 44 49 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 30   DIV + cor0.col0
37700 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
37710 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
37720 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 73 6b 69  ..0..0..4....ski
37730 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
37740 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
37750 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
37760 6c 2d 31 35 36 33 0d 0a 53 45 4c 45 43 54 20 2b  l-1563..SELECT +
37770 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 72 30   + col1 / + cor0
37780 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
37790 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
377a0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a  .----..0..0..4..
377b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
377c0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  t..SELECT - col0
377d0 20 2a 20 33 31 20 2a 20 2b 20 63 6f 72 30 2e 63   * 31 * + cor0.c
377e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
377f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
37800 33 30 38 38 0d 0a 2d 32 33 38 30 38 30 0d 0a 2d  3088..-238080..-
37810 35 30 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5022....query I 
37820 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
37830 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
37840 2d 20 63 6f 6c 30 20 2a 20 2b 20 36 35 20 46 52  - col0 * + 65 FR
37850 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
37860 2d 2d 0d 0a 2d 31 36 39 0d 0a 2d 34 31 35 30 0d  --..-169..-4150.
37870 0a 2d 35 31 38 37 0d 0a 0d 0a 71 75 65 72 79 20  .-5187....query 
37880 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37890 54 20 34 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  T 41 AS col0 FRO
378a0 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74 61  M tab0, tab2, ta
378b0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
378c0 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
378d0 69 6e 67 20 74 6f 20 66 36 61 34 34 30 62 34 37  ing to f6a440b47
378e0 38 66 30 64 30 30 66 38 33 32 36 61 38 63 35 31  8f0d00f8326a8c51
378f0 66 65 30 39 34 62 38 0d 0a 0d 0a 71 75 65 72 79  fe094b8....query
37900 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37910 43 54 20 2d 20 36 39 20 46 52 4f 4d 20 74 61 62  CT - 69 FROM tab
37920 31 2c 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  1, tab2, tab0 AS
37930 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
37940 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
37950 6f 20 63 61 35 66 34 62 63 33 36 35 64 63 32 63  o ca5f4bc365dc2c
37960 36 62 31 34 31 38 37 64 36 66 66 63 38 33 61 30  6b14187d6ffc83a0
37970 31 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  1d....query I ro
37980 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 38  wsort..SELECT 38
37990 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
379a0 62 31 2c 20 74 61 62 32 20 63 6f 72 30 2c 20 74  b1, tab2 cor0, t
379b0 61 62 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor1..----..
379c0 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
379d0 67 20 74 6f 20 61 37 38 32 37 61 37 39 32 34 38  g to a7827a79248
379e0 65 65 37 62 66 32 63 65 65 39 31 35 61 36 33 31  ee7bf2cee915a631
379f0 64 30 32 63 62 0d 0a 0d 0a 71 75 65 72 79 20 49  d02cb....query I
37a00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37a10 20 2d 20 33 35 20 46 52 4f 4d 20 74 61 62 31 2c   - 35 FROM tab1,
37a20 20 74 61 62 32 20 63 6f 72 30 2c 20 74 61 62 31   tab2 cor0, tab1
37a30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
37a40 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
37a50 6f 20 36 64 39 36 37 62 33 62 61 63 32 65 30 31  o 6d967b3bac2e01
37a60 61 30 33 31 38 38 36 35 66 36 38 32 66 39 61 39  a0318865f682f9a9
37a70 37 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  7b....query I ro
37a80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
37a90 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20  col2 * col2 * - 
37aa0 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
37ab0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
37ac0 2d 2d 2d 2d 0d 0a 2d 31 31 34 30 37 36 0d 0a 2d  ----..-114076..-
37ad0 35 31 30 33 0d 0a 2d 35 32 37 32 38 0d 0a 0d 0a  5103..-52728....
37ae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37af0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b  .SELECT + col1 +
37b00 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2d 20   - col1 * - ( - 
37b10 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
37b20 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
37b30 2d 31 39 37 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38  -1978..-3298..-8
37b40 30 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  008....onlyif my
37b50 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
37b60 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
37b70 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
37b80 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
37b90 65 6c 2d 31 35 37 32 0d 0a 53 45 4c 45 43 54 20  el-1572..SELECT 
37ba0 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49  DISTINCT col2 DI
37bb0 56 20 2b 20 43 41 53 54 28 20 2d 20 63 6f 6c 31  V + CAST( - col1
37bc0 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
37bd0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
37be0 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37  ----..-2..-5..-7
37bf0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
37c00 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
37c10 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
37c20 72 74 20 6c 61 62 65 6c 2d 31 35 37 32 0d 0a 53  rt label-1572..S
37c30 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
37c40 6f 6c 32 20 2f 20 2b 20 43 41 53 54 20 28 20 2d  ol2 / + CAST ( -
37c50 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
37c60 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
37c70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  tab1..----..-2..
37c80 2d 35 0d 0a 2d 37 0d 0a 0d 0a 71 75 65 72 79 20  -5..-7....query 
37c90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37ca0 54 20 41 4c 4c 20 2b 20 39 30 20 2a 20 2d 20 32  T ALL + 90 * - 2
37cb0 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  3 AS col1 FROM t
37cc0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
37cd0 2d 0d 0a 2d 32 30 37 30 0d 0a 2d 32 30 37 30 0d  -..-2070..-2070.
37ce0 0a 2d 32 30 37 30 0d 0a 0d 0a 71 75 65 72 79 20  .-2070....query 
37cf0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37d00 54 20 2b 20 33 34 20 41 53 20 63 6f 6c 31 20 46  T + 34 AS col1 F
37d10 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
37d20 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
37d30 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
37d40 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
37d50 20 34 65 32 63 61 31 34 37 61 35 39 65 30 64 35   4e2ca147a59e0d5
37d60 36 36 31 63 32 38 63 66 33 65 35 34 33 31 63 61  661c28cf3e5431ca
37d70 61 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  a....skipif post
37d80 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
37d90 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
37da0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
37db0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
37dc0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
37dd0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 31  ELECT ALL + tab1
37de0 2e 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20  .col0 col2 FROM 
37df0 74 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f  tab1, tab0 AS co
37e00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
37e10 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 64  es hashing to dd
37e20 31 38 62 39 33 32 36 33 61 36 63 64 34 32 35 66  18b93263a6cd425f
37e30 63 37 63 63 38 34 64 39 31 33 37 38 37 30 0d 0a  c7cc84d9137870..
37e40 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
37e50 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
37e60 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
37e70 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
37e80 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
37e90 37 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  76..SELECT DISTI
37ea0 4e 43 54 20 2d 20 28 20 63 6f 6c 32 20 29 20 44  NCT - ( col2 ) D
37eb0 49 56 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32  IV col0 + - col2
37ec0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
37ed0 0d 0a 2d 35 37 0d 0a 2d 37 32 0d 0a 2d 39 37 0d  ..-57..-72..-97.
37ee0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
37ef0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
37f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37f10 74 20 6c 61 62 65 6c 2d 31 35 37 36 0d 0a 53 45  t label-1576..SE
37f20 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
37f30 28 20 63 6f 6c 32 20 29 20 2f 20 63 6f 6c 30 20  ( col2 ) / col0 
37f40 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
37f50 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 37 0d 0a 2d  b1..----..-57..-
37f60 37 32 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b 69 70 69  72..-97....skipi
37f70 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
37f80 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
37f90 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
37fa0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
37fb0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
37fc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
37fd0 74 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31  tab1.col0 * col1
37fe0 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   + col2 col0 FRO
37ff0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
38000 33 36 0d 0a 31 33 32 0d 0a 36 39 37 0d 0a 0d 0a  36..132..697....
38010 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
38020 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
38030 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
38040 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
38050 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
38060 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38070 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20   cor0.col2 col0 
38080 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
38090 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
380a0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
380b0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
380c0 6f 20 37 37 38 36 37 31 38 62 64 38 30 34 32 30  o 7786718bd80420
380d0 32 32 35 33 37 33 37 38 64 34 30 65 63 38 37 34  22537378d40ec874
380e0 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  75....query I ro
380f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
38100 37 36 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  76 + col2 AS col
38110 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
38120 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a  or0..----..130..
38130 31 33 33 0d 0a 31 37 32 0d 0a 0d 0a 71 75 65 72  133..172....quer
38140 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38150 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ECT + cor0.col1 
38160 2a 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72  * - col0 + + cor
38170 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
38180 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
38190 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 36 0d 0a 2d  ..----..-1326..-
381a0 31 38 36 0d 0a 2d 34 35 34 33 0d 0a 0d 0a 71 75  186..-4543....qu
381b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
381c0 45 4c 45 43 54 20 38 20 2b 20 2d 20 63 6f 72 30  ELECT 8 + - cor0
381d0 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20  .col0 FROM tab2 
381e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 0d  cor0..----..-70.
381f0 0a 2d 37 31 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  .-71..1....query
38200 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
38210 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30  CT - col0 * cor0
38220 2e 63 6f 6c 31 20 2b 20 38 38 20 46 52 4f 4d 20  .col1 + 88 FROM 
38230 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
38240 2d 2d 0d 0a 2d 35 35 32 0d 0a 2d 39 35 32 0d 0a  --..-552..-952..
38250 31 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  10....skipif pos
38260 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
38270 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
38280 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
38290 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
382a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
382b0 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63 6f  SELECT - cor0.co
382c0 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 34 34  l2 * - col0 + 44
382d0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
382e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
382f0 30 36 0d 0a 33 36 39 32 0d 0a 37 37 32 34 0d 0a  06..3692..7724..
38300 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38310 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
38320 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 41   col2 * - col2 A
38330 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
38340 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
38350 32 37 0d 0a 2d 36 31 37 0d 0a 2d 36 39 38 0d 0a  27..-617..-698..
38360 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38370 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
38380 2b 20 34 34 20 2b 20 63 6f 6c 30 20 41 53 20 63  + 44 + col0 AS c
38390 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
383a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   cor0..----..122
383b0 0d 0a 31 32 33 0d 0a 35 31 0d 0a 0d 0a 71 75 65  ..123..51....que
383c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
383d0 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
383e0 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l2 + - cor0.col1
383f0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
38400 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37  r0..----..28..47
38410 0d 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..83....query I 
38420 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
38430 41 4c 4c 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63  ALL - col0 - + c
38440 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
38450 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
38460 31 32 38 0d 0a 2d 31 36 30 0d 0a 2d 36 0d 0a 0d  128..-160..-6...
38470 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38480 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
38490 20 38 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   80 AS col1 FROM
384a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
384b0 2d 2d 2d 0d 0a 38 30 0d 0a 38 30 0d 0a 38 30 0d  ---..80..80..80.
384c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
384d0 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20  rt..SELECT col1 
384e0 2a 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20  * col1 * col1 + 
384f0 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
38500 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
38510 0d 0a 2d 2d 2d 2d 0d 0a 36 33 36 31 34 32 0d 0a  ..----..636142..
38520 37 35 33 36 36 32 0d 0a 39 31 32 37 37 30 0d 0a  753662..912770..
38530 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
38540 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
38550 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 2a 20  col0 + - col1 * 
38560 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
38570 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
38580 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 31 34  or0..----..-2814
38590 0d 0a 2d 36 32 0d 0a 2d 37 33 37 33 0d 0a 0d 0a  ..-62..-7373....
385a0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
385b0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
385c0 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c 32   - col1 * ( col2
385d0 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) + - col0 FROM
385e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
385f0 2d 2d 2d 0d 0a 2d 31 33 32 38 0d 0a 2d 31 34 30  ---..-1328..-140
38600 37 0d 0a 2d 36 33 34 0d 0a 0d 0a 6f 6e 6c 79 69  7..-634....onlyi
38610 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
38620 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
38630 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
38640 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
38650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
38660 62 65 6c 2d 31 35 39 32 0d 0a 53 45 4c 45 43 54  bel-1592..SELECT
38670 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54   - col1 * - CAST
38680 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
38690 20 29 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2b 20   ) - + col2 * + 
386a0 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
386b0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab1..----..NULL.
386c0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
386d0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
386e0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
386f0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
38700 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
38710 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
38720 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
38730 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
38740 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 39  owsort label-159
38750 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  2..SELECT - col1
38760 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c   * - CAST ( NULL
38770 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20   AS INTEGER ) - 
38780 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20  + col2 * + col1 
38790 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
387a0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
387b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..NULL....onlyif
387c0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
387d0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
387e0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
387f0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
38800 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
38810 65 6c 2d 31 35 39 33 0d 0a 53 45 4c 45 43 54 20  el-1593..SELECT 
38820 44 49 53 54 49 4e 43 54 20 43 41 53 54 28 20 2d  DISTINCT CAST( -
38830 20 37 32 20 41 53 20 53 49 47 4e 45 44 20 29 20   72 AS SIGNED ) 
38840 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  + + col0 AS col1
38850 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
38860 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a 2d  r0..----..-37..-
38870 34 38 0d 0a 31 37 0d 0a 0d 0a 73 6b 69 70 69 66  48..17....skipif
38880 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
38890 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
388a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
388b0 35 39 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  593..SELECT DIST
388c0 49 4e 43 54 20 43 41 53 54 20 28 20 2d 20 37 32  INCT CAST ( - 72
388d0 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b 20   AS INTEGER ) + 
388e0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
388f0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
38900 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a 2d 34 38  ..----..-37..-48
38910 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49  ..17....query II
38920 49 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f  IIIIIIIIIIIII ro
38930 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
38940 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
38950 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62  0 CROSS JOIN tab
38960 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c  2, tab2 AS cor1,
38970 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72 32   tab0, tab1 cor2
38980 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
38990 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
389a0 38 34 33 35 32 32 33 36 36 38 64 62 31 38 36 61  8435223668db186a
389b0 35 30 31 32 65 34 31 31 32 32 35 33 66 32 38 0d  5012e4112253f28.
389c0 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
389d0 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
389e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
389f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
38a00 20 2f 20 2d 20 43 41 53 54 20 28 20 2d 20 63 6f   / - CAST ( - co
38a10 6c 31 20 41 53 20 52 45 41 4c 20 29 20 41 53 20  l1 AS REAL ) AS 
38a20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
38a30 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31  ----..-1..-1..-1
38a40 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
38a50 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
38a60 28 20 63 6f 6c 32 20 29 20 2d 20 2b 20 74 61 62  ( col2 ) - + tab
38a70 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46  0.col1 AS col2 F
38a80 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
38a90 2d 35 33 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a  -53..-9..-96....
38aa0 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
38ab0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
38ac0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
38ad0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
38ae0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
38af0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
38b00 20 41 4c 4c 20 74 61 62 30 2e 63 6f 6c 30 20 2a   ALL tab0.col0 *
38b10 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f 6c 32 20   cor0.col1 col2 
38b20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20  FROM tab0, tab1 
38b30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
38b40 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
38b50 74 6f 20 39 64 64 32 31 37 62 36 33 38 35 62 66  to 9dd217b6385bf
38b60 33 38 66 37 38 64 38 62 36 65 36 62 37 38 36 34  38f78d8b6e6b7864
38b70 35 37 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  578....onlyif my
38b80 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
38b90 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
38ba0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
38bb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
38bc0 65 6c 2d 31 35 39 38 0d 0a 53 45 4c 45 43 54 20  el-1598..SELECT 
38bd0 2b 20 37 34 20 2a 20 63 6f 6c 30 20 44 49 56 20  + 74 * col0 DIV 
38be0 74 61 62 30 2e 63 6f 6c 30 20 2b 20 35 37 20 41  tab0.col0 + 57 A
38bf0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
38c00 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31 33 31  ..----..131..131
38c10 0d 0a 31 33 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..131....skipif 
38c20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
38c30 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
38c40 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
38c50 39 38 0d 0a 53 45