sqllogictest
Hex Artifact Content
Not logged in

Artifact 77f4f8f04af795a2fbd1d719f61cea8a64dc4ddb:


0000: 68 61 73 68 2d 74 68 72 65 73 68 6f 6c 64 20 38  hash-threshold 8
0010: 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b  ....statement ok
0020: 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 20 74  ..CREATE TABLE t
0030: 61 62 30 28 63 6f 6c 30 20 49 4e 54 45 47 45 52  ab0(col0 INTEGER
0040: 2c 20 63 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20  , col1 INTEGER, 
0050: 63 6f 6c 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d  col2 INTEGER)...
0060: 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43  .statement ok..C
0070: 52 45 41 54 45 20 54 41 42 4c 45 20 74 61 62 31  REATE TABLE tab1
0080: 28 63 6f 6c 30 20 49 4e 54 45 47 45 52 2c 20 63  (col0 INTEGER, c
0090: 6f 6c 31 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c  ol1 INTEGER, col
00a0: 32 20 49 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74  2 INTEGER)....st
00b0: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 43 52 45 41  atement ok..CREA
00c0: 54 45 20 54 41 42 4c 45 20 74 61 62 32 28 63 6f  TE TABLE tab2(co
00d0: 6c 30 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 31  l0 INTEGER, col1
00e0: 20 49 4e 54 45 47 45 52 2c 20 63 6f 6c 32 20 49   INTEGER, col2 I
00f0: 4e 54 45 47 45 52 29 0d 0a 0d 0a 73 74 61 74 65  NTEGER)....state
0100: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0110: 49 4e 54 4f 20 74 61 62 30 20 56 41 4c 55 45 53  INTO tab0 VALUES
0120: 28 38 39 2c 39 31 2c 38 32 29 0d 0a 0d 0a 73 74  (89,91,82)....st
0130: 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45  atement ok..INSE
0140: 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56 41 4c  RT INTO tab0 VAL
0150: 55 45 53 28 33 35 2c 39 37 2c 31 29 0d 0a 0d 0a  UES(35,97,1)....
0160: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
0170: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 30 20 56  SERT INTO tab0 V
0180: 41 4c 55 45 53 28 32 34 2c 38 36 2c 33 33 29 0d  ALUES(24,86,33).
0190: 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d  ...statement ok.
01a0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 61 62  .INSERT INTO tab
01b0: 31 20 56 41 4c 55 45 53 28 36 34 2c 31 30 2c 35  1 VALUES(64,10,5
01c0: 37 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e 74 20  7)....statement 
01d0: 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  ok..INSERT INTO 
01e0: 74 61 62 31 20 56 41 4c 55 45 53 28 33 2c 32 36  tab1 VALUES(3,26
01f0: 2c 35 34 29 0d 0a 0d 0a 73 74 61 74 65 6d 65 6e  ,54)....statemen
0200: 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20 49 4e 54  t ok..INSERT INT
0210: 4f 20 74 61 62 31 20 56 41 4c 55 45 53 28 38 30  O tab1 VALUES(80
0220: 2c 31 33 2c 39 36 29 0d 0a 0d 0a 73 74 61 74 65  ,13,96)....state
0230: 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52 54 20  ment ok..INSERT 
0240: 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55 45 53  INTO tab2 VALUES
0250: 28 37 2c 33 31 2c 32 37 29 0d 0a 0d 0a 73 74 61  (7,31,27)....sta
0260: 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e 53 45 52  tement ok..INSER
0270: 54 20 49 4e 54 4f 20 74 61 62 32 20 56 41 4c 55  T INTO tab2 VALU
0280: 45 53 28 37 39 2c 31 37 2c 33 38 29 0d 0a 0d 0a  ES(79,17,38)....
0290: 73 74 61 74 65 6d 65 6e 74 20 6f 6b 0d 0a 49 4e  statement ok..IN
02a0: 53 45 52 54 20 49 4e 54 4f 20 74 61 62 32 20 56  SERT INTO tab2 V
02b0: 41 4c 55 45 53 28 37 38 2c 35 39 2c 32 36 29 0d  ALUES(78,59,26).
02c0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
02d0: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
02e0: 4e 43 54 20 74 61 62 30 2e 63 6f 6c 30 20 2b 20  NCT tab0.col0 + 
02f0: 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  + col0 * - col2 
0300: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
0310: 0a 2d 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d  .-7209..-768..0.
0320: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
0330: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
0340: 4e 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  NCT col1 + - col
0350: 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
0360: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a  ab1..----..-28..
0370: 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72  -47..-83....quer
0380: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0390: 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2d  ECT ALL col1 * -
03a0: 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20   tab1.col0 FROM 
03b0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34  tab1..----..-104
03c0: 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a  0..-640..-78....
03d0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
03e0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 63  .SELECT col2 + c
03f0: 6f 6c 30 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 63  ol0 * col0 * + c
0400: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
0410: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36   tab2..----..106
0420: 31 33 35 0d 0a 31 35 34 36 0d 0a 33 35 38 39 38  135..1546..35898
0430: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
0440: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
0450: 31 2e 63 6f 6c 31 20 2a 20 2b 20 74 61 62 31 2e  1.col1 * + tab1.
0460: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
0470: 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab1..----..10
0480: 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71  40..640..78....q
0490: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
04a0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
04b0: 31 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 - + col1 * col
04c0: 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * - col0 FROM 
04d0: 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 38 0d  tab1..----..208.
04e0: 0a 34 30 39 35 30 0d 0a 38 33 31 38 37 0d 0a 0d  .40950..83187...
04f0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0500: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0510: 54 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20 2b 20  T tab2.col2 * + 
0520: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  col0 * col0 + + 
0530: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
0540: 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33  M tab2..----..13
0550: 33 30 0d 0a 31 35 38 32 36 32 0d 0a 32 33 37 32  30..158262..2372
0560: 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  37....query III 
0570: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0580: 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 32 20  ALL * FROM tab2 
0590: 63 6f 72 30 20 57 48 45 52 45 20 28 20 4e 55 4c  cor0 WHERE ( NUL
05a0: 4c 20 29 20 3c 3d 20 28 20 4e 55 4c 4c 20 29 0d  L ) <= ( NULL ).
05b0: 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20  .----....skipif 
05c0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
05d0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
05e0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
05f0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
0600: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0610: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
0620: 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
0630: 61 62 32 20 41 53 20 63 6f 72 30 20 57 48 45 52  ab2 AS cor0 WHER
0640: 45 20 4e 4f 54 20 28 20 4e 55 4c 4c 20 29 20 49  E NOT ( NULL ) I
0650: 4e 20 28 20 2d 20 63 6f 6c 31 20 29 0d 0a 2d 2d  N ( - col1 )..--
0660: 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  --....skipif pos
0670: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
0680: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
0690: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
06a0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
06b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
06c0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 63 6f  SELECT - col0 co
06d0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45  l1 FROM tab1 WHE
06e0: 52 45 20 28 20 63 6f 6c 32 20 29 20 3c 20 63 6f  RE ( col2 ) < co
06f0: 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  l1 + col1 + - co
0700: 6c 32 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72  l2..----....quer
0710: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0720: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
0730: 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20  ol2 * cor0.col1 
0740: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
0750: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31  0..----..1248..1
0760: 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72  404..570....quer
0770: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0780: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
0790: 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a   col0 + - col2 *
07a0: 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   + col2 AS col1 
07b0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
07c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 38 37 0d 0a  0..----..-2887..
07d0: 2d 33 31 37 35 0d 0a 2d 39 31 32 33 0d 0a 0d 0a  -3175..-9123....
07e0: 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
07f0: 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
0800: 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 57 48   tab2 AS cor0 WH
0810: 45 52 45 20 4e 4f 54 20 63 6f 6c 32 20 2a 20 63  ERE NOT col2 * c
0820: 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  or0.col0 * col0 
0830: 49 4e 20 28 20 63 6f 72 30 2e 63 6f 6c 30 20 29  IN ( cor0.col0 )
0840: 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
0850: 20 68 61 73 68 69 6e 67 20 74 6f 20 61 64 30 35   hashing to ad05
0860: 62 35 39 34 32 34 30 30 64 35 65 37 61 32 31 62  b5942400d5e7a21b
0870: 33 32 33 62 33 64 61 36 35 61 34 35 0d 0a 0d 0a  323b3da65a45....
0880: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
0890: 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
08a0: 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
08b0: 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
08c0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 0d 0a  wsort label-13..
08d0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
08e0: 2d 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 32 20  - col0 DIV col2 
08f0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0900: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35  0..----..-1..-35
0910: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..0....skipif my
0920: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
0930: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
0940: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 0d 0a  wsort label-13..
0950: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0960: 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 46 52  - col0 / col2 FR
0970: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
0980: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35 0d 0a  .----..-1..-35..
0990: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
09a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
09b0: 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41   + col0 + col0 A
09c0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
09d0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38   cor0..----..178
09e0: 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72  ..48..70....quer
09f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
0a00: 45 43 54 20 41 4c 4c 20 36 35 20 46 52 4f 4d 20  ECT ALL 65 FROM 
0a10: 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
0a20: 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
0a30: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
0a40: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 63 39  s hashing to 1c9
0a50: 64 30 62 66 39 36 63 64 33 33 36 31 39 34 32 66  d0bf96cd3361942f
0a60: 61 64 61 64 36 36 38 31 33 38 62 39 63 0d 0a 0d  adad668138b9c...
0a70: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0a80: 0d 0a 53 45 4c 45 43 54 20 2b 20 38 20 46 52 4f  ..SELECT + 8 FRO
0a90: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
0aa0: 2d 0d 0a 38 0d 0a 38 0d 0a 38 0d 0a 0d 0a 71 75  -..8..8..8....qu
0ab0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
0ac0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 28  ELECT DISTINCT (
0ad0: 20 2b 20 63 6f 6c 30 20 29 20 2a 20 63 6f 6c 31   + col0 ) * col1
0ae0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
0af0: 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d  ..1040..640..78.
0b00: 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
0b10: 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
0b20: 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
0b30: 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
0b40: 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
0b50: 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32 0d  1, tab1 AS cor2.
0b60: 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65  .----..972 value
0b70: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 61 39  s hashing to 0a9
0b80: 31 39 34 66 32 30 30 61 34 32 32 30 65 34 31 39  194f200a4220e419
0b90: 64 33 35 63 34 36 31 66 39 66 63 66 65 0d 0a 0d  d35c461f9fcfe...
0ba0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0bb0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
0bc0: 54 20 2d 20 2b 20 63 6f 6c 30 20 2d 20 2b 20 63  T - + col0 - + c
0bd0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
0be0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
0bf0: 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d  0..-132..-180...
0c00: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0c10: 0d 0a 53 45 4c 45 43 54 20 33 36 20 2b 20 2d 20  ..SELECT 36 + - 
0c20: 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
0c30: 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72  ab2, tab1 AS cor
0c40: 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
0c50: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 37 36  s hashing to c76
0c60: 31 33 38 33 62 33 34 33 64 34 63 36 34 65 36 38  1383b343d4c64e68
0c70: 65 38 39 62 37 33 37 37 30 61 61 62 37 0d 0a 0d  e89b73770aab7...
0c80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
0c90: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
0ca0: 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 + + cor0.col
0cb0: 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  1 * + col1 FROM 
0cc0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
0cd0: 2d 2d 0d 0a 37 33 36 33 0d 0a 38 31 39 39 0d 0a  --..7363..8199..
0ce0: 39 34 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49  9408....query II
0cf0: 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
0d00: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
0d10: 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 2c  NCT * FROM tab0,
0d20: 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74   tab0 AS cor0, t
0d30: 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab2 AS cor1, tab
0d40: 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  0 AS cor2..----.
0d50: 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
0d60: 69 6e 67 20 74 6f 20 33 38 30 32 34 31 62 62 63  ing to 380241bbc
0d70: 35 30 33 61 33 31 65 37 30 34 39 34 36 31 31 61  503a31e70494611a
0d80: 38 37 66 66 64 39 39 0d 0a 0d 0a 71 75 65 72 79  87ffd99....query
0d90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
0da0: 43 54 20 2b 20 2b 20 39 31 20 2a 20 63 6f 6c 30  CT + + 91 * col0
0db0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0dc0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
0dd0: 37 33 0d 0a 35 38 32 34 0d 0a 37 32 38 30 0d 0a  73..5824..7280..
0de0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
0df0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
0e00: 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
0e10: 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  1, tab2 AS cor0.
0e20: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
0e30: 68 61 73 68 69 6e 67 20 74 6f 20 63 36 31 64 32  hashing to c61d2
0e40: 37 61 30 30 32 32 65 36 64 30 32 32 33 37 31 64  7a0022e6d022371d
0e50: 63 35 38 38 31 39 61 62 32 37 32 0d 0a 0d 0a 71  c58819ab272....q
0e60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
0e70: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
0e80: 2b 20 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  + 1 FROM tab0, t
0e90: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
0ea0: 2d 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..1....query I 
0eb0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
0ec0: 2b 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  + - col1 + col1 
0ed0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
0ee0: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
0ef0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
0f00: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
0f10: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
0f20: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
0f30: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
0f40: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 0d  owsort label-27.
0f50: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
0f60: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
0f70: 45 44 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  ED ) + cor0.col2
0f80: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
0f90: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
0fa0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
0fb0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
0fc0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
0fd0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
0fe0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 0d 0a 53  sort label-27..S
0ff0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
1000: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
1010: 45 52 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  ER ) + cor0.col2
1020: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1030: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1040: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
1050: 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
1060: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1070: 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
1080: 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col2 * col0 FROM
1090: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
10a0: 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32 0d 0a  ---..165..3712..
10b0: 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7760....query I 
10c0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10d0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
10e0: 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
10f0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1100: 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a 2d 39 33 0d  ..-29..-74..-93.
1110: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1120: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1130: 20 39 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20   91 * cor0.col2 
1140: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1150: 31 2c 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  1, tab2, tab2 AS
1160: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor0..----..27 
1170: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1180: 6f 20 66 63 65 63 32 61 34 39 32 33 63 37 35 31  o fcec2a4923c751
1190: 31 33 33 32 36 66 36 34 66 38 39 33 38 65 65 61  13326f64f8938eea
11a0: 39 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  9b....skipif pos
11b0: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
11c0: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
11d0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
11e0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
11f0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1200: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1210: 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 63 6f  col1 - + col0 co
1220: 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
1230: 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33  --..-54..-67..23
1240: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
1250: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
1260: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
1270: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
1280: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
1290: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32 0d  owsort label-32.
12a0: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 63  .SELECT col2 * c
12b0: 6f 6c 32 20 2a 20 43 41 53 54 28 20 63 6f 6c 31  ol2 * CAST( col1
12c0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63   AS SIGNED ) - c
12d0: 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
12e0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
12f0: 0d 0a 32 32 35 37 32 0d 0a 32 34 35 31 30 0d 0a  ..22572..24510..
1300: 33 39 38 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  39858....skipif 
1310: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1320: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1330: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 32  rowsort label-32
1340: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
1350: 63 6f 6c 32 20 2a 20 43 41 53 54 20 28 20 63 6f  col2 * CAST ( co
1360: 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
1370: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  - cor0.col2 FROM
1380: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1390: 2d 2d 2d 0d 0a 32 32 35 37 32 0d 0a 32 34 35 31  ---..22572..2451
13a0: 30 0d 0a 33 39 38 35 38 0d 0a 0d 0a 71 75 65 72  0..39858....quer
13b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
13c0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
13d0: 20 32 36 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   26 AS col2 FROM
13e0: 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
13f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 0d  or0..----..26...
1400: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1410: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1420: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1430: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1440: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 34 0d  owsort label-34.
1450: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
1460: 6c 31 20 44 49 56 20 2b 20 74 61 62 32 2e 63 6f  l1 DIV + tab2.co
1470: 6c 30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l0 col1 FROM tab
1480: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a  2..----..-4..0..
1490: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  0....skipif post
14a0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
14b0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
14c0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
14d0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
14e0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
14f0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
1500: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
1510: 65 6c 2d 33 34 0d 0a 53 45 4c 45 43 54 20 41 4c  el-34..SELECT AL
1520: 4c 20 2d 20 63 6f 6c 31 20 2f 20 2b 20 74 61 62  L - col1 / + tab
1530: 32 2e 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  2.col0 col1 FROM
1540: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 0d   tab2..----..-4.
1550: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
1560: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1570: 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   - col2 * - col2
1580: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1590: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d 0a  b2..----..1444..
15a0: 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 6f 6e 6c 79  676..729....only
15b0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15c0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15d0: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15f0: 74 20 6c 61 62 65 6c 2d 33 36 0d 0a 53 45 4c 45  t label-36..SELE
1600: 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49 56  CT cor0.col0 DIV
1610: 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
1620: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
1630: 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ..-1..-1....skip
1640: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1650: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1660: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1670: 2d 33 36 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  -36..SELECT cor0
1680: 2e 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 46  .col0 / - col0 F
1690: 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
16a0: 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d  ---..-1..-1..-1.
16b0: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
16c0: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
16d0: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
16e0: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
16f0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
1700: 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  7..SELECT + col0
1710: 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63   DIV - col0 AS c
1720: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
1730: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d   cor0..----..-1.
1740: 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70 69  .-1..-1....skipi
1750: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1760: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1770: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1780: 33 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  37..SELECT + col
1790: 30 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  0 / - col0 AS co
17a0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
17b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
17c0: 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20  -1..-1....query 
17d0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17e0: 54 20 41 4c 4c 20 2d 20 36 37 20 41 53 20 63 6f  T ALL - 67 AS co
17f0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
1800: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1810: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
1820: 6e 67 20 74 6f 20 66 62 65 30 33 62 31 35 64 36  ng to fbe03b15d6
1830: 62 39 35 31 34 31 30 62 33 38 66 37 65 39 38 38  b951410b38f7e988
1840: 39 35 30 30 36 66 0d 0a 0d 0a 71 75 65 72 79 20  95006f....query 
1850: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1860: 54 20 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f 4d  T cor1.col2 FROM
1870: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
1880: 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 0d 0a  or0, tab2 cor1..
1890: 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
18a0: 68 61 73 68 69 6e 67 20 74 6f 20 34 30 66 64 38  hashing to 40fd8
18b0: 63 63 30 64 65 39 32 65 61 36 38 64 37 33 36 33  cc0de92ea68d7363
18c0: 34 63 32 64 38 66 37 35 62 66 35 0d 0a 0d 0a 6f  4c2d8f75bf5....o
18d0: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
18e0: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
18f0: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1900: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1910: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1920: 74 20 6c 61 62 65 6c 2d 34 30 0d 0a 53 45 4c 45  t label-40..SELE
1930: 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32  CT + col0 + col2
1940: 20 2d 20 2d 20 43 41 53 54 28 20 2d 20 63 6f 6c   - - CAST( - col
1950: 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  1 AS SIGNED ) AS
1960: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1970: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1980: 30 30 0d 0a 33 0d 0a 34 35 0d 0a 0d 0a 73 6b 69  00..3..45....ski
1990: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
19a0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
19b0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
19c0: 6c 2d 34 30 0d 0a 53 45 4c 45 43 54 20 2b 20 63  l-40..SELECT + c
19d0: 6f 6c 30 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 43  ol0 + col2 - - C
19e0: 41 53 54 20 28 20 2d 20 63 6f 6c 31 20 41 53 20  AST ( - col1 AS 
19f0: 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f 6c  INTEGER ) AS col
1a00: 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1a10: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a  or0..----..100..
1a20: 33 0d 0a 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49  3..45....query I
1a30: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a40: 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 35 35 20 2a   + - col2 + 55 *
1a50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1a60: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
1a70: 39 31 36 0d 0a 33 30 37 38 0d 0a 35 31 38 34 0d  916..3078..5184.
1a80: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a90: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
1aa0: 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  ol2 + col0 * cor
1ab0: 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  0.col2 FROM tab1
1ac0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ad0: 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37 37 36 0d  216..3705..7776.
1ae0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1af0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1b00: 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 * - cor0.col
1b10: 32 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  2 + col2 * col0 
1b20: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
1b30: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
1b40: 0a 2d 31 36 34 0d 0a 2d 32 30 34 36 0d 0a 2d 36  .-164..-2046..-6
1b50: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
1b60: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1b70: 31 20 2b 20 2d 20 28 20 2b 20 32 33 20 2a 20 2b  1 + - ( + 23 * +
1b80: 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 29 20 46   col2 + col0 ) F
1b90: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
1ba0: 2d 2d 2d 0d 0a 2d 35 39 37 0d 0a 2d 36 31 37 0d  ---..-597..-617.
1bb0: 0a 2d 39 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .-936....query I
1bc0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bd0: 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63   DISTINCT cor0.c
1be0: 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 + cor0.col0 
1bf0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1c00: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d  0..----..29..74.
1c10: 0a 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .93....query I r
1c20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1c30: 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2b   col1 + + col1 +
1c40: 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
1c50: 30 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  0 * col0 AS col0
1c60: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1c70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 32 35  r0..----..118825
1c80: 0d 0a 34 39 35 33 36 0d 0a 37 32 30 38 31 31 0d  ..49536..720811.
1c90: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1ca0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1cb0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1cc0: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1cd0: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1ce0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1cf0: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  ECT cor0.col1 * 
1d00: 2b 20 33 37 20 2b 20 63 6f 6c 31 20 63 6f 6c 32  + 37 + col1 col2
1d10: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d20: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 38 30 0d 0a 34  r0..----..380..4
1d30: 39 34 0d 0a 39 38 38 0d 0a 0d 0a 73 6b 69 70 69  94..988....skipi
1d40: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1d50: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1d60: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d70: 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  T - + cor0.col1 
1d80: 2f 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 31 20  / CAST ( - col1 
1d90: 41 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74  AS REAL ) FROM t
1da0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1db0: 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b  -..1..1..1....sk
1dc0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
1dd0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
1de0: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
1df0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
1e00: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
1e10: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1e20: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 63 6f 6c  ol1 * - col1 col
1e30: 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  1 FROM tab1..---
1e40: 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d  -..-100..-169..-
1e50: 36 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  676....query I r
1e60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1e70: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a   - col2 + col2 *
1e80: 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
1e90: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1ea0: 2d 2d 0d 0a 32 30 35 34 0d 0a 32 31 36 0d 0a 33  --..2054..216..3
1eb0: 30 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  040....query I r
1ec0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
1ed0: 20 30 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d   0 * + col0 FROM
1ee0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   tab2..----..0..
1ef0: 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
1f00: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f10: 44 49 53 54 49 4e 43 54 20 2b 20 74 61 62 31 2e  DISTINCT + tab1.
1f20: 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  col1 * col2 FROM
1f30: 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34   tab1..----..124
1f40: 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a  8..1404..570....
1f50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f60: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
1f70: 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 * + col0 AS c
1f80: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
1f90: 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a  ---..1040..640..
1fa0: 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  78....query IIII
1fb0: 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
1fc0: 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
1fd0: 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61 62 31  tab2, tab0, tab1
1fe0: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
1ff0: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37  S cor1..----..97
2000: 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  2 values hashing
2010: 20 74 6f 20 34 39 63 38 62 66 33 65 39 33 31 61   to 49c8bf3e931a
2020: 38 39 38 62 61 37 61 66 36 33 64 30 65 33 37 37  898ba7af63d0e377
2030: 65 62 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  eb79....onlyif m
2040: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2050: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2060: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2070: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2080: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2090: 2d 35 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -55..SELECT DIST
20a0: 49 4e 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  INCT + CAST( NUL
20b0: 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20 2a  L AS DECIMAL ) *
20c0: 20 2b 20 32 34 20 2b 20 63 6f 6c 31 20 2a 20 43   + 24 + col1 * C
20d0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
20e0: 4e 45 44 20 29 20 2d 20 2d 20 35 30 20 41 53 20  NED ) - - 50 AS 
20f0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
2100: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
2110: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2120: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2130: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2140: 65 6c 2d 35 35 0d 0a 53 45 4c 45 43 54 20 44 49  el-55..SELECT DI
2150: 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20  STINCT + CAST ( 
2160: 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a  NULL AS REAL ) *
2170: 20 2b 20 32 34 20 2b 20 63 6f 6c 31 20 2a 20 43   + 24 + col1 * C
2180: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
2190: 54 45 47 45 52 20 29 20 2d 20 2d 20 35 30 20 41  TEGER ) - - 50 A
21a0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
21b0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
21c0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
21d0: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20  .SELECT ALL - ( 
21e0: 2d 20 34 30 20 2a 20 74 61 62 31 2e 63 6f 6c 31  - 40 * tab1.col1
21f0: 20 29 20 2d 20 2b 20 28 20 34 31 20 29 20 46 52   ) - + ( 41 ) FR
2200: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab1..----..3
2210: 35 39 0d 0a 34 37 39 0d 0a 39 39 39 0d 0a 0d 0a  59..479..999....
2220: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2230: 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32  .SELECT ALL col2
2240: 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   * + col2 * - co
2250: 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f  l2 + col0 * - co
2260: 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63  l0 - + col1 AS c
2270: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
2280: 2d 2d 2d 0d 0a 2d 31 39 37 36 33 0d 0a 2d 32 33  ---..-19763..-23
2290: 37 31 39 0d 0a 2d 36 31 31 33 30 0d 0a 0d 0a 71  719..-61130....q
22a0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22b0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22c0: 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col1 + col2 * co
22d0: 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63  l1 * + col0 AS c
22e0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
22f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34   cor0..----..364
2300: 39 30 0d 0a 34 32 33 38 0d 0a 39 39 38 35 33 0d  90..4238..99853.
2310: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
2320: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
2330: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
2340: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
2350: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
2360: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 39 0d 0a  wsort label-59..
2370: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2380: 2b 20 2d 20 43 41 53 54 28 20 2d 20 63 6f 6c 30  + - CAST( - col0
2390: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
23a0: 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20   col0 + col2 AS 
23b0: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
23c0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
23d0: 32 32 34 0d 0a 2d 35 34 33 0d 0a 2d 37 38 33 39  224..-543..-7839
23e0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
23f0: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2400: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2410: 72 74 20 6c 61 62 65 6c 2d 35 39 0d 0a 53 45 4c  rt label-59..SEL
2420: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
2430: 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 30 20 41   CAST ( - col0 A
2440: 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20  S INTEGER ) * - 
2450: 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63  col0 + col2 AS c
2460: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
2470: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
2480: 32 34 0d 0a 2d 35 34 33 0d 0a 2d 37 38 33 39 0d  24..-543..-7839.
2490: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24a0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
24b0: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a   - col2 + col0 *
24c0: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
24d0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
24e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 36 0d  cor0..----..216.
24f0: 0a 33 37 30 35 0d 0a 37 37 37 36 0d 0a 0d 0a 71  .3705..7776....q
2500: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2510: 53 45 4c 45 43 54 20 2d 20 2d 20 28 20 63 6f 6c  SELECT - - ( col
2520: 32 20 29 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  2 ) * col0 AS co
2530: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
2540: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d  cor0..----..162.
2550: 0a 33 36 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71  .3648..7680....q
2560: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2570: 53 45 4c 45 43 54 20 41 4c 4c 20 37 36 20 46 52  SELECT ALL 76 FR
2580: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2590: 0a 2d 2d 2d 2d 0d 0a 37 36 0d 0a 37 36 0d 0a 37  .----..76..76..7
25a0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
25b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
25c0: 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c 32 20 2b  TINCT + + col2 +
25d0: 20 34 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53   43 FROM tab0 AS
25e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 35   cor0..----..125
25f0: 0d 0a 34 34 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72  ..44..76....quer
2600: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2610: 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 30  ECT ALL - - col0
2620: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
2630: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30  1 cor0..----..40
2640: 39 36 0d 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71  96..6400..9....q
2650: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2660: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
2670: 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  + col2 AS col2 F
2680: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2690: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
26a0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26b0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
26c0: 20 38 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   80 AS col1 FROM
26d0: 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
26e0: 0d 0a 2d 38 30 0d 0a 2d 38 30 0d 0a 2d 38 30 0d  ..-80..-80..-80.
26f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2700: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
2710: 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 + col2 AS co
2720: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
2730: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d  cor0..----..104.
2740: 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 73 6b 69 70  .117..34....skip
2750: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
2760: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
2770: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
2780: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
2790: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
27a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
27b0: 54 49 4e 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  TINCT - - cor0.c
27c0: 6f 6c 32 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20  ol2 * col1 col2 
27d0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
27e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31  0..----..1248..1
27f0: 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65 72  404..570....quer
2800: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2810: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
2820: 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53 20   col0 + col0 AS 
2830: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2840: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2850: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2860: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 30 20  rt..SELECT - 40 
2870: 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  + + col2 * col0 
2880: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2890: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 37 32 35  0..----..-5..725
28a0: 38 0d 0a 37 35 32 0d 0a 0d 0a 71 75 65 72 79 20  8..752....query 
28b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
28c0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b  T ALL + col2 + +
28d0: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
28e0: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
28f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d  cor0..----..164.
2900: 0a 32 0d 0a 36 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  .2..66....onlyif
2910: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2920: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2930: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2940: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2950: 6c 61 62 65 6c 2d 37 32 0d 0a 53 45 4c 45 43 54  label-72..SELECT
2960: 20 2b 20 2d 20 36 36 20 44 49 56 20 2d 20 63 6f   + - 66 DIV - co
2970: 6c 31 20 2b 20 2b 20 38 38 20 2a 20 63 6f 6c 31  l1 + + 88 * col1
2980: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
2990: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
29a0: 0d 0a 37 35 36 38 0d 0a 38 30 30 38 0d 0a 38 35  ..7568..8008..85
29b0: 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  36....skipif mys
29c0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
29d0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
29e0: 73 6f 72 74 20 6c 61 62 65 6c 2d 37 32 0d 0a 53  sort label-72..S
29f0: 45 4c 45 43 54 20 2b 20 2d 20 36 36 20 2f 20 2d  ELECT + - 66 / -
2a00: 20 63 6f 6c 31 20 2b 20 2b 20 38 38 20 2a 20 63   col1 + + 88 * c
2a10: 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
2a20: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a30: 2d 2d 2d 0d 0a 37 35 36 38 0d 0a 38 30 30 38 0d  ---..7568..8008.
2a40: 0a 38 35 33 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .8536....query I
2a50: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2a60: 20 41 4c 4c 20 2b 20 28 20 2d 20 63 6f 72 30 2e   ALL + ( - cor0.
2a70: 63 6f 6c 30 20 29 20 2a 20 28 20 2b 20 63 6f 6c  col0 ) * ( + col
2a80: 30 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  0 ) FROM tab2 AS
2a90: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 39   cor0..----..-49
2aa0: 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34 31 0d 0a  ..-6084..-6241..
2ab0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ac0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
2ad0: 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e  - col1 * - cor0.
2ae0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2af0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
2b00: 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39 34 30  396..-8281..-940
2b10: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2b20: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2b30: 20 2b 20 30 20 41 53 20 63 6f 6c 31 20 46 52 4f   + 0 AS col1 FRO
2b40: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2b50: 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
2b60: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2b70: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2b80: 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  T + col0 * col1 
2b90: 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + - col0 AS col0
2ba0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2bb0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 34 0d 0a  r0..----..1264..
2bc0: 32 31 30 0d 0a 34 35 32 34 0d 0a 0d 0a 71 75 65  210..4524....que
2bd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2be0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 30  LECT DISTINCT 80
2bf0: 20 2a 20 63 6f 6c 30 20 2d 20 28 20 32 36 20 2a   * col0 - ( 26 *
2c00: 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   - col2 ) FROM t
2c10: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
2c20: 2d 0d 0a 31 32 36 32 0d 0a 36 39 31 36 0d 0a 37  -..1262..6916..7
2c30: 33 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  308....query I r
2c40: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36  owsort..SELECT 6
2c50: 37 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  7 + col0 AS col2
2c60: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
2c70: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 0d 0a 31  r0..----..131..1
2c80: 34 37 0d 0a 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  47..70....onlyif
2c90: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
2ca0: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
2cb0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
2cc0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2cd0: 6c 61 62 65 6c 2d 37 39 0d 0a 53 45 4c 45 43 54  label-79..SELECT
2ce0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
2cf0: 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32   + col0 + + col2
2d00: 20 2d 20 2b 20 38 20 44 49 56 20 2b 20 63 6f 6c   - + 8 DIV + col
2d10: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2d20: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 31 35 33 0d  ab1..----..4153.
2d30: 0a 36 33 0d 0a 36 34 39 36 0d 0a 0d 0a 73 6b 69  .63..6496....ski
2d40: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2d50: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2d60: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d70: 6c 2d 37 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  l-79..SELECT DIS
2d80: 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63  TINCT col0 * + c
2d90: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2d 20 2b  ol0 + + col2 - +
2da0: 20 38 20 2f 20 2b 20 63 6f 6c 31 20 41 53 20 63   8 / + col1 AS c
2db0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
2dc0: 2d 2d 2d 0d 0a 34 31 35 33 0d 0a 36 33 0d 0a 36  ---..4153..63..6
2dd0: 34 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  496....query I r
2de0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2df0: 4c 4c 20 63 6f 6c 30 20 2d 20 2b 20 38 39 20 41  LL col0 - + 89 A
2e00: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
2e10: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 31 31  ..----..-10..-11
2e20: 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-82....onlyif 
2e30: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2e40: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2e50: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2e60: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2e70: 61 62 65 6c 2d 38 31 0d 0a 53 45 4c 45 43 54 20  abel-81..SELECT 
2e80: 2d 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20  - col0 * ( col1 
2e90: 29 20 44 49 56 20 28 20 2b 20 28 20 2d 20 63 6f  ) DIV ( + ( - co
2ea0: 6c 32 20 29 20 2a 20 63 6f 6c 31 20 29 20 46 52  l2 ) * col1 ) FR
2eb0: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30  OM tab1..----..0
2ec0: 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..1....skipif
2ed0: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2ee0: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2ef0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
2f00: 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30  1..SELECT - col0
2f10: 20 2a 20 28 20 63 6f 6c 31 20 29 20 2f 20 28 20   * ( col1 ) / ( 
2f20: 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 2a 20 63  + ( - col2 ) * c
2f30: 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  ol1 ) FROM tab1.
2f40: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
2f50: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f60: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2f70: 43 54 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63  CT - - col1 AS c
2f80: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
2f90: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d   cor0..----..17.
2fa0: 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79  .31..59....query
2fb0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2fc0: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20  CT ALL - col2 + 
2fd0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2d 20 28 20  cor0.col2 * - ( 
2fe0: 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20  + col0 * col1 ) 
2ff0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
3000: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
3010: 0a 2d 31 31 39 36 37 38 0d 0a 2d 35 31 30 37 32  .-119678..-51072
3020: 0d 0a 2d 35 38 38 36 0d 0a 0d 0a 71 75 65 72 79  ..-5886....query
3030: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3040: 43 54 20 41 4c 4c 20 2d 20 35 35 20 41 53 20 63  CT ALL - 55 AS c
3050: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
3060: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35   cor0..----..-55
3070: 0d 0a 2d 35 35 0d 0a 2d 35 35 0d 0a 0d 0a 6f 6e  ..-55..-55....on
3080: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
3090: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
30a0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
30b0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
30c0: 6f 72 74 20 6c 61 62 65 6c 2d 38 35 0d 0a 53 45  ort label-85..SE
30d0: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 39 32  LECT col2 + - 92
30e0: 20 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74   DIV col2 FROM t
30f0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
3100: 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39 36 0d 0a 0d  -..53..56..96...
3110: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
3120: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
3130: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
3140: 6c 61 62 65 6c 2d 38 35 0d 0a 53 45 4c 45 43 54  label-85..SELECT
3150: 20 63 6f 6c 32 20 2b 20 2d 20 39 32 20 2f 20 63   col2 + - 92 / c
3160: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
3170: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d   cor0..----..53.
3180: 0a 35 36 0d 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69  .56..96....onlyi
3190: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
31a0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
31b0: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
31c0: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
31d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
31e0: 62 65 6c 2d 38 36 0d 0a 53 45 4c 45 43 54 20 2d  bel-86..SELECT -
31f0: 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 28 20   col0 * - CAST( 
3200: 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
3210: 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46   + + cor0.col1 F
3220: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
3230: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
3240: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
3250: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
3260: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
3270: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
3280: 2d 38 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  -86..SELECT - co
3290: 6c 30 20 2a 20 2d 20 43 41 53 54 20 28 20 4e 55  l0 * - CAST ( NU
32a0: 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
32b0: 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  + + cor0.col1 FR
32c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
32d0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
32e0: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79  L..NULL....query
32f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3300: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
3310: 6c 30 20 2a 20 36 31 20 46 52 4f 4d 20 74 61 62  l0 * 61 FROM tab
3320: 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  1 cor0..----..-1
3330: 38 33 0d 0a 2d 33 39 30 34 0d 0a 2d 34 38 38 30  83..-3904..-4880
3340: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
3350: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
3360: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
3370: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
3380: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
3390: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38 0d  owsort label-88.
33a0: 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 43  .SELECT col0 / C
33b0: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
33c0: 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 20  NED ) FROM tab1 
33d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
33e0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
33f0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
3400: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
3410: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3420: 74 20 6c 61 62 65 6c 2d 38 38 0d 0a 53 45 4c 45  t label-88..SELE
3430: 43 54 20 63 6f 6c 30 20 2f 20 43 41 53 54 20 28  CT col0 / CAST (
3440: 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
3450: 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   ) FROM tab1 AS 
3460: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
3470: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
3480: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
3490: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
34a0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
34b0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
34c0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
34d0: 72 74 20 6c 61 62 65 6c 2d 38 39 0d 0a 53 45 4c  rt label-89..SEL
34e0: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
34f0: 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
3500: 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
3510: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
3520: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
3530: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
3540: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
3550: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
3560: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 0d 0a  wsort label-89..
3570: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
3580: 30 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  0 + - CAST ( NUL
3590: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
35a0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
35b0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
35c0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79  LL..NULL....only
35d0: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
35e0: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
35f0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
3600: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
3610: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3620: 61 62 65 6c 2d 39 30 0d 0a 53 45 4c 45 43 54 20  abel-90..SELECT 
3630: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20  DISTINCT col0 + 
3640: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
3650: 47 4e 45 44 20 29 20 2f 20 63 6f 6c 30 20 46 52  GNED ) / col0 FR
3660: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
3670: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  --..NULL....skip
3680: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
3690: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
36a0: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
36b0: 2d 39 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  -90..SELECT DIST
36c0: 49 4e 43 54 20 63 6f 6c 30 20 2b 20 43 41 53 54  INCT col0 + CAST
36d0: 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
36e0: 45 52 20 29 20 2f 20 63 6f 6c 30 20 46 52 4f 4d  ER ) / col0 FROM
36f0: 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
3700: 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
3710: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3720: 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72  T - col0 * - cor
3730: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
3740: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3750: 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
3760: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3770: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
3780: 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20  INCT - col0 * - 
3790: 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col1 * col0 + co
37a0: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
37b0: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
37c0: 0a 31 31 38 38 32 36 0d 0a 34 39 35 36 39 0d 0a  .118826..49569..
37d0: 37 32 30 38 39 33 0d 0a 0d 0a 71 75 65 72 79 20  720893....query 
37e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37f0: 54 20 2b 20 39 32 20 46 52 4f 4d 20 74 61 62 32  T + 92 FROM tab2
3800: 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20  , tab2 AS cor0, 
3810: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
3820: 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
3830: 73 68 69 6e 67 20 74 6f 20 63 36 34 63 62 37 61  shing to c64cb7a
3840: 38 31 64 61 35 31 66 34 62 65 30 62 36 39 30 36  81da51f4be0b6906
3850: 61 32 32 33 65 38 38 31 37 0d 0a 0d 0a 71 75 65  a223e8817....que
3860: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
3870: 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e  LECT ALL + cor0.
3880: 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col2 * cor0.col0
3890: 20 2b 20 35 37 20 46 52 4f 4d 20 74 61 62 31 20   + 57 FROM tab1 
38a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
38b0: 31 39 0d 0a 33 37 30 35 0d 0a 37 37 33 37 0d 0a  19..3705..7737..
38c0: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
38d0: 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
38e0: 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
38f0: 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
3900: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 35  rowsort label-95
3910: 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
3920: 44 49 56 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  DIV col2 FROM ta
3930: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3940: 0d 0a 2d 31 0d 0a 2d 33 35 0d 0a 30 0d 0a 0d 0a  ..-1..-35..0....
3950: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
3960: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
3970: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
3980: 61 62 65 6c 2d 39 35 0d 0a 53 45 4c 45 43 54 20  abel-95..SELECT 
3990: 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 32 20 46 52  - col0 / col2 FR
39a0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
39b0: 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35 0d 0a  .----..-1..-35..
39c0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
39d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
39e0: 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  TINCT cor0.col2 
39f0: 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + + col0 AS col0
3a00: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
3a10: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31  r0..----..121..1
3a20: 37 36 0d 0a 35 37 0d 0a 0d 0a 73 6b 69 70 69 66  76..57....skipif
3a30: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
3a40: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
3a50: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
3a60: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
3a70: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
3a80: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
3a90: 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 28 20 2d  NCT - col0 * ( -
3aa0: 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 2b 20 63   cor0.col2 ) + c
3ab0: 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol2 col1 FROM ta
3ac0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
3ad0: 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d  ..36..7380..825.
3ae0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
3af0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
3b00: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
3b10: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
3b20: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
3b30: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
3b40: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
3b50: 6f 6c 30 20 2a 20 33 30 20 63 6f 6c 32 20 46 52  ol0 * 30 col2 FR
3b60: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
3b70: 2d 2d 0d 0a 2d 31 30 35 30 0d 0a 2d 32 36 37 30  --..-1050..-2670
3b80: 0d 0a 2d 37 32 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-720....query 
3b90: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
3ba0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 31  T ALL + col0 + 1
3bb0: 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  1 * col2 FROM ta
3bc0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
3bd0: 0d 0a 31 31 33 36 0d 0a 35 39 37 0d 0a 36 39 31  ..1136..597..691
3be0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
3bf0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
3c00: 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 35 31 20 46  l0 * col2 + 51 F
3c10: 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
3c20: 2d 2d 2d 0d 0a 2d 31 33 38 0d 0a 2d 31 39 37 37  ---..-138..-1977
3c30: 0d 0a 2d 32 39 35 31 0d 0a 0d 0a 71 75 65 72 79  ..-2951....query
3c40: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
3c50: 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  CT - - col0 + - 
3c60: 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 41 53  col1 * + col0 AS
3c70: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
3c80: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
3c90: 32 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d 38 30  2040..-3360..-80
3ca0: 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  10....onlyif mys
3cb0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
3cc0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
3cd0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
3ce0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
3cf0: 6c 2d 31 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c  l-102..SELECT AL
3d00: 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49  L + cor0.col0 DI
3d10: 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  V col1 AS col1 F
3d20: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
3d30: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d  ..----..0..1..4.
3d40: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
3d50: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
3d60: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
3d70: 74 20 6c 61 62 65 6c 2d 31 30 32 0d 0a 53 45 4c  t label-102..SEL
3d80: 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
3d90: 6f 6c 30 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 / col1 AS co
3da0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
3db0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
3dc0: 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..4....query I r
3dd0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
3de0: 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20 33 32 20 41  LL col0 * + 32 A
3df0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
3e00: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
3e10: 31 31 32 30 0d 0a 32 38 34 38 0d 0a 37 36 38 0d  1120..2848..768.
3e20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
3e30: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
3e40: 20 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c   col2 * cor0.col
3e50: 31 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  1 + + col2 * col
3e60: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
3e70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 31 32 0d  or0..----..1512.
3e80: 0a 32 36 37 39 0d 0a 37 39 36 38 0d 0a 0d 0a 71  .2679..7968....q
3e90: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
3ea0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
3eb0: 2b 20 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 41  + - ( + col0 ) A
3ec0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
3ed0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d   cor0..----..-3.
3ee0: 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65  .-64..-80....que
3ef0: 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
3f00: 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
3f10: 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 41  CT * FROM tab2 A
3f20: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
3f30: 4e 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  N tab0, tab1 AS 
3f40: 63 6f 72 31 2c 20 74 61 62 31 2c 20 74 61 62 31  cor1, tab1, tab1
3f50: 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a   AS cor2..----..
3f60: 33 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68  3645 values hash
3f70: 69 6e 67 20 74 6f 20 39 33 65 35 62 38 33 36 65  ing to 93e5b836e
3f80: 33 66 35 32 66 34 35 38 33 34 34 65 37 33 65 62  3f52f458344e73eb
3f90: 63 65 35 38 39 62 35 0d 0a 0d 0a 71 75 65 72 79  ce589b5....query
3fa0: 20 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f   IIIIIIIII rowso
3fb0: 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f  rt..SELECT * FRO
3fc0: 4d 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53  M tab1 cor0 CROS
3fd0: 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74 61 62  S JOIN tab2, tab
3fe0: 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  1 AS cor1..----.
3ff0: 0a 32 34 33 20 76 61 6c 75 65 73 20 68 61 73 68  .243 values hash
4000: 69 6e 67 20 74 6f 20 34 66 65 34 37 38 30 65 34  ing to 4fe4780e4
4010: 39 65 36 31 32 62 39 33 39 35 37 66 35 37 35 64  9e612b93957f575d
4020: 39 62 33 65 38 39 66 0d 0a 0d 0a 6f 6e 6c 79 69  9b3e89f....onlyi
4030: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
4040: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
4050: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
4060: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
4070: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
4080: 62 65 6c 2d 31 30 38 0d 0a 53 45 4c 45 43 54 20  bel-108..SELECT 
4090: 41 4c 4c 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c  ALL + CAST( NULL
40a0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f   AS SIGNED ) FRO
40b0: 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  M tab2, tab1 AS 
40c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
40d0: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
40e0: 63 64 37 61 37 39 30 31 65 34 37 63 31 35 31 35  cd7a7901e47c1515
40f0: 35 34 30 34 61 66 66 30 64 32 31 36 66 65 30 62  5404aff0d216fe0b
4100: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
4110: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
4120: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
4130: 72 74 20 6c 61 62 65 6c 2d 31 30 38 0d 0a 53 45  rt label-108..SE
4140: 4c 45 43 54 20 41 4c 4c 20 2b 20 43 41 53 54 20  LECT ALL + CAST 
4150: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
4160: 52 20 29 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  R ) FROM tab2, t
4170: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
4180: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
4190: 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65  ing to cd7a7901e
41a0: 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64  47c15155404aff0d
41b0: 32 31 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72 79  216fe0b....query
41c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
41d0: 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20  CT ALL - + col1 
41e0: 2a 20 31 30 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  * 10 - col0 FROM
41f0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
4200: 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 32 31 30 0d  ---..-164..-210.
4210: 0a 2d 32 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-263....skipif 
4220: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
4230: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
4240: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
4250: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
4260: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4270: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 34 20 2a  t..SELECT - 34 *
4280: 20 33 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   30 col0 FROM ta
4290: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
42a0: 0d 0a 2d 31 30 32 30 0d 0a 2d 31 30 32 30 0d 0a  ..-1020..-1020..
42b0: 2d 31 30 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -1020....query I
42c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
42d0: 20 41 4c 4c 20 39 39 20 2b 20 63 6f 6c 32 20 41   ALL 99 + col2 A
42e0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
42f0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
4300: 31 32 35 0d 0a 31 32 36 0d 0a 31 33 37 0d 0a 0d  125..126..137...
4310: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
4320: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
4330: 54 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  T col0 + cor0.co
4340: 6c 30 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  l0 - + col2 * - 
4350: 28 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  ( col2 + + col1 
4360: 2a 20 2d 20 63 6f 6c 32 20 29 20 41 53 20 63 6f  * - col2 ) AS co
4370: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
4380: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d  cor0..----..-26.
4390: 0a 2d 36 30 34 39 38 32 0d 0a 2d 39 32 35 31 37  .-604982..-92517
43a0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
43b0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 38 35  ort..SELECT - 85
43c0: 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46   + - cor0.col2 F
43d0: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
43e0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 39 0d 0a 2d 31  ..----..-139..-1
43f0: 34 32 0d 0a 2d 31 38 31 0d 0a 0d 0a 71 75 65 72  42..-181....quer
4400: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4410: 45 43 54 20 41 4c 4c 20 2d 20 2d 20 33 32 20 2b  ECT ALL - - 32 +
4420: 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 46   col1 * + col0 F
4430: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4440: 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 36 0d 0a 33 34  ..----..2096..34
4450: 32 37 0d 0a 38 31 33 31 0d 0a 0d 0a 71 75 65 72  27..8131....quer
4460: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4470: 45 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2d  ECT DISTINCT ( -
4480: 20 38 20 29 20 2a 20 2d 20 63 6f 6c 31 20 2b 20   8 ) * - col1 + 
4490: 28 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20  ( - cor0.col2 ) 
44a0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
44b0: 2d 2d 2d 2d 0d 0a 36 34 36 0d 0a 36 35 35 0d 0a  ----..646..655..
44c0: 37 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  775....query I r
44d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
44e0: 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 32  ol0 + col1 * + 2
44f0: 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  3 AS col0 FROM t
4500: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 33 35 0d  ab2..----..1435.
4510: 0a 34 37 30 0d 0a 37 32 30 0d 0a 0d 0a 71 75 65  .470..720....que
4520: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
4530: 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 28 20  LECT - col0 * ( 
4540: 2b 20 28 20 74 61 62 30 2e 63 6f 6c 31 20 29 20  + ( tab0.col1 ) 
4550: 29 20 2b 20 34 31 20 41 53 20 63 6f 6c 32 20 46  ) + 41 AS col2 F
4560: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
4570: 2d 32 30 32 33 0d 0a 2d 33 33 35 34 0d 0a 2d 38  -2023..-3354..-8
4580: 30 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  058....query I r
4590: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
45a0: 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d  ISTINCT col2 * -
45b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
45c0: 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36  .----..-1534..-6
45d0: 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72  46..-837....quer
45e0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
45f0: 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  ECT + col1 * col
4600: 30 20 2a 20 2b 20 63 6f 6c 32 20 2d 20 2b 20 63  0 * + col2 - + c
4610: 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f  ol1 * + col1 FRO
4620: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  M tab0..----..-6
4630: 30 31 34 0d 0a 36 30 37 31 36 0d 0a 36 35 35 38  014..60716..6558
4640: 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
4650: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
4660: 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  L + - cor0.col0 
4670: 2a 20 36 36 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 66 AS col1 FRO
4680: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
4690: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 20 41  ROSS JOIN tab2 A
46a0: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor1..----..9 
46b0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
46c0: 6f 20 36 65 37 39 61 65 35 34 34 65 30 63 37 31  o 6e79ae544e0c71
46d0: 61 64 66 63 31 33 30 66 38 36 37 39 33 33 35 36  adfc130f86793356
46e0: 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  93....query I ro
46f0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
4700: 4c 20 39 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  L 94 AS col1 FRO
4710: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34  M tab0..----..94
4720: 0d 0a 39 34 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72  ..94..94....quer
4730: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
4740: 45 43 54 20 2b 20 34 32 20 2b 20 2d 20 63 6f 6c  ECT + 42 + - col
4750: 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  0 * - col0 FROM 
4760: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 37  tab0..----..1267
4770: 0d 0a 36 31 38 0d 0a 37 39 36 33 0d 0a 0d 0a 71  ..618..7963....q
4780: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
4790: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
47a0: 2b 20 37 35 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  + 75 * cor0.col0
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 31 38 30 30 0d 0a  r0..----..1800..
47d0: 32 36 32 35 0d 0a 36 36 37 35 0d 0a 0d 0a 73 6b  2625..6675....sk
47e0: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
47f0: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
4800: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
4810: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
4820: 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
4830: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
4840: 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  LL + cor0.col0 +
4850: 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20   col2 col2 FROM 
4860: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
4870: 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a  .171..36..57....
4880: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4890: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
48a0: 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 33 20 2b 20   - col1 * + 3 + 
48b0: 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col2 * - col2 + 
48c0: 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
48d0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
48e0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 39 31  or0..----..-2991
48f0: 0d 0a 2d 33 32 31 35 0d 0a 2d 39 31 37 35 0d 0a  ..-3215..-9175..
4900: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4910: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
4920: 43 54 20 2d 20 2b 20 38 38 20 2a 20 63 6f 6c 32  CT - + 88 * col2
4930: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
4940: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
4950: 0d 0a 2d 32 32 38 38 0d 0a 2d 32 33 37 36 0d 0a  ..-2288..-2376..
4960: 2d 33 33 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49  -3344....query I
4970: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4980: 20 2d 20 2d 20 28 20 63 6f 6c 30 20 29 20 41 53   - - ( col0 ) AS
4990: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
49a0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37  AS cor0..----..7
49b0: 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72  ..78..79....quer
49c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
49d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 39 20  ECT DISTINCT 49 
49e0: 2b 20 39 38 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 98 AS col1 FRO
49f0: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
4a00: 2d 2d 2d 2d 0d 0a 31 34 37 0d 0a 0d 0a 6f 6e 6c  ----..147....onl
4a10: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
4a20: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
4a30: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
4a40: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
4a50: 72 74 20 6c 61 62 65 6c 2d 31 32 39 0d 0a 53 45  rt label-129..SE
4a60: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
4a70: 43 41 53 54 28 20 63 6f 6c 31 20 41 53 20 53 49  CAST( col1 AS SI
4a80: 47 4e 45 44 20 29 20 44 49 56 20 2d 20 63 6f 6c  GNED ) DIV - col
4a90: 30 20 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20  0 - + col1 col0 
4aa0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
4ab0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 39 0d 0a 2d 39  0..----..-89..-9
4ac0: 32 0d 0a 2d 39 39 0d 0a 0d 0a 73 6b 69 70 69 66  2..-99....skipif
4ad0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
4ae0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
4af0: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
4b00: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
4b10: 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
4b20: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
4b30: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4b40: 74 20 6c 61 62 65 6c 2d 31 32 39 0d 0a 53 45 4c  t label-129..SEL
4b50: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43  ECT DISTINCT + C
4b60: 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 49 4e  AST ( col1 AS IN
4b70: 54 45 47 45 52 20 29 20 2f 20 2d 20 63 6f 6c 30  TEGER ) / - col0
4b80: 20 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46   - + col1 col0 F
4b90: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
4ba0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 39 0d 0a 2d 39 32  ..----..-89..-92
4bb0: 0d 0a 2d 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-99....skipif 
4bc0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
4bd0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
4be0: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
4bf0: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
4c00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4c10: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32 32 20 63  t..SELECT - 22 c
4c20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
4c30: 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
4c40: 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor1..----..9
4c50: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
4c60: 74 6f 20 66 61 65 34 36 66 38 31 34 38 62 30 32  to fae46f8148b02
4c70: 39 36 34 66 37 31 34 35 65 62 36 65 64 35 38 31  964f7145eb6ed581
4c80: 39 66 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  9f9....query I r
4c90: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
4ca0: 20 34 20 2b 20 74 61 62 32 2e 63 6f 6c 31 20 2a   4 + tab2.col1 *
4cb0: 20 39 31 20 2a 20 63 6f 6c 30 20 2d 20 2b 20 63   91 * col0 - + c
4cc0: 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
4cd0: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32   tab2..----..122
4ce0: 31 33 38 0d 0a 31 39 37 34 34 0d 0a 34 31 38 37  138..19744..4187
4cf0: 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  08....onlyif mys
4d00: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
4d10: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
4d20: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
4d30: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4d40: 6c 2d 31 33 32 0d 0a 53 45 4c 45 43 54 20 63 6f  l-132..SELECT co
4d50: 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30  r0.col2 + + col0
4d60: 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   DIV - col0 FROM
4d70: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
4d80: 2d 2d 2d 0d 0a 32 35 0d 0a 32 36 0d 0a 33 37 0d  ---..25..26..37.
4d90: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
4da0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
4db0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
4dc0: 74 20 6c 61 62 65 6c 2d 31 33 32 0d 0a 53 45 4c  t label-132..SEL
4dd0: 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20  ECT cor0.col2 + 
4de0: 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20  + col0 / - col0 
4df0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
4e00: 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 32 36 0d  0..----..25..26.
4e10: 0a 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .37....query I r
4e20: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
4e30: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
4e40: 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
4e50: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
4e60: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
4e70: 74 6f 20 37 62 35 39 33 38 31 32 34 32 35 33 37  to 7b59381242537
4e80: 39 38 34 32 36 66 62 66 30 39 63 31 38 65 31 66  98426fbf09c18e1f
4e90: 64 37 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  d75....skipif po
4ea0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
4eb0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
4ec0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
4ed0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
4ee0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
4ef0: 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30  .SELECT - - cor0
4f00: 2e 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 63 6f 6c  .col2 + col2 col
4f10: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
4f20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a  or0..----..164..
4f30: 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  2..66....query I
4f40: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
4f50: 20 41 4c 4c 20 2d 20 2b 20 36 35 20 46 52 4f 4d   ALL - + 65 FROM
4f60: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
4f70: 2d 2d 2d 0d 0a 2d 36 35 0d 0a 2d 36 35 0d 0a 2d  ---..-65..-65..-
4f80: 36 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  65....onlyif mys
4f90: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
4fa0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
4fb0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
4fc0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
4fd0: 6c 2d 31 33 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-136..SELECT AL
4fe0: 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f 72  L + col0 DIV cor
4ff0: 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  0.col1 FROM tab0
5000: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5010: 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
5020: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
5030: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
5040: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
5050: 31 33 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  136..SELECT ALL 
5060: 2b 20 63 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f  + col0 / cor0.co
5070: 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
5080: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
5090: 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..0....skipif po
50a0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
50b0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
50c0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
50d0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
50e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
50f0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
5100: 20 32 37 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63   27 * col2 + + c
5110: 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 31 20  ol2 * col0 col1 
5120: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
5130: 0a 31 36 38 33 0d 0a 36 32 0d 0a 39 35 31 32 0d  .1683..62..9512.
5140: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5150: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
5160: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 46   col0 + + col1 F
5170: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
5180: 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 36  ..----..2..62..6
5190: 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
51a0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
51b0: 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d  TINCT - col1 + -
51c0: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
51d0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
51e0: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d  0..----..-119..-
51f0: 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72  173..-98....quer
5200: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5210: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2d  ECT DISTINCT - -
5220: 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
5230: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
5240: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 34 0d  or0..----..1444.
5250: 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71 75 65  .676..729....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 63 6f 6c 32 20 2a 20 2d 20 38 33  LECT col2 * - 83
5280: 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
5290: 0d 0a 2d 32 37 33 39 0d 0a 2d 36 38 30 36 0d 0a  ..-2739..-6806..
52a0: 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -83....query I r
52b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
52c0: 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 2b  ISTINCT col0 * +
52d0: 20 37 33 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   73 FROM tab2..-
52e0: 2d 2d 2d 0d 0a 35 31 31 0d 0a 35 36 39 34 0d 0a  ---..511..5694..
52f0: 35 37 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5767....query I 
5300: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5310: 41 4c 4c 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2d  ALL + - col2 + -
5320: 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63   ( - col1 ) AS c
5330: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
5340: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31   cor0..----..-21
5350: 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 6f 6e 6c 79 69  ..33..4....onlyi
5360: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
5370: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
5380: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
5390: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
53a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
53b0: 62 65 6c 2d 31 34 34 0d 0a 53 45 4c 45 43 54 20  bel-144..SELECT 
53c0: 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53  + - col2 * + CAS
53d0: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
53e0: 44 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  D ) FROM tab2 AS
53f0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
5400: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
5410: 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
5420: 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
5430: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
5440: 6c 61 62 65 6c 2d 31 34 34 0d 0a 53 45 4c 45 43  label-144..SELEC
5450: 54 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43  T + - col2 * + C
5460: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
5470: 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
5480: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
5490: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
54a0: 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
54b0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
54c0: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a   + col2 * col2 *
54d0: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
54e0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
54f0: 0a 36 31 31 38 38 34 0d 0a 39 33 36 35 34 0d 0a  .611884..93654..
5500: 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
5510: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
5520: 2b 20 32 36 20 2a 20 2b 20 63 6f 6c 31 20 46 52  + 26 * + col1 FR
5530: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
5540: 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 34 34 32  .----..1534..442
5550: 0d 0a 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..806....query I
5560: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5570: 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30   + + col0 * col0
5580: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
5590: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a  r0..----..1225..
55a0: 35 37 36 0d 0a 37 39 32 31 0d 0a 0d 0a 71 75 65  576..7921....que
55b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
55c0: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  LECT + col2 + co
55d0: 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63 6f 6c 31  l1 * col1 + col1
55e0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
55f0: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
5600: 0d 0a 31 30 31 39 0d 0a 33 34 34 0d 0a 33 35 36  ..1019..344..356
5610: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
5620: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
5630: 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  0 + - cor0.col0 
5640: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  + col2 FROM tab2
5650: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
5660: 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a 0d 0a 71 75  26..27..38....qu
5670: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5680: 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  ELECT + cor0.col
5690: 31 20 2a 20 2b 20 37 30 20 41 53 20 63 6f 6c 32  1 * + 70 AS col2
56a0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
56b0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 32 30 0d 0a  r0..----..1820..
56c0: 37 30 30 0d 0a 39 31 30 0d 0a 0d 0a 71 75 65 72  700..910....quer
56d0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
56e0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
56f0: 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62   col2 ) FROM tab
5700: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  2..----..-26..-2
5710: 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20  7..-38....query 
5720: 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f 77  IIIIIIIIIIII row
5730: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46  sort..SELECT * F
5740: 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41  ROM tab2, tab0 A
5750: 53 20 63 6f 72 30 2c 20 74 61 62 30 2c 20 74 61  S cor0, tab0, ta
5760: 62 31 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39  b1 cor1..----..9
5770: 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  72 values hashin
5780: 67 20 74 6f 20 35 36 32 31 36 37 35 62 31 62 64  g to 5621675b1bd
5790: 33 32 62 30 36 31 64 32 38 34 64 30 34 34 34 63  32b061d284d0444c
57a0: 37 36 36 30 31 0d 0a 0d 0a 71 75 65 72 79 20 49  76601....query I
57b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
57c0: 20 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52   + ( - col2 ) FR
57d0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
57e0: 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d  .----..-54..-57.
57f0: 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-96....query I 
5800: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
5810: 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col0 * - col1 FR
5820: 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
5830: 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35  --..-2064..-3395
5840: 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  ..-8099....query
5850: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5860: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
5870: 72 32 2e 63 6f 6c 31 20 2a 20 31 32 20 46 52 4f  r2.col1 * 12 FRO
5880: 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
5890: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31 2c  0, tab0 AS cor1,
58a0: 20 74 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d   tab2 AS cor2..-
58b0: 2d 2d 2d 0d 0a 2d 32 30 34 0d 0a 2d 33 37 32 0d  ---..-204..-372.
58c0: 0a 2d 37 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-708....query I
58d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
58e0: 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 72 30   + - col2 * cor0
58f0: 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46  .col0 + + col2 F
5900: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
5910: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 32  ..----..-162..-2
5920: 30 30 32 0d 0a 2d 32 39 36 34 0d 0a 0d 0a 71 75  002..-2964....qu
5930: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5940: 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d  ELECT + col1 + -
5950: 20 35 39 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   59 AS col2 FROM
5960: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 0d   tab0..----..27.
5970: 0a 33 32 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79  .32..38....query
5980: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5990: 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f  CT - col1 * - co
59a0: 6c 30 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c  l0 + col2 AS col
59b0: 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
59c0: 2d 0d 0a 31 31 33 36 0d 0a 31 33 32 0d 0a 36 39  -..1136..132..69
59d0: 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
59e0: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
59f0: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
5a00: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
5a10: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
5a20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5a30: 45 4c 45 43 54 20 39 33 20 2a 20 2b 20 63 6f 6c  ELECT 93 * + col
5a40: 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  0 + col2 * col0 
5a50: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
5a60: 2d 2d 2d 2d 0d 0a 31 35 35 37 35 0d 0a 33 30 32  ----..15575..302
5a70: 34 0d 0a 33 32 39 30 0d 0a 0d 0a 71 75 65 72 79  4..3290....query
5a80: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
5a90: 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  CT - col0 * col1
5aa0: 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   * + col1 FROM t
5ab0: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35 32  ab1..----..-1352
5ac0: 30 0d 0a 2d 32 30 32 38 0d 0a 2d 36 34 30 30 0d  0..-2028..-6400.
5ad0: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
5ae0: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
5af0: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
5b00: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
5b10: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
5b20: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
5b30: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
5b40: 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31   col1 ) * - col1
5b50: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
5b60: 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33 34 38 31  .----..289..3481
5b70: 0d 0a 39 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..961....query I
5b80: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
5b90: 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72 30   + + col1 * cor0
5ba0: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20  .col0 FROM tab0 
5bb0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
5bc0: 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
5bd0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5be0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
5bf0: 20 63 6f 6c 32 20 29 20 2a 20 63 6f 6c 30 20 2b   col2 ) * col0 +
5c00: 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
5c10: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
5c20: 0a 31 38 38 0d 0a 33 36 35 38 0d 0a 37 36 39 33  .188..3658..7693
5c30: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5c40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5c50: 49 4e 43 54 20 2d 20 28 20 63 6f 72 30 2e 63 6f  INCT - ( cor0.co
5c60: 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
5c70: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
5c80: 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39  -..-17..-31..-59
5c90: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
5ca0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
5cb0: 49 4e 43 54 20 38 36 20 46 52 4f 4d 20 74 61 62  INCT 86 FROM tab
5cc0: 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 0d 0a 71  0..----..86....q
5cd0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5ce0: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 28  SELECT ALL - + (
5cf0: 20 63 6f 6c 32 20 29 20 2a 20 2b 20 34 36 20 46   col2 ) * + 46 F
5d00: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
5d10: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 38 34 0d 0a 2d  ..----..-2484..-
5d20: 32 36 32 32 0d 0a 2d 34 34 31 36 0d 0a 0d 0a 71  2622..-4416....q
5d30: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
5d40: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 31 20 41  SELECT ALL + 1 A
5d50: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
5d60: 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  , tab0 AS cor0..
5d70: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
5d80: 61 73 68 69 6e 67 20 74 6f 20 30 30 31 35 35 34  ashing to 001554
5d90: 63 32 39 35 32 66 31 61 38 30 35 30 36 62 31 38  c2952f1a80506b18
5da0: 32 65 65 30 34 36 38 36 66 35 0d 0a 0d 0a 71 75  2ee04686f5....qu
5db0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
5dc0: 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 31 2e 63  ELECT ALL tab1.c
5dd0: 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
5de0: 20 74 61 62 31 2c 20 74 61 62 31 20 41 53 20 63   tab1, tab1 AS c
5df0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
5e00: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
5e10: 30 63 61 30 61 31 63 63 33 33 37 61 37 37 31 34  0ca0a1cc337a7714
5e20: 61 38 39 39 30 61 37 36 34 63 66 64 62 31 37 0d  a8990a764cfdb17.
5e30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
5e40: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
5e50: 32 20 2b 20 2d 20 39 38 20 2d 20 2b 20 63 6f 6c  2 + - 98 - + col
5e60: 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  1 * col0 AS col2
5e70: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
5e80: 0d 0a 2d 31 30 34 32 0d 0a 2d 31 32 32 0d 0a 2d  ..-1042..-122..-
5e90: 36 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  681....query I r
5ea0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33  owsort..SELECT 3
5eb0: 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  1 + + col2 FROM 
5ec0: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 35 37 0d 0a  tab2..----..57..
5ed0: 35 38 0d 0a 36 39 0d 0a 0d 0a 73 6b 69 70 69 66  58..69....skipif
5ee0: 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
5ef0: 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
5f00: 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
5f10: 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
5f20: 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
5f30: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 38  rt..SELECT - - 8
5f40: 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  2 col2 FROM tab0
5f50: 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20  , tab2, tab1 AS 
5f60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor0..----..27 v
5f70: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
5f80: 20 39 39 39 32 30 64 39 66 37 63 64 39 63 64 63   99920d9f7cd9cdc
5f90: 63 65 66 39 39 63 66 61 34 35 39 61 65 36 39 34  cef99cfa459ae694
5fa0: 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
5fb0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
5fc0: 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 2d   - tab0.col2 * -
5fd0: 20 35 37 20 46 52 4f 4d 20 74 61 62 30 2c 20 74   57 FROM tab0, t
5fe0: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
5ff0: 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
6000: 69 6e 67 20 74 6f 20 31 64 36 33 30 36 66 32 31  ing to 1d6306f21
6010: 36 63 37 35 39 36 39 32 63 64 39 61 35 30 39 36  6c759692cd9a5096
6020: 36 61 65 33 33 34 30 0d 0a 0d 0a 71 75 65 72 79  6ae3340....query
6030: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6040: 43 54 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 30  CT - col2 + col0
6050: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
6060: 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d  .----..-16..-51.
6070: 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  .7....skipif pos
6080: 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
6090: 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
60a0: 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
60b0: 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
60c0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
60d0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
60e0: 2d 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 63 6f  - tab1.col0 * co
60f0: 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  l2 * - col2 + + 
6100: 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col2 col0 FROM t
6110: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 39  ab1..----..20799
6120: 33 0d 0a 37 33 37 33 37 36 0d 0a 38 38 30 32 0d  3..737376..8802.
6130: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6140: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
6150: 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 63  ol0 + - col2 * c
6160: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
6170: 2d 2d 2d 0d 0a 2d 32 39 31 33 0d 0a 2d 33 31 38  ---..-2913..-318
6180: 35 0d 0a 2d 39 31 33 36 0d 0a 0d 0a 71 75 65 72  5..-9136....quer
6190: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
61a0: 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 72  ECT + col1 * cor
61b0: 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20  0.col1 + - col1 
61c0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
61d0: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  2 cor0..----..27
61e0: 32 0d 0a 33 34 32 32 0d 0a 39 33 30 0d 0a 0d 0a  2..3422..930....
61f0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
6200: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
6210: 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 74 61 62 30   - col1 * - tab0
6220: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52  .col2 AS col2 FR
6230: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
6240: 38 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d  838..7462..97...
6250: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
6260: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
6270: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
6280: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
6290: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 37 38  owsort label-178
62a0: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
62b0: 63 6f 6c 32 20 44 49 56 20 28 20 2b 20 31 30 20  col2 DIV ( + 10 
62c0: 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  ) FROM tab2 cor0
62d0: 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 32 0d 0a 33 0d  ..----..2..2..3.
62e0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
62f0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
6300: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6310: 74 20 6c 61 62 65 6c 2d 31 37 38 0d 0a 53 45 4c  t label-178..SEL
6320: 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
6330: 2f 20 28 20 2b 20 31 30 20 29 20 46 52 4f 4d 20  / ( + 10 ) FROM 
6340: 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
6350: 0a 32 0d 0a 32 0d 0a 33 0d 0a 0d 0a 71 75 65 72  .2..2..3....quer
6360: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6370: 45 43 54 20 41 4c 4c 20 36 30 20 41 53 20 63 6f  ECT ALL 60 AS co
6380: 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
6390: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
63a0: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
63b0: 6e 67 20 74 6f 20 61 39 37 35 36 31 65 31 37 65  ng to a97561e17e
63c0: 63 61 61 36 31 38 32 32 37 63 37 35 61 35 37 62  caa618227c75a57b
63d0: 32 36 38 66 33 33 0d 0a 0d 0a 71 75 65 72 79 20  268f33....query 
63e0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
63f0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
6400: 32 20 2a 20 28 20 35 37 20 29 20 41 53 20 63 6f  2 * ( 57 ) AS co
6410: 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
6420: 2d 2d 0d 0a 2d 31 38 38 31 0d 0a 2d 34 36 37 34  --..-1881..-4674
6430: 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-57....query I
6440: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6450: 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 28 20 2b 20   + col0 + + ( + 
6460: 32 35 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53  25 ) * + col0 AS
6470: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
6480: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
6490: 33 31 34 0d 0a 36 32 34 0d 0a 39 31 30 0d 0a 0d  314..624..910...
64a0: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
64b0: 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
64c0: 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
64d0: 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
64e0: 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
64f0: 6f 72 74 20 6c 61 62 65 6c 2d 31 38 32 0d 0a 53  ort label-182..S
6500: 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a  ELECT + + col0 *
6510: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b   + cor0.col2 * +
6520: 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54 28 20   col1 + - CAST( 
6530: 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
6540: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
6550: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
6560: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
6570: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
6580: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
6590: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
65a0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 38 32 0d  wsort label-182.
65b0: 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 30  .SELECT + + col0
65c0: 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   * + cor0.col2 *
65d0: 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 43 41 53 54   + col1 + - CAST
65e0: 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
65f0: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
6600: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
6610: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
6620: 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ULL....onlyif my
6630: 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
6640: 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
6650: 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
6660: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
6670: 65 6c 2d 31 38 33 0d 0a 53 45 4c 45 43 54 20 2b  el-183..SELECT +
6680: 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 44   col2 * + col0 D
6690: 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b  IV - cor0.col0 +
66a0: 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c   col0 * cor0.col
66b0: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
66c0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 35  or0..----..24..5
66d0: 38 33 0d 0a 39 34 34 0d 0a 0d 0a 73 6b 69 70 69  83..944....skipi
66e0: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
66f0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
6700: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
6710: 31 38 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  183..SELECT + co
6720: 6c 32 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 2d 20  l2 * + col0 / - 
6730: 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 30  cor0.col0 + col0
6740: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f   * cor0.col1 FRO
6750: 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
6760: 2d 2d 2d 2d 0d 0a 32 34 0d 0a 35 38 33 0d 0a 39  ----..24..583..9
6770: 34 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  44....onlyif mys
6780: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
6790: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
67a0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
67b0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
67c0: 6c 2d 31 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20  l-184..SELECT - 
67d0: 63 6f 6c 32 20 44 49 56 20 2b 20 63 6f 6c 30 20  col2 DIV + col0 
67e0: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
67f0: 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69  .-1..0..0....ski
6800: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
6810: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
6820: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
6830: 6c 2d 31 38 34 0d 0a 53 45 4c 45 43 54 20 2d 20  l-184..SELECT - 
6840: 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 30 20 46 52  col2 / + col0 FR
6850: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab0..----..-
6860: 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  1..0..0....query
6870: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
6880: 43 54 20 2d 20 30 20 2d 20 2b 20 63 6f 6c 31 20  CT - 0 - + col1 
6890: 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  * col1 FROM tab0
68a0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
68b0: 2d 37 33 39 36 0d 0a 2d 38 32 38 31 0d 0a 2d 39  -7396..-8281..-9
68c0: 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  409....query I r
68d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
68e0: 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 30  LL col0 + + col0
68f0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
6900: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
6910: 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d  ..178..48..70...
6920: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6930: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
6940: 20 2b 20 31 33 20 29 20 46 52 4f 4d 20 74 61 62   + 13 ) FROM tab
6950: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
6960: 0a 2d 31 33 0d 0a 2d 31 33 0d 0a 2d 31 33 0d 0a  .-13..-13..-13..
6970: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
6980: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
6990: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
69a0: 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
69b0: 28 20 32 33 20 41 53 20 52 45 41 4c 20 29 20 2b  ( 23 AS REAL ) +
69c0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
69d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
69e0: 36 0d 0a 33 36 0d 0a 38 0d 0a 0d 0a 71 75 65 72  6..36..8....quer
69f0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6a00: 45 43 54 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  ECT col2 + cor0.
6a10: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
6a20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
6a30: 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75  4..117..34....qu
6a40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6a50: 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 63 6f 6c  ELECT col2 - col
6a60: 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  1 * col0 FROM ta
6a70: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
6a80: 0d 0a 2d 32 30 33 31 0d 0a 2d 33 33 39 34 0d 0a  ..-2031..-3394..
6a90: 2d 38 30 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -8017....query I
6aa0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
6ab0: 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f   + + col0 + + co
6ac0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
6ad0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d  cor0..----..104.
6ae0: 0a 31 31 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72  .117..34....quer
6af0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
6b00: 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c  ECT + col0 + col
6b10: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
6b20: 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d  -..121..176..57.
6b30: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6b40: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
6b50: 4e 43 54 20 37 32 20 2a 20 2b 20 37 20 46 52 4f  NCT 72 * + 7 FRO
6b60: 4d 20 74 61 62 30 20 63 6f 72 30 20 43 52 4f 53  M tab0 cor0 CROS
6b70: 53 20 4a 4f 49 4e 20 74 61 62 32 20 41 53 20 63  S JOIN tab2 AS c
6b80: 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 35 30 34 0d 0a  or1..----..504..
6b90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
6ba0: 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
6bb0: 43 54 20 63 6f 6c 30 20 2a 20 38 38 20 2d 20 63  CT col0 * 88 - c
6bc0: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
6bd0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
6be0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 32 36 0d 0a  r0..----..2026..
6bf0: 32 39 38 33 0d 0a 37 37 34 31 0d 0a 0d 0a 71 75  2983..7741....qu
6c00: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6c10: 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b  ELECT ALL col0 +
6c20: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
6c30: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d  cor0..----..128.
6c40: 0a 31 36 30 0d 0a 36 0d 0a 0d 0a 6f 6e 6c 79 69  .160..6....onlyi
6c50: 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
6c60: 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
6c70: 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
6c80: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
6c90: 20 6c 61 62 65 6c 2d 31 39 36 0d 0a 53 45 4c 45   label-196..SELE
6ca0: 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20  CT DISTINCT + + 
6cb0: 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 44 49  col0 + + col2 DI
6cc0: 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  V - cor0.col2 FR
6cd0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
6ce0: 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 33 0d 0a 37 39  .----..2..63..79
6cf0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
6d00: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
6d10: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
6d20: 72 74 20 6c 61 62 65 6c 2d 31 39 36 0d 0a 53 45  rt label-196..SE
6d30: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
6d40: 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  + col0 + + col2 
6d50: 2f 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52  / - cor0.col2 FR
6d60: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
6d70: 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 33 0d 0a 37 39  .----..2..63..79
6d80: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
6d90: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
6da0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
6db0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
6dc0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
6dd0: 31 39 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  197..SELECT DIST
6de0: 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20  INCT - col1 + - 
6df0: 32 37 20 44 49 56 20 63 6f 6c 32 20 2d 20 2b 20  27 DIV col2 - + 
6e00: 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
6e10: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
6e20: 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 35 39  ----..-110..-159
6e30: 0d 0a 2d 31 38 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..-180....skipif
6e40: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
6e50: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
6e60: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
6e70: 39 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  97..SELECT DISTI
6e80: 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 32  NCT - col1 + - 2
6e90: 37 20 2f 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c  7 / col2 - + col
6ea0: 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
6eb0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
6ec0: 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 35 39 0d 0a 2d  -..-110..-159..-
6ed0: 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  180....query I r
6ee0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
6ef0: 20 63 6f 6c 32 20 2b 20 28 20 63 6f 6c 31 20 29   col2 + ( col1 )
6f00: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
6f10: 0d 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d  ..-28..-47..-83.
6f20: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
6f30: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
6f40: 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30  0 * col1 AS col0
6f50: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
6f60: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  r0..----..-1040.
6f70: 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  .-640..-78....qu
6f80: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
6f90: 45 4c 45 43 54 20 30 20 46 52 4f 4d 20 74 61 62  ELECT 0 FROM tab
6fa0: 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
6fb0: 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
6fc0: 68 61 73 68 69 6e 67 20 74 6f 20 38 62 37 35 31  hashing to 8b751
6fd0: 33 36 62 32 62 35 31 63 37 37 33 34 35 63 30 33  36b2b51c77345c03
6fe0: 38 30 34 65 63 31 63 64 61 35 63 0d 0a 0d 0a 71  804ec1cda5c....q
6ff0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7000: 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
7010: 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l1 + - cor0.col1
7020: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
7030: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
7040: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
7050: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
7060: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
7070: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
7080: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
7090: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 30  rowsort label-20
70a0: 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  2..SELECT ALL + 
70b0: 63 6f 6c 30 20 2b 20 43 41 53 54 28 20 4e 55 4c  col0 + CAST( NUL
70c0: 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  L AS SIGNED ) FR
70d0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
70e0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
70f0: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
7100: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
7110: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
7120: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
7130: 32 30 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  202..SELECT ALL 
7140: 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20  + col0 + CAST ( 
7150: 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
7160: 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
7170: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
7180: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
7190: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
71a0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
71b0: 63 6f 6c 31 20 2a 20 35 35 20 2b 20 63 6f 72 30  col1 * 55 + cor0
71c0: 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2b  .col1 + col2 * +
71d0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
71e0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
71f0: 0a 2d 2d 2d 2d 0d 0a 33 38 30 39 0d 0a 34 33 37  .----..3809..437
7200: 32 0d 0a 39 39 34 34 0d 0a 0d 0a 71 75 65 72 79  2..9944....query
7210: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7220: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
7230: 6c 32 20 2b 20 2d 20 36 36 20 41 53 20 63 6f 6c  l2 + - 66 AS col
7240: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
7250: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 30 0d  or0..----..-120.
7260: 0a 2d 31 32 33 0d 0a 2d 31 36 32 0d 0a 0d 0a 71  .-123..-162....q
7270: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
7280: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
7290: 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 28 20 63  + - col2 + + ( c
72a0: 6f 6c 32 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41  ol2 ) * - col2 A
72b0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
72c0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
72d0: 32 32 0d 0a 2d 32 0d 0a 2d 36 38 30 36 0d 0a 0d  22..-2..-6806...
72e0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
72f0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
7300: 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 30  ol1 * col2 + - 0
7310: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
7320: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a  r0..----..1248..
7330: 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71 75 65  1404..570....que
7340: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7350: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2d 20 2d 20  LECT - col2 - - 
7360: 39 37 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  97 * + col0 FROM
7370: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32 39   tab0..----..229
7380: 35 0d 0a 33 33 39 34 0d 0a 38 35 35 31 0d 0a 0d  5..3394..8551...
7390: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
73a0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 34 20  ..SELECT ALL 44 
73b0: 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20  * col0 + + col2 
73c0: 2a 20 2d 20 28 20 28 20 63 6f 6c 31 20 29 20 29  * - ( ( col1 ) )
73d0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
73e0: 0d 0a 2d 35 32 39 0d 0a 31 38 39 38 0d 0a 32 38  ..-529..1898..28
73f0: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
7400: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
7410: 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2d 20  STINCT col0 + - 
7420: 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
7430: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
7440: 2d 2d 2d 0d 0a 2d 32 38 31 34 0d 0a 2d 36 32 0d  ---..-2814..-62.
7450: 0a 2d 37 33 37 33 0d 0a 0d 0a 71 75 65 72 79 20  .-7373....query 
7460: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7470: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 31  T DISTINCT + + 1
7480: 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
7490: 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  2, tab0 AS cor0.
74a0: 0a 2d 2d 2d 2d 0d 0a 31 32 0d 0a 0d 0a 71 75 65  .----..12....que
74b0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
74c0: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 39 36  LECT col2 + + 96
74d0: 20 2a 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32   * + col1 * col2
74e0: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
74f0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7500: 0d 0a 32 37 32 34 38 31 0d 0a 37 31 36 34 33 34  ..272481..716434
7510: 0d 0a 39 33 31 33 0d 0a 0d 0a 71 75 65 72 79 20  ..9313....query 
7520: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
7530: 54 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20 2a  T ALL ( col1 ) *
7540: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
7550: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
7560: 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36  .----..2838..746
7570: 32 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..97....onlyif 
7580: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
7590: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
75a0: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
75b0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
75c0: 61 62 65 6c 2d 32 31 33 0d 0a 53 45 4c 45 43 54  abel-213..SELECT
75d0: 20 41 4c 4c 20 43 41 53 54 28 20 2b 20 63 6f 6c   ALL CAST( + col
75e0: 32 20 41 53 20 53 49 47 4e 45 44 20 29 20 44 49  2 AS SIGNED ) DI
75f0: 56 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  V + col0 FROM ta
7600: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
7610: 0d 0a 30 0d 0a 30 0d 0a 33 0d 0a 0d 0a 73 6b 69  ..0..0..3....ski
7620: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
7630: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
7640: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
7650: 6c 2d 32 31 33 0d 0a 53 45 4c 45 43 54 20 41 4c  l-213..SELECT AL
7660: 4c 20 43 41 53 54 20 28 20 2b 20 63 6f 6c 32 20  L CAST ( + col2 
7670: 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f 20 2b  AS INTEGER ) / +
7680: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
7690: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
76a0: 0d 0a 30 0d 0a 33 0d 0a 0d 0a 71 75 65 72 79 20  ..0..3....query 
76b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
76c0: 54 20 41 4c 4c 20 2d 20 63 6f 72 31 2e 63 6f 6c  T ALL - cor1.col
76d0: 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
76e0: 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 2c 20  ab0, tab0 cor0, 
76f0: 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61  tab2 AS cor1, ta
7700: 62 31 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d  b1 AS cor2..----
7710: 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73 68  ..81 values hash
7720: 69 6e 67 20 74 6f 20 61 64 61 65 61 33 38 65 61  ing to adaea38ea
7730: 65 30 33 32 63 31 36 33 39 37 31 35 66 32 31 38  e032c1639715f218
7740: 33 31 64 64 33 37 36 0d 0a 0d 0a 71 75 65 72 79  31dd376....query
7750: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7760: 43 54 20 63 6f 6c 31 20 2b 20 28 20 2b 20 63 6f  CT col1 + ( + co
7770: 6c 32 20 2b 20 2b 20 38 39 20 29 20 46 52 4f 4d  l2 + + 89 ) FROM
7780: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 37   tab0..----..187
7790: 0d 0a 32 30 38 0d 0a 32 36 32 0d 0a 0d 0a 71 75  ..208..262....qu
77a0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
77b0: 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  ELECT - tab2.col
77c0: 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  0 + col0 AS col0
77d0: 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
77e0: 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
77f0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7800: 4c 45 43 54 20 2d 20 36 36 20 2a 20 63 6f 6c 32  LECT - 66 * col2
7810: 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
7820: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  0 cor0..----..-2
7830: 33 31 30 0d 0a 2d 34 38 31 36 36 38 0d 0a 2d 35  310..-481668..-5
7840: 32 32 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2272....query I 
7850: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
7860: 2d 20 28 20 2b 20 63 6f 6c 30 20 29 20 2a 20 36  - ( + col0 ) * 6
7870: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
7880: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
7890: 2d 0d 0a 2d 31 38 36 0d 0a 2d 33 39 36 38 0d 0a  -..-186..-3968..
78a0: 2d 34 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -4960....query I
78b0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
78c0: 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b   DISTINCT col1 +
78d0: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
78e0: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
78f0: 2d 2d 2d 2d 0d 0a 32 0d 0a 36 32 0d 0a 0d 0a 6f  ----..2..62....o
7900: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
7910: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
7920: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
7930: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
7940: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 32 30 0d 0a  sort label-220..
7950: 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 44 49  SELECT + col1 DI
7960: 56 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 38 33 20  V + col2 + - 83 
7970: 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  * col0 AS col1 F
7980: 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
7990: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 39 0d 0a 2d 35  ..----..-249..-5
79a0: 33 31 32 0d 0a 2d 36 36 34 30 0d 0a 0d 0a 73 6b  312..-6640....sk
79b0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
79c0: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
79d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
79e0: 65 6c 2d 32 32 30 0d 0a 53 45 4c 45 43 54 20 2b  el-220..SELECT +
79f0: 20 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32 20 2b   col1 / + col2 +
7a00: 20 2d 20 38 33 20 2a 20 63 6f 6c 30 20 41 53 20   - 83 * col0 AS 
7a10: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
7a20: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
7a30: 34 39 0d 0a 2d 35 33 31 32 0d 0a 2d 36 36 34 30  49..-5312..-6640
7a40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
7a50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
7a60: 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2b  + ( - col0 ) * +
7a70: 20 28 20 2d 20 63 6f 6c 31 20 29 20 2d 20 63 6f   ( - col1 ) - co
7a80: 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d  l1 * + col1 FROM
7a90: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
7aa0: 2d 2d 2d 0d 0a 2d 35 39 38 0d 0a 35 34 30 0d 0a  ---..-598..540..
7ab0: 38 37 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  871....query I r
7ac0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
7ad0: 49 53 54 49 4e 43 54 20 38 20 2a 20 63 6f 6c 31  ISTINCT 8 * col1
7ae0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
7af0: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
7b00: 0d 0a 36 38 38 0d 0a 37 32 38 0d 0a 37 37 36 0d  ..688..728..776.
7b10: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7b20: 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 36 36 20  rt..SELECT - 66 
7b30: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
7b40: 2d 2d 2d 2d 0d 0a 2d 36 36 0d 0a 2d 36 36 0d 0a  ----..-66..-66..
7b50: 2d 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -66....query I r
7b60: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
7b70: 4c 4c 20 2d 20 32 31 20 46 52 4f 4d 20 74 61 62  LL - 21 FROM tab
7b80: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
7b90: 0a 2d 32 31 0d 0a 2d 32 31 0d 0a 2d 32 31 0d 0a  .-21..-21..-21..
7ba0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
7bb0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
7bc0: 33 37 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  37 * col0 FROM t
7bd0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
7be0: 2d 0d 0a 31 32 39 35 0d 0a 33 32 39 33 0d 0a 38  -..1295..3293..8
7bf0: 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  88....query I ro
7c00: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
7c10: 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  + col0 * - col1 
7c20: 2a 20 36 39 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 69 AS col2 FRO
7c30: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
7c40: 2d 2d 2d 2d 0d 0a 2d 31 34 32 34 31 36 0d 0a 2d  ----..-142416..-
7c50: 32 33 34 32 35 35 0d 0a 2d 35 35 38 38 33 31 0d  234255..-558831.
7c60: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7c70: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
7c80: 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  0.col0 * - col0 
7c90: 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
7ca0: 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37  ----..-1225..-57
7cb0: 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72  6..-7921....quer
7cc0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7cd0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 34  ECT DISTINCT + 4
7ce0: 30 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  0 * col1 AS col1
7cf0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
7d00: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 30 0d 0a  r0..----..1240..
7d10: 32 33 36 30 0d 0a 36 38 30 0d 0a 0d 0a 71 75 65  2360..680....que
7d20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
7d30: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
7d40: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col2 * + col2 * 
7d50: 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
7d60: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
7d70: 2d 2d 2d 2d 0d 0a 36 31 31 38 38 34 0d 0a 39 33  ----..611884..93
7d80: 36 35 34 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  654..97....query
7d90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7da0: 43 54 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  CT + col0 + - co
7db0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
7dc0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
7dd0: 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
7de0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
7df0: 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2b  LL col1 * col0 +
7e00: 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 46   - col2 + col1 F
7e10: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
7e20: 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31 37 0d 0a 33 34  ..----..2117..34
7e30: 39 31 0d 0a 38 31 30 38 0d 0a 0d 0a 71 75 65 72  91..8108....quer
7e40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
7e50: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 33  ECT DISTINCT + 3
7e60: 30 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  0 * col0 + - col
7e70: 30 20 2b 20 31 39 20 46 52 4f 4d 20 74 61 62 32  0 + 19 FROM tab2
7e80: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
7e90: 32 32 32 0d 0a 32 32 38 31 0d 0a 32 33 31 30 0d  222..2281..2310.
7ea0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7eb0: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
7ec0: 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 63   - cor0.col0 + c
7ed0: 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
7ee0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
7ef0: 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31  ---..110..132..1
7f00: 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
7f10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
7f20: 4c 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52  L col1 * col0 FR
7f30: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
7f40: 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39  .----..2064..339
7f50: 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  5..8099....query
7f60: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
7f70: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
7f80: 39 35 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  95 FROM tab1 AS 
7f90: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 35 0d  cor0..----..-95.
7fa0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
7fb0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
7fc0: 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20  or0.col1 + col0 
7fd0: 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
7fe0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
7ff0: 0a 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d  .-2..-62..-62...
8000: 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
8010: 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
8020: 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
8030: 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
8040: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 37  owsort label-237
8050: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
8060: 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 32 20 2d  ol1 DIV + col2 -
8070: 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
8080: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
8090: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39  0..----..-84..-9
80a0: 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..0....skipif m
80b0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
80c0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
80d0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 33 37  owsort label-237
80e0: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
80f0: 6f 6c 31 20 2f 20 2b 20 63 6f 6c 32 20 2d 20 2b  ol1 / + col2 - +
8100: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
8110: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8120: 0a 2d 2d 2d 2d 0d 0a 2d 38 34 0d 0a 2d 39 30 0d  .----..-84..-90.
8130: 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
8140: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
8150: 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2a 20  STINCT - col1 * 
8160: 63 6f 6c 31 20 2a 20 2b 20 33 37 20 46 52 4f 4d  col1 * + 37 FROM
8170: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37   tab0..----..-27
8180: 33 36 35 32 0d 0a 2d 33 30 36 33 39 37 0d 0a 2d  3652..-306397..-
8190: 33 34 38 31 33 33 0d 0a 0d 0a 71 75 65 72 79 20  348133....query 
81a0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
81b0: 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
81c0: 30 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  0 * + col1 AS co
81d0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
81e0: 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35  --..-2064..-3395
81f0: 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  ..-8099....query
8200: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8210: 43 54 20 39 39 20 41 53 20 63 6f 6c 32 20 46 52  CT 99 AS col2 FR
8220: 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74  OM tab0, tab1, t
8230: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8240: 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
8250: 68 69 6e 67 20 74 6f 20 30 35 65 61 31 38 32 66  hing to 05ea182f
8260: 64 36 30 33 36 63 37 66 35 65 30 65 61 30 38 66  d6036c7f5e0ea08f
8270: 63 30 36 31 63 63 36 37 0d 0a 0d 0a 71 75 65 72  c061cc67....quer
8280: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8290: 45 43 54 20 2b 20 36 38 20 2a 20 63 6f 6c 31 20  ECT + 68 * col1 
82a0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
82b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 36 0d 0a 32  0..----..1156..2
82c0: 31 30 38 0d 0a 34 30 31 32 0d 0a 0d 0a 71 75 65  108..4012....que
82d0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
82e0: 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f  LECT ALL cor0.co
82f0: 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l0 * col0 FROM t
8300: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
8310: 2d 0d 0a 34 30 39 36 0d 0a 36 34 30 30 0d 0a 39  -..4096..6400..9
8320: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8330: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
8340: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 63 6f  + cor0.col0 * co
8350: 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
8360: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8370: 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33  --..189..2028..3
8380: 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
8390: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
83a0: 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 41   - col0 * col0 A
83b0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
83c0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
83d0: 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a  49..6084..6241..
83e0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
83f0: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
8400: 35 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  52 FROM tab1 AS 
8410: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d 0a  cor0..----..52..
8420: 35 32 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72 79 20  52..52....query 
8430: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
8440: 54 20 2b 20 63 6f 6c 32 20 2a 20 28 20 31 36 20  T + col2 * ( 16 
8450: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
8460: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
8470: 2d 0d 0a 34 31 36 0d 0a 34 33 32 0d 0a 36 30 38  -..416..432..608
8480: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8490: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
84a0: 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
84b0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
84c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39  0..----..1..1089
84d0: 0d 0a 36 37 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..6724....onlyif
84e0: 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
84f0: 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
8500: 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
8510: 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
8520: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
8530: 65 6c 2d 32 34 38 0d 0a 53 45 4c 45 43 54 20 63  el-248..SELECT c
8540: 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 35  ol1 + col2 * - 5
8550: 35 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 43 41 53  5 + - col0 * CAS
8560: 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
8570: 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41  AL ) FROM tab2 A
8580: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
8590: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
85a0: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
85b0: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
85c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
85d0: 20 6c 61 62 65 6c 2d 32 34 38 0d 0a 53 45 4c 45   label-248..SELE
85e0: 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a  CT col1 + col2 *
85f0: 20 2d 20 35 35 20 2b 20 2d 20 63 6f 6c 30 20 2a   - 55 + - col0 *
8600: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
8610: 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61 62 32  REAL ) FROM tab2
8620: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
8630: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
8640: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
8650: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
8660: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 72 30  cor0.col2 * cor0
8670: 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
8680: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
8690: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a  .----..1..1089..
86a0: 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
86b0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
86c0: 44 49 53 54 49 4e 43 54 20 2b 20 39 33 20 46 52  DISTINCT + 93 FR
86d0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 39  OM tab0..----..9
86e0: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
86f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
8700: 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 * - col1 AS 
8710: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
8720: 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32  ----..-7396..-82
8730: 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 6f 6e 6c  81..-9409....onl
8740: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
8750: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
8760: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
8770: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
8780: 72 74 20 6c 61 62 65 6c 2d 32 35 32 0d 0a 53 45  rt label-252..SE
8790: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
87a0: 36 38 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20  68 DIV + col0 + 
87b0: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
87c0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
87d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 37 38  ..----..-16..-78
87e0: 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-79....skipif 
87f0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
8800: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
8810: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35  rowsort label-25
8820: 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  2..SELECT DISTIN
8830: 43 54 20 2d 20 36 38 20 2f 20 2b 20 63 6f 6c 30  CT - 68 / + col0
8840: 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + - col0 AS col
8850: 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
8860: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a  or0..----..-16..
8870: 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72  -78..-79....quer
8880: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
8890: 45 43 54 20 2b 20 33 38 20 2b 20 2b 20 32 33 20  ECT + 38 + + 23 
88a0: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
88b0: 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 36 31 0d  0..----..61..61.
88c0: 0a 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .61....query I r
88d0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
88e0: 4c 4c 20 2d 20 2d 20 63 6f 6c 30 20 41 53 20 63  LL - - col0 AS c
88f0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
8900: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33 35  r0..----..24..35
8910: 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..89....query I 
8920: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
8930: 2d 20 2d 20 38 37 20 2a 20 2d 20 28 20 63 6f 6c  - - 87 * - ( col
8940: 30 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  0 ) AS col0 FROM
8950: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
8960: 2d 2d 2d 0d 0a 2d 32 36 31 0d 0a 2d 35 35 36 38  ---..-261..-5568
8970: 0d 0a 2d 36 39 36 30 0d 0a 0d 0a 71 75 65 72 79  ..-6960....query
8980: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8990: 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 34  CT DISTINCT - 74
89a0: 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   * + col1 + col2
89b0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
89c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 37 30 0d  r0..----..-1870.
89d0: 0a 2d 36 38 33 0d 0a 2d 38 36 36 0d 0a 0d 0a 71  .-683..-866....q
89e0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
89f0: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
8a00: 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c  * - col0 * - col
8a10: 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
8a20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 37 39 33  or0..----..20793
8a30: 36 0d 0a 37 33 37 32 38 30 0d 0a 38 37 34 38 0d  6..737280..8748.
8a40: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
8a50: 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
8a60: 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
8a70: 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
8a80: 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
8a90: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 35 38 0d  wsort label-258.
8aa0: 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 36 36  .SELECT CAST( 66
8ab0: 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20 63   AS SIGNED ) - c
8ac0: 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20  ol2 * - col0 AS 
8ad0: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
8ae0: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
8af0: 31 0d 0a 37 33 36 34 0d 0a 38 35 38 0d 0a 0d 0a  1..7364..858....
8b00: 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
8b10: 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
8b20: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
8b30: 61 62 65 6c 2d 32 35 38 0d 0a 53 45 4c 45 43 54  abel-258..SELECT
8b40: 20 43 41 53 54 20 28 20 36 36 20 41 53 20 49 4e   CAST ( 66 AS IN
8b50: 54 45 47 45 52 20 29 20 2d 20 63 6f 6c 32 20 2a  TEGER ) - col2 *
8b60: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   - col0 AS col0 
8b70: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
8b80: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 0d 0a 37 33  0..----..101..73
8b90: 36 34 0d 0a 38 35 38 0d 0a 0d 0a 71 75 65 72 79  64..858....query
8ba0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
8bb0: 43 54 20 41 4c 4c 20 2d 20 31 31 20 41 53 20 63  CT ALL - 11 AS c
8bc0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
8bd0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
8be0: 0d 0a 2d 31 31 0d 0a 2d 31 31 0d 0a 0d 0a 6f 6e  ..-11..-11....on
8bf0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
8c00: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
8c10: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
8c20: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
8c30: 6f 72 74 20 6c 61 62 65 6c 2d 32 36 30 0d 0a 53  ort label-260..S
8c40: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
8c50: 20 37 37 20 44 49 56 20 2d 20 33 36 20 2b 20 63   77 DIV - 36 + c
8c60: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
8c70: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 32 0d   cor0..----..52.
8c80: 0a 35 35 0d 0a 39 34 0d 0a 0d 0a 73 6b 69 70 69  .55..94....skipi
8c90: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
8ca0: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
8cb0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8cc0: 32 36 30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  260..SELECT DIST
8cd0: 49 4e 43 54 20 2b 20 37 37 20 2f 20 2d 20 33 36  INCT + 77 / - 36
8ce0: 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   + col2 FROM tab
8cf0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
8d00: 0a 35 32 0d 0a 35 35 0d 0a 39 34 0d 0a 0d 0a 71  .52..55..94....q
8d10: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
8d20: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 34  SELECT ALL + - 4
8d30: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
8d40: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
8d50: 2d 0d 0a 2d 34 32 0d 0a 2d 34 32 0d 0a 2d 34 32  -..-42..-42..-42
8d60: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
8d70: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
8d80: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
8d90: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
8da0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
8db0: 32 36 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  262..SELECT ALL 
8dc0: 2b 20 43 41 53 54 28 20 30 20 41 53 20 53 49 47  + CAST( 0 AS SIG
8dd0: 4e 45 44 20 29 20 2b 20 63 6f 6c 30 20 44 49 56  NED ) + col0 DIV
8de0: 20 2d 20 39 31 20 46 52 4f 4d 20 74 61 62 32 20   - 91 FROM tab2 
8df0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
8e00: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ..0..0....skipif
8e10: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
8e20: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
8e30: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32   rowsort label-2
8e40: 36 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  62..SELECT ALL +
8e50: 20 43 41 53 54 20 28 20 30 20 41 53 20 49 4e 54   CAST ( 0 AS INT
8e60: 45 47 45 52 20 29 20 2b 20 63 6f 6c 30 20 2f 20  EGER ) + col0 / 
8e70: 2d 20 39 31 20 46 52 4f 4d 20 74 61 62 32 20 41  - 91 FROM tab2 A
8e80: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
8e90: 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..0....query I
8ea0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
8eb0: 20 44 49 53 54 49 4e 43 54 20 39 32 20 2b 20 38   DISTINCT 92 + 8
8ec0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
8ed0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 0d  r0..----..100...
8ee0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
8ef0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c  ..SELECT - + col
8f00: 30 20 2a 20 2b 20 36 38 20 2b 20 63 6f 72 30 2e  0 * + 68 + cor0.
8f10: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63  col2 FROM tab0 c
8f20: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 39 39  or0..----..-1599
8f30: 0d 0a 2d 32 33 37 39 0d 0a 2d 35 39 37 30 0d 0a  ..-2379..-5970..
8f40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
8f50: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
8f60: 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2b 20 63  ( - col1 ) + + c
8f70: 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 * col2 FROM 
8f80: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
8f90: 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36 39 0d 0a 32  --..158..1969..2
8fa0: 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  985....query I r
8fb0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
8fc0: 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 2b 20 74   tab0.col0 - + t
8fd0: 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab0.col0 FROM ta
8fe0: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b0..----..0..0..
8ff0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
9000: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
9010: 32 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 33  2 + + col2 * + 3
9020: 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  3 AS col2 FROM t
9030: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33 36 0d  ab1..----..1836.
9040: 0a 31 39 33 38 0d 0a 33 32 36 34 0d 0a 0d 0a 73  .1938..3264....s
9050: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
9060: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
9070: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
9080: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
9090: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
90a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
90b0: 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63 6f  cor0.col2 * + co
90c0: 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 63 6f 6c 32  l2 + + col2 col2
90d0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
90e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 37 30 0d 0a  r0..----..2970..
90f0: 33 33 30 36 0d 0a 39 33 31 32 0d 0a 0d 0a 73 6b  3306..9312....sk
9100: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
9110: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
9120: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9130: 4c 45 43 54 20 2b 20 2d 20 43 41 53 54 20 28 20  LECT + - CAST ( 
9140: 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20 41  col0 AS REAL ) A
9150: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
9160: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
9170: 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a  -7..-78..-79....
9180: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
9190: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
91a0: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
91b0: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
91c0: 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
91d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
91e0: 20 63 6f 6c 32 20 2a 20 31 38 20 63 6f 6c 31 20   col2 * 18 col1 
91f0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
9200: 0a 31 30 32 36 0d 0a 31 37 32 38 0d 0a 39 37 32  .1026..1728..972
9210: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
9220: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
9230: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
9240: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
9250: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
9260: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 31  owsort label-271
9270: 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e  ..SELECT CAST( N
9280: 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
9290: 2b 20 2d 20 35 35 20 2a 20 2d 20 63 6f 6c 31 20  + - 55 * - col1 
92a0: 2f 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 6c 31 20  / - col1 - col1 
92b0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
92c0: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
92d0: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
92e0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
92f0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
9300: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
9310: 6c 2d 32 37 31 0d 0a 53 45 4c 45 43 54 20 43 41  l-271..SELECT CA
9320: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
9330: 45 47 45 52 20 29 20 2b 20 2d 20 35 35 20 2a 20  EGER ) + - 55 * 
9340: 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 31 20  - col1 / - col1 
9350: 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  - col1 AS col1 F
9360: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
9370: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
9380: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
9390: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
93a0: 49 4e 43 54 20 28 20 2b 20 63 6f 6c 30 20 29 20  INCT ( + col0 ) 
93b0: 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
93c0: 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b2 cor0..----..-
93d0: 32 30 0d 0a 34 31 0d 0a 35 32 0d 0a 0d 0a 71 75  20..41..52....qu
93e0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
93f0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
9400: 20 2b 20 31 31 20 41 53 20 63 6f 6c 32 20 46 52   + 11 AS col2 FR
9410: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
9420: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 0d 0a 71 75  .----..-11....qu
9430: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9440: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 32 38 20 2b  ELECT ALL - 28 +
9450: 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63   cor0.col0 * - c
9460: 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
9470: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
9480: 2d 2d 2d 0d 0a 2d 36 33 0d 0a 2d 37 33 32 36 0d  ---..-63..-7326.
9490: 0a 2d 38 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .-820....query I
94a0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
94b0: 20 2d 20 28 20 63 6f 6c 30 20 29 20 2d 20 63 6f   - ( col0 ) - co
94c0: 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
94d0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37  cor0..----..-137
94e0: 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e  ..-38..-96....on
94f0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
9500: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
9510: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
9520: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
9530: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
9540: 20 6c 61 62 65 6c 2d 32 37 36 0d 0a 53 45 4c 45   label-276..SELE
9550: 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 43  CT cor0.col1 * C
9560: 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43  AST( NULL AS DEC
9570: 49 4d 41 4c 20 29 20 41 53 20 63 6f 6c 30 20 46  IMAL ) AS col0 F
9580: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
9590: 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
95a0: 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
95b0: 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
95c0: 20 74 6f 20 63 64 37 61 37 39 30 31 65 34 37 63   to cd7a7901e47c
95d0: 31 35 31 35 35 34 30 34 61 66 66 30 64 32 31 36  15155404aff0d216
95e0: 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  fe0b....skipif m
95f0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
9600: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
9610: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 37 36  owsort label-276
9620: 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f  ..SELECT cor0.co
9630: 6c 31 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c  l1 * CAST ( NULL
9640: 20 41 53 20 52 45 41 4c 20 29 20 41 53 20 63 6f   AS REAL ) AS co
9650: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
9660: 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
9670: 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab2 AS cor1..--
9680: 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
9690: 68 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31  hing to cd7a7901
96a0: 65 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30  e47c15155404aff0
96b0: 64 32 31 36 66 65 30 62 0d 0a 0d 0a 71 75 65 72  d216fe0b....quer
96c0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
96d0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 36 20  ECT DISTINCT 46 
96e0: 2a 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20  * - col2 + col2 
96f0: 2b 20 28 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20  + ( - tab0.col0 
9700: 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  ) FROM tab0..---
9710: 2d 0d 0a 2d 31 35 30 39 0d 0a 2d 33 37 37 39 0d  -..-1509..-3779.
9720: 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 49  .-80....query II
9730: 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
9740: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
9750: 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61   * FROM tab2, ta
9760: 62 32 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  b2 cor0 CROSS JO
9770: 49 4e 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  IN tab1..----..2
9780: 34 33 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  43 values hashin
9790: 67 20 74 6f 20 38 37 37 61 38 64 62 61 63 30 65  g to 877a8dbac0e
97a0: 32 39 62 38 36 65 38 34 35 66 62 36 34 65 64 39  29b86e845fb64ed9
97b0: 64 32 32 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49  d2242....query I
97c0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
97d0: 20 33 33 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   33 AS col1 FROM
97e0: 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
97f0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
9800: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
9810: 32 30 64 33 38 34 32 38 36 65 38 32 64 31 63 36  20d384286e82d1c6
9820: 63 38 62 31 62 32 62 31 30 39 61 37 64 61 35 0d  c8b1b2b109a7da5.
9830: 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
9840: 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
9850: 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
9860: 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
9870: 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
9880: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
9890: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
98a0: 6f 6c 31 20 2a 20 2b 20 39 34 20 63 6f 6c 32 20  ol1 * + 94 col2 
98b0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
98c0: 0a 31 35 39 38 0d 0a 32 39 31 34 0d 0a 35 35 34  .1598..2914..554
98d0: 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
98e0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
98f0: 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29   + ( cor0.col2 )
9900: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
9910: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
9920: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
9930: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
9940: 74 6f 20 34 30 66 64 38 63 63 30 64 65 39 32 65  to 40fd8cc0de92e
9950: 61 36 38 64 37 33 36 33 34 63 32 64 38 66 37 35  a68d73634c2d8f75
9960: 62 66 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  bf5....query I r
9970: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
9980: 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 41 53 20   col2 * col1 AS 
9990: 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
99a0: 2d 2d 2d 2d 0d 0a 2d 32 38 33 38 0d 0a 2d 37 34  ----..-2838..-74
99b0: 36 32 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  62..-97....query
99c0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
99d0: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
99e0: 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 63 6f   * + col1 + - co
99f0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
9a00: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 33 0d 0a 36 32 32  0..----..43..622
9a10: 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..73....query I 
9a20: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9a30: 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  - col0 * cor0.co
9a40: 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
9a50: 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
9a60: 0a 2d 32 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d  .-2064..-3395..-
9a70: 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
9a80: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
9a90: 41 4c 4c 20 2d 20 2b 20 63 6f 6c 32 20 2b 20 2d  ALL - + col2 + -
9aa0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
9ab0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
9ac0: 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31 31  .----..-108..-11
9ad0: 34 0d 0a 2d 31 39 32 0d 0a 0d 0a 6f 6e 6c 79 69  4..-192....onlyi
9ae0: 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
9af0: 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
9b00: 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
9b10: 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
9b20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
9b30: 62 65 6c 2d 32 38 36 0d 0a 53 45 4c 45 43 54 20  bel-286..SELECT 
9b40: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
9b50: 2a 20 43 41 53 54 28 20 2b 20 63 6f 6c 32 20 41  * CAST( + col2 A
9b60: 53 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f  S SIGNED ) AS co
9b70: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
9b80: 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38  --..1534..646..8
9b90: 33 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  37....skipif mys
9ba0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
9bb0: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
9bc0: 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 36 0d 0a  sort label-286..
9bd0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
9be0: 2b 20 63 6f 6c 31 20 2a 20 43 41 53 54 20 28 20  + col1 * CAST ( 
9bf0: 2b 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  + col2 AS INTEGE
9c00: 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
9c10: 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   tab2..----..153
9c20: 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 6f  4..646..837....o
9c30: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
9c40: 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
9c50: 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
9c60: 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
9c70: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9c80: 74 20 6c 61 62 65 6c 2d 32 38 37 0d 0a 53 45 4c  t label-287..SEL
9c90: 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 43 41 53  ECT - col1 * CAS
9ca0: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
9cb0: 44 20 29 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c  D ) * + tab0.col
9cc0: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
9cd0: 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
9ce0: 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
9cf0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
9d00: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
9d10: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 32 38 37 0d  wsort label-287.
9d20: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a  .SELECT - col1 *
9d30: 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
9d40: 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 74 61  INTEGER ) * + ta
9d50: 62 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b0.col0 FROM tab
9d60: 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
9d70: 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ULL..NULL....que
9d80: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
9d90: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20 74 61  LECT col2 + + ta
9da0: 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b1.col2 FROM tab
9db0: 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31  1..----..108..11
9dc0: 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65 72 79 20  4..192....query 
9dd0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
9de0: 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 31 39 20  T - col2 * + 19 
9df0: 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
9e00: 0a 2d 31 30 32 36 0d 0a 2d 31 30 38 33 0d 0a 2d  .-1026..-1083..-
9e10: 31 38 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 49  1824....query II
9e20: 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
9e30: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
9e40: 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c  NCT * FROM tab1,
9e50: 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63   tab2, tab0 AS c
9e60: 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72  or0, tab0 AS cor
9e70: 31 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c  1..----..972 val
9e80: 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30  ues hashing to 0
9e90: 39 62 31 32 30 61 38 66 66 31 33 65 62 61 66 65  9b120a8ff13ebafe
9ea0: 61 37 61 66 31 30 63 32 31 35 32 32 34 31 62 0d  a7af10c2152241b.
9eb0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
9ec0: 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2b  rt..SELECT + ( +
9ed0: 20 35 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20   50 * cor0.col0 
9ee0: 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
9ef0: 61 62 31 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a  ab1, tab2 cor0..
9f00: 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
9f10: 61 73 68 69 6e 67 20 74 6f 20 31 36 62 31 66 65  ashing to 16b1fe
9f20: 66 66 63 66 64 34 34 37 33 35 33 38 66 32 30 30  ffcfd4473538f200
9f30: 65 32 39 31 33 38 32 33 32 34 0d 0a 0d 0a 71 75  e291382324....qu
9f40: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
9f50: 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 28  ELECT - col1 + (
9f60: 20 2b 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74   + col2 ) FROM t
9f70: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
9f80: 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d 0a 32 31 0d 0a  -..-33..-4..21..
9f90: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
9fa0: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a  t..SELECT col1 *
9fb0: 20 38 34 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d   84 FROM tab0..-
9fc0: 2d 2d 2d 0d 0a 37 32 32 34 0d 0a 37 36 34 34 0d  ---..7224..7644.
9fd0: 0a 38 31 34 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  .8148....skipif 
9fe0: 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
9ff0: 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
a000: 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
a010: 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
a020: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a030: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
a040: 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 32   * - col1 + col2
a050: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
a060: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
a070: 32 34 0d 0a 2d 35 38 33 0d 0a 2d 39 34 34 0d 0a  24..-583..-944..
a080: 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49  ..query IIIIIIII
a090: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a0a0: 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62  T ALL * FROM tab
a0b0: 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 20  2, tab1 AS cor0 
a0c0: 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20  CROSS JOIN tab0 
a0d0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 34 33 20  cor1..----..243 
a0e0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
a0f0: 6f 20 32 62 61 34 37 61 38 33 33 39 37 31 64 34  o 2ba47a833971d4
a100: 63 34 62 30 32 38 37 65 38 34 39 66 62 30 63 66  c4b0287e849fb0cf
a110: 62 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  b8....onlyif mys
a120: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
a130: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
a140: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
a150: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a160: 6c 2d 32 39 36 0d 0a 53 45 4c 45 43 54 20 2d 20  l-296..SELECT - 
a170: 2d 20 38 34 20 2a 20 37 32 20 44 49 56 20 2d 20  - 84 * 72 DIV - 
a180: 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col1 + cor0.col1
a190: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
a1a0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a  r0..----..-164..
a1b0: 2d 33 33 38 0d 0a 2d 34 33 0d 0a 0d 0a 73 6b 69  -338..-43....ski
a1c0: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
a1d0: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
a1e0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
a1f0: 6c 2d 32 39 36 0d 0a 53 45 4c 45 43 54 20 2d 20  l-296..SELECT - 
a200: 2d 20 38 34 20 2a 20 37 32 20 2f 20 2d 20 63 6f  - 84 * 72 / - co
a210: 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46  l1 + cor0.col1 F
a220: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
a230: 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 34 0d 0a 2d 33  ..----..-164..-3
a240: 33 38 0d 0a 2d 34 33 0d 0a 0d 0a 71 75 65 72 79  38..-43....query
a250: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a260: 43 54 20 2b 20 2b 20 37 20 46 52 4f 4d 20 74 61  CT + + 7 FROM ta
a270: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
a280: 0d 0a 37 0d 0a 37 0d 0a 37 0d 0a 0d 0a 6f 6e 6c  ..7..7..7....onl
a290: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
a2a0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
a2b0: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
a2c0: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
a2d0: 72 74 20 6c 61 62 65 6c 2d 32 39 38 0d 0a 53 45  rt label-298..SE
a2e0: 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 6c 30 20  LECT - ( + col0 
a2f0: 29 20 44 49 56 20 63 6f 6c 30 20 2b 20 2d 20 63  ) DIV col0 + - c
a300: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
a310: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
a320: 0d 0a 2d 33 32 0d 0a 2d 36 30 0d 0a 0d 0a 73 6b  ..-32..-60....sk
a330: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
a340: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
a350: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
a360: 65 6c 2d 32 39 38 0d 0a 53 45 4c 45 43 54 20 2d  el-298..SELECT -
a370: 20 28 20 2b 20 63 6f 6c 30 20 29 20 2f 20 63 6f   ( + col0 ) / co
a380: 6c 30 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l0 + - col1 FROM
a390: 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
a3a0: 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33 32 0d 0a 2d  ---..-18..-32..-
a3b0: 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
a3c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
a3d0: 28 20 38 32 20 29 20 2b 20 63 6f 6c 31 20 41 53  ( 82 ) + col1 AS
a3e0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
a3f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 0d 0a  cor0..----..15..
a400: 34 0d 0a 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4..9....onlyif m
a410: 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
a420: 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
a430: 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
a440: 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
a450: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
a460: 2d 33 30 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2d  -300..SELECT - -
a470: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
a480: 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c 31  IGNED ) * - col1
a490: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 63   + col2 * col1 c
a4a0: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
a4b0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
a4c0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
a4d0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
a4e0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
a4f0: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
a500: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
a510: 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66   columns..skipif
a520: 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
a530: 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
a540: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
a550: 30 30 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 43  00..SELECT - - C
a560: 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
a570: 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 6c 31  TEGER ) * - col1
a580: 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 63   + col2 * col1 c
a590: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
a5a0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
a5b0: 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
a5c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a5d0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
a5e0: 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  T + col1 * col2 
a5f0: 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
a600: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  0 cor0..----..28
a610: 33 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a  38..7462..97....
a620: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a630: 0a 53 45 4c 45 43 54 20 2b 20 36 39 20 2a 20 63  .SELECT + 69 * c
a640: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
a650: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 39   cor0..----..179
a660: 34 0d 0a 31 38 36 33 0d 0a 32 36 32 32 0d 0a 0d  4..1863..2622...
a670: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
a680: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20  ..SELECT col1 * 
a690: 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  + cor0.col1 FROM
a6a0: 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
a6b0: 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 38 32 38 31 0d  ---..7396..8281.
a6c0: 0a 39 34 30 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .9409....query I
a6d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a6e0: 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   ALL cor0.col2 *
a6f0: 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
a700: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
a710: 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 30 38 39 0d 0a  .----..1..1089..
a720: 36 37 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6724....query I 
a730: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
a740: 35 33 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41  53 + cor0.col0 A
a750: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
a760: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
a770: 31 33 31 0d 0a 31 33 32 0d 0a 36 30 0d 0a 0d 0a  131..132..60....
a780: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
a790: 0a 53 45 4c 45 43 54 20 2b 20 2d 20 35 36 20 46  .SELECT + - 56 F
a7a0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
a7b0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 0d 0a 2d 35 36  ..----..-56..-56
a7c0: 0d 0a 2d 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-56....query I
a7d0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
a7e0: 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2b 20   DISTINCT + ( + 
a7f0: 63 6f 6c 32 20 29 20 2a 20 28 20 2d 20 35 33 20  col2 ) * ( - 53 
a800: 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  ) FROM tab1 AS c
a810: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 36 32  or0..----..-2862
a820: 0d 0a 2d 33 30 32 31 0d 0a 2d 35 30 38 38 0d 0a  ..-3021..-5088..
a830: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
a840: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
a850: 39 38 20 2a 20 63 6f 6c 30 20 2b 20 30 20 46 52  98 * col0 + 0 FR
a860: 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
a870: 2d 2d 0d 0a 2d 36 38 36 0d 0a 2d 37 36 34 34 0d  --..-686..-7644.
a880: 0a 2d 37 37 34 32 0d 0a 0d 0a 71 75 65 72 79 20  .-7742....query 
a890: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
a8a0: 54 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a  T + ( - col0 ) *
a8b0: 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   - col0 AS col2 
a8c0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
a8d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38  0..----..49..608
a8e0: 34 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79  4..6241....query
a8f0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
a900: 43 54 20 31 36 20 2a 20 74 61 62 30 2e 63 6f 6c  CT 16 * tab0.col
a910: 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  0 AS col1 FROM t
a920: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 32 34 0d  ab0..----..1424.
a930: 0a 33 38 34 0d 0a 35 36 30 0d 0a 0d 0a 6f 6e 6c  .384..560....onl
a940: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
a950: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
a960: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
a970: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
a980: 72 74 20 6c 61 62 65 6c 2d 33 31 31 0d 0a 53 45  rt label-311..SE
a990: 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e  LECT ALL + tab0.
a9a0: 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col0 * + col1 + 
a9b0: 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 46 52  col2 DIV col1 FR
a9c0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab0..----..2
a9d0: 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d  064..3395..8099.
a9e0: 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
a9f0: 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
aa00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
aa10: 74 20 6c 61 62 65 6c 2d 33 31 31 0d 0a 53 45 4c  t label-311..SEL
aa20: 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 30 2e 63  ECT ALL + tab0.c
aa30: 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 63  ol0 * + col1 + c
aa40: 6f 6c 32 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 / col1 FROM 
aa50: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34  tab0..----..2064
aa60: 0d 0a 33 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a  ..3395..8099....
aa70: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
aa80: 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
aa90: 20 63 6f 6c 31 20 2a 20 36 20 41 53 20 63 6f 6c   col1 * 6 AS col
aaa0: 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
aab0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 0d 0a  or0..----..130..
aac0: 35 30 0d 0a 36 35 0d 0a 0d 0a 71 75 65 72 79 20  50..65....query 
aad0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
aae0: 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  T + + col0 * cor
aaf0: 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  0.col0 + col2 FR
ab00: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
ab10: 0a 2d 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36 30 39  .----..1226..609
ab20: 0d 0a 38 30 30 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..8003....onlyif
ab30: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
ab40: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
ab50: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
ab60: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ab70: 6c 61 62 65 6c 2d 33 31 34 0d 0a 53 45 4c 45 43  label-314..SELEC
ab80: 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 28  T + + col1 + - (
ab90: 20 2b 20 63 6f 6c 32 20 29 20 44 49 56 20 63 6f   + col2 ) DIV co
aba0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
abb0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  cor0..----..10..
abc0: 31 32 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  12..8....skipif 
abd0: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
abe0: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
abf0: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 31  rowsort label-31
ac00: 34 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  4..SELECT + + co
ac10: 6c 31 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 32 20  l1 + - ( + col2 
ac20: 29 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ) / col0 FROM ta
ac30: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
ac40: 0d 0a 31 30 0d 0a 31 32 0d 0a 38 0d 0a 0d 0a 71  ..10..12..8....q
ac50: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ac60: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20  SELECT - col1 * 
ac70: 28 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20  ( col2 * + col2 
ac80: 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ) + col2 FROM ta
ac90: 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
aca0: 0d 0a 2d 32 32 35 37 32 0d 0a 2d 32 34 35 31 30  ..-22572..-24510
acb0: 0d 0a 2d 33 39 38 35 38 0d 0a 0d 0a 71 75 65 72  ..-39858....quer
acc0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
acd0: 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 34  ECT - - col2 + 4
ace0: 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  7 AS col2 FROM t
acf0: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
ad00: 2d 0d 0a 37 33 0d 0a 37 34 0d 0a 38 35 0d 0a 0d  -..73..74..85...
ad10: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ad20: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
ad30: 2d 20 36 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 60 AS col2 FRO
ad40: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
ad50: 2d 2d 2d 2d 0d 0a 2d 34 32 30 0d 0a 2d 34 36 38  ----..-420..-468
ad60: 30 0d 0a 2d 34 37 34 30 0d 0a 0d 0a 71 75 65 72  0..-4740....quer
ad70: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
ad80: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
ad90: 6f 6c 30 20 2b 20 2b 20 39 30 20 2a 20 2d 20 63  ol0 + + 90 * - c
ada0: 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f  ol2 + - col0 FRO
adb0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
adc0: 2d 2d 2d 2d 0d 0a 2d 32 34 34 34 0d 0a 2d 32 34  ----..-2444..-24
add0: 39 36 0d 0a 2d 33 35 37 38 0d 0a 0d 0a 6f 6e 6c  96..-3578....onl
ade0: 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
adf0: 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
ae00: 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
ae10: 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
ae20: 72 74 20 6c 61 62 65 6c 2d 33 31 39 0d 0a 53 45  rt label-319..SE
ae30: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20  LECT - col1 DIV 
ae40: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
ae50: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
ae60: 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31  ----..-1..-1..-1
ae70: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
ae80: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
ae90: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
aea0: 72 74 20 6c 61 62 65 6c 2d 33 31 39 0d 0a 53 45  rt label-319..SE
aeb0: 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 63 6f  LECT - col1 / co
aec0: 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
aed0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
aee0: 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a  --..-1..-1..-1..
aef0: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
af00: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
af10: 63 6f 6c 32 20 2b 20 28 20 63 6f 72 30 2e 63 6f  col2 + ( cor0.co
af20: 6c 30 20 29 20 2a 20 2b 20 63 6f 72 30 2e 63 6f  l0 ) * + cor0.co
af30: 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
af40: 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
af50: 2d 2d 0d 0a 36 31 31 30 0d 0a 36 32 37 39 0d 0a  --..6110..6279..
af60: 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
af70: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
af80: 4c 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63  L - - col1 * - c
af90: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol1 FROM tab2 co
afa0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39 0d 0a  r0..----..-289..
afb0: 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d 0a 71  -3481..-961....q
afc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
afd0: 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
afe0: 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  + cor0.col2 + - 
aff0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
b000: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33  S cor0..----..-3
b010: 33 0d 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 73 6b 69  3..-4..21....ski
b020: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
b030: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
b040: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
b050: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
b060: 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
b070: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
b080: 4c 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  L col1 + col1 * 
b090: 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  + col1 col0 FROM
b0a0: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
b0b0: 2d 2d 2d 0d 0a 31 31 30 0d 0a 31 38 32 0d 0a 37  ---..110..182..7
b0c0: 30 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  02....onlyif mys
b0d0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
b0e0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
b0f0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
b100: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
b110: 6c 2d 33 32 34 0d 0a 53 45 4c 45 43 54 20 41 4c  l-324..SELECT AL
b120: 4c 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20  L col2 + + col0 
b130: 44 49 56 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  DIV - col0 FROM 
b140: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
b150: 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39 35 0d 0a  --..53..56..95..
b160: 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
b170: 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
b180: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b190: 20 6c 61 62 65 6c 2d 33 32 34 0d 0a 53 45 4c 45   label-324..SELE
b1a0: 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2b 20  CT ALL col2 + + 
b1b0: 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 30 20 46 52  col0 / - col0 FR
b1c0: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
b1d0: 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 36 0d 0a 39  .----..53..56..9
b1e0: 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
b1f0: 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
b200: 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
b210: 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
b220: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
b230: 2d 33 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  -325..SELECT + -
b240: 20 63 6f 6c 32 20 44 49 56 20 2d 20 36 39 20 41   col2 DIV - 69 A
b250: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
b260: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
b270: 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  0..0..1....skipi
b280: 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
b290: 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
b2a0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b2b0: 33 32 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20  325..SELECT + - 
b2c0: 63 6f 6c 32 20 2f 20 2d 20 36 39 20 41 53 20 63  col2 / - 69 AS c
b2d0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
b2e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
b2f0: 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..1....query I 
b300: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b310: 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
b320: 2a 20 2b 20 63 6f 6c 32 20 2b 20 33 33 20 41 53  * + col2 + 33 AS
b330: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
b340: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 37  cor0..----..1567
b350: 0d 0a 36 37 39 0d 0a 38 37 30 0d 0a 0d 0a 71 75  ..679..870....qu
b360: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
b370: 45 4c 45 43 54 20 2b 20 63 6f 72 31 2e 63 6f 6c  ELECT + cor1.col
b380: 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  0 FROM tab2, tab
b390: 30 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53 20  0 cor0, tab2 AS 
b3a0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
b3b0: 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
b3c0: 20 31 65 31 66 31 30 39 35 33 65 62 38 65 66 66   1e1f10953eb8eff
b3d0: 65 39 62 32 30 65 37 34 36 66 38 61 37 66 64 38  e9b20e746f8a7fd8
b3e0: 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
b3f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
b400: 54 49 4e 43 54 20 2d 20 33 38 20 41 53 20 63 6f  TINCT - 38 AS co
b410: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
b420: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 38 0d  cor0..----..-38.
b430: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
b440: 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 2d 20 63  rt..SELECT ( - c
b450: 6f 72 31 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20  or1.col1 ) FROM 
b460: 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
b470: 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
b480: 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
b490: 73 20 68 61 73 68 69 6e 67 20 74 6f 20 64 34 63  s hashing to d4c
b4a0: 36 37 33 62 37 34 34 34 65 62 39 39 32 37 65 63  673b7444eb9927ec
b4b0: 36 33 31 37 35 62 34 33 63 36 62 38 34 0d 0a 0d  63175b43c6b84...
b4c0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
b4d0: 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
b4e0: 32 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  2 * col2 + + col
b4f0: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
b500: 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 32 0d 0a 32 0d  ..----..1122..2.
b510: 0a 36 38 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .6806....query I
b520: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b530: 20 41 4c 4c 20 36 35 20 46 52 4f 4d 20 74 61 62   ALL 65 FROM tab
b540: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
b550: 0a 36 35 0d 0a 36 35 0d 0a 36 35 0d 0a 0d 0a 6f  .65..65..65....o
b560: 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
b570: 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
b580: 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
b590: 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
b5a0: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 33 32 0d 0a  sort label-332..
b5b0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
b5c0: 31 35 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63  15 DIV col2 AS c
b5d0: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
b5e0: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
b5f0: 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a 73 6b  ..-57..-96....sk
b600: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b610: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b620: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b630: 65 6c 2d 33 33 32 0d 0a 53 45 4c 45 43 54 20 2d  el-332..SELECT -
b640: 20 63 6f 6c 32 20 2b 20 31 35 20 2f 20 63 6f 6c   col2 + 15 / col
b650: 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
b660: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
b670: 2d 0d 0a 2d 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36  -..-54..-57..-96
b680: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
b690: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  ort..SELECT - ( 
b6a0: 38 38 20 29 20 2b 20 2b 20 63 6f 6c 32 20 41 53  88 ) + + col2 AS
b6b0: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
b6c0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
b6d0: 35 30 0d 0a 2d 36 31 0d 0a 2d 36 32 0d 0a 0d 0a  50..-61..-62....
b6e0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
b6f0: 0a 53 45 4c 45 43 54 20 35 33 20 41 53 20 63 6f  .SELECT 53 AS co
b700: 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l1 FROM tab0, ta
b710: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
b720: 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
b730: 6e 67 20 74 6f 20 66 65 64 65 36 30 33 33 64 65  ng to fede6033de
b740: 65 33 34 36 64 62 64 32 37 32 30 38 35 63 30 35  e346dbd272085c05
b750: 37 32 34 66 64 61 0d 0a 0d 0a 71 75 65 72 79 20  724fda....query 
b760: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
b770: 54 20 41 4c 4c 20 63 6f 6c 32 20 2d 20 2d 20 63  T ALL col2 - - c
b780: 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
b790: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
b7a0: 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30  ---..109..67..80
b7b0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
b7c0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
b7d0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
b7e0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
b7f0: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
b800: 33 33 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  336..SELECT DIST
b810: 49 4e 43 54 20 2b 20 32 37 20 44 49 56 20 2b 20  INCT + 27 DIV + 
b820: 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
b830: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
b840: 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b  ----..0..1....sk
b850: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
b860: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
b870: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
b880: 65 6c 2d 33 33 36 0d 0a 53 45 4c 45 43 54 20 44  el-336..SELECT D
b890: 49 53 54 49 4e 43 54 20 2b 20 32 37 20 2f 20 2b  ISTINCT + 27 / +
b8a0: 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
b8b0: 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
b8c0: 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73  .----..0..1....s
b8d0: 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
b8e0: 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
b8f0: 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
b900: 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
b910: 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
b920: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
b930: 28 20 2d 20 63 6f 6c 30 20 29 20 63 6f 6c 32 20  ( - col0 ) col2 
b940: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
b950: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34  0..----..-3..-64
b960: 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-80....query I
b970: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
b980: 20 2d 20 28 20 2b 20 34 30 20 29 20 2b 20 63 6f   - ( + 40 ) + co
b990: 72 31 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r1.col2 AS col1 
b9a0: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20  FROM tab1, tab1 
b9b0: 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
b9c0: 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
b9d0: 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
b9e0: 6f 20 64 39 65 62 36 31 30 64 65 65 64 65 34 37  o d9eb610deede47
b9f0: 38 33 65 65 34 30 32 33 62 61 39 31 32 30 38 35  83ee4023ba912085
ba00: 63 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  ca....query I ro
ba10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
ba20: 36 34 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  64 FROM tab1 cor
ba30: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 0d 0a 2d 36  0..----..-64..-6
ba40: 34 0d 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72 79 20  4..-64....query 
ba50: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
ba60: 54 20 2b 20 35 35 20 41 53 20 63 6f 6c 32 20 46  T + 55 AS col2 F
ba70: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
ba80: 35 35 0d 0a 35 35 0d 0a 35 35 0d 0a 0d 0a 71 75  55..55..55....qu
ba90: 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49  ery IIIIIIIIIIII
baa0: 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
bab0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
bac0: 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
bad0: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
bae0: 4e 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61  N tab1, tab2, ta
baf0: 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b1 AS cor1..----
bb00: 0d 0a 33 36 34 35 20 76 61 6c 75 65 73 20 68 61  ..3645 values ha
bb10: 73 68 69 6e 67 20 74 6f 20 37 33 31 65 34 61 36  shing to 731e4a6
bb20: 35 34 39 62 33 31 32 62 61 32 31 63 32 65 36 31  549b312ba21c2e61
bb30: 63 61 39 62 65 64 65 32 37 0d 0a 0d 0a 71 75 65  ca9bede27....que
bb40: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
bb50: 4c 45 43 54 20 2b 20 38 20 46 52 4f 4d 20 74 61  LECT + 8 FROM ta
bb60: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 38 0d 0a 38 0d 0a  b1..----..8..8..
bb70: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
bb80: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
bb90: 54 49 4e 43 54 20 32 30 20 41 53 20 63 6f 6c 31  TINCT 20 AS col1
bba0: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
bbb0: 0d 0a 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..20....query I 
bbc0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
bbd0: 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
bbe0: 2b 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d  + tab0.col0 FROM
bbf0: 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d   tab0..----..35.
bc00: 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75  .7298..792....qu
bc10: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
bc20: 45 4c 45 43 54 20 34 39 20 41 53 20 63 6f 6c 32  ELECT 49 AS col2
bc30: 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31   FROM tab2, tab1
bc40: 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41   AS cor0, tab2 A
bc50: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
bc60: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
bc70: 74 6f 20 61 34 30 64 38 37 35 34 61 35 62 65 33  to a40d8754a5be3
bc80: 63 65 32 33 30 39 63 36 31 62 66 64 33 65 30 30  ce2309c61bfd3e00
bc90: 31 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  197....skipif po
bca0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
bcb0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
bcc0: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
bcd0: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
bce0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
bcf0: 0a 53 45 4c 45 43 54 20 32 37 20 2d 20 2b 20 63  .SELECT 27 - + c
bd00: 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
bd10: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 34 0d  b1..----..1..14.
bd20: 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .17....query I r
bd30: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
bd40: 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20  ol0 + + col2 AS 
bd50: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col1 FROM tab2..
bd60: 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a  ----..104..117..
bd70: 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  34....query I ro
bd80: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
bd90: 4c 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2d  L ( - col0 ) * -
bda0: 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 41   col2 + + col2 A
bdb0: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
bdc0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
bdd0: 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35 0d 0a 0d  36..7380..825...
bde0: 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
bdf0: 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
be00: 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
be10: 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
be20: 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
be30: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
be40: 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 30 20 29  T ALL ( + col0 )
be50: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
be60: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  cor0..----..24..
be70: 33 35 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72 79 20  35..89....query 
be80: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
be90: 54 20 44 49 53 54 49 4e 43 54 20 38 37 20 41 53  T DISTINCT 87 AS
bea0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
beb0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor0..----..8
bec0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
bed0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
bee0: 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f   - - col2 + + co
bef0: 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
bf00: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38 0d  cor0..----..108.
bf10: 0a 31 31 34 0d 0a 31 39 32 0d 0a 0d 0a 71 75 65  .114..192....que
bf20: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
bf30: 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  LECT - col2 + + 
bf40: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
bf50: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
bf60: 2d 2d 2d 2d 0d 0a 2d 39 0d 0a 33 34 0d 0a 37 0d  ----..-9..34..7.
bf70: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
bf80: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
bf90: 4e 43 54 20 2b 20 28 20 2d 20 32 34 20 29 20 46  NCT + ( - 24 ) F
bfa0: 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
bfb0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 0d 0a 71  ..----..-24....q
bfc0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
bfd0: 53 45 4c 45 43 54 20 2d 20 28 20 38 30 20 29 20  SELECT - ( 80 ) 
bfe0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
bff0: 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
c000: 0a 2d 38 30 0d 0a 2d 38 30 0d 0a 2d 38 30 0d 0a  .-80..-80..-80..
c010: 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
c020: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
c030: 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
c040: 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
c050: 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
c060: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 35 0d 0a  sort label-355..
c070: 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 28  SELECT ALL CAST(
c080: 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
c090: 20 29 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 63 6f   ) / - col0 + co
c0a0: 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31  r0.col1 * + col1
c0b0: 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
c0c0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
c0d0: 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
c0e0: 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
c0f0: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
c100: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
c110: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 35 35 0d 0a  sort label-355..
c120: 53 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20  SELECT ALL CAST 
c130: 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29  ( NULL AS REAL )
c140: 20 2f 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30   / - col0 + cor0
c150: 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41  .col1 * + col1 A
c160: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
c170: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
c180: 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
c190: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c1a0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
c1b0: 28 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 29 20  ( + tab0.col2 ) 
c1c0: 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
c1d0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
c1e0: 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
c1f0: 74 6f 20 63 38 66 39 66 61 39 65 66 30 66 38 37  to c8f9fa9ef0f87
c200: 30 32 62 64 33 38 32 65 38 32 31 33 37 38 61 39  02bd382e821378a9
c210: 36 64 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  6d8....query I r
c220: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
c230: 20 63 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c   col2 * tab1.col
c240: 31 20 2b 20 28 20 63 6f 6c 30 20 29 20 2d 20 63  1 + ( col0 ) - c
c250: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
c260: 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d  ---..1248..1404.
c270: 0a 35 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .570....query I 
c280: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c290: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
c2a0: 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63 6f  col0 * col0 + co
c2b0: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
c2c0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32  cor0..----..-122
c2d0: 34 0d 0a 2d 35 34 33 0d 0a 2d 37 38 33 39 0d 0a  4..-543..-7839..
c2e0: 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
c2f0: 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
c300: 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
c310: 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
c320: 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
c330: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c340: 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
c350: 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
c360: 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36  0 cor0..----..86
c370: 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  ..91..97....quer
c380: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
c390: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72  ECT DISTINCT cor
c3a0: 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 31 2e  1.col1 * - cor1.
c3b0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
c3c0: 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
c3d0: 4e 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  N tab0, tab2 AS 
c3e0: 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39  cor1..----..-289
c3f0: 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d  ..-3481..-961...
c400: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
c410: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
c420: 54 20 63 6f 6c 31 20 2b 20 39 39 20 41 53 20 63  T col1 + 99 AS c
c430: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
c440: 2d 2d 2d 0d 0a 31 31 36 0d 0a 31 33 30 0d 0a 31  ---..116..130..1
c450: 35 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  58....query I ro
c460: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
c470: 6c 31 20 2b 20 2b 20 28 20 34 32 20 29 20 2a 20  l1 + + ( 42 ) * 
c480: 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31 20 46 52  col2 * + col1 FR
c490: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
c4a0: 33 39 35 30 0d 0a 35 32 34 32 39 0d 0a 35 38 39  3950..52429..589
c4b0: 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  94....query I ro
c4c0: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
c4d0: 53 54 49 4e 43 54 20 2b 20 33 38 20 41 53 20 63  STINCT + 38 AS c
c4e0: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
c4f0: 2d 2d 2d 0d 0a 33 38 0d 0a 0d 0a 71 75 65 72 79  ---..38....query
c500: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
c510: 43 54 20 2d 20 28 20 30 20 2a 20 63 6f 6c 32 20  CT - ( 0 * col2 
c520: 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
c530: 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  ab1..----..0..0.
c540: 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
c550: 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
c560: 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
c570: 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
c580: 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
c590: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33   rowsort label-3
c5a0: 36 35 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53  65..SELECT - CAS
c5b0: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
c5c0: 44 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  D ) + col0 AS co
c5d0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
c5e0: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
c5f0: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
c600: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
c610: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
c620: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 36 35  owsort label-365
c630: 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
c640: 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
c650: 52 20 29 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  R ) + col0 AS co
c660: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
c670: 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
c680: 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
c690: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
c6a0: 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
c6b0: 2a 20 37 33 20 41 53 20 63 6f 6c 32 20 46 52 4f  * 73 AS col2 FRO
c6c0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  M tab0..----..-6
c6d0: 32 37 38 0d 0a 2d 36 36 34 33 0d 0a 2d 37 30 38  278..-6643..-708
c6e0: 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
c6f0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 32 37 20  sort..SELECT 27 
c700: 2d 20 37 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a  - 71 FROM tab2..
c710: 2d 2d 2d 2d 0d 0a 2d 34 34 0d 0a 2d 34 34 0d 0a  ----..-44..-44..
c720: 2d 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -44....query I r
c730: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
c740: 20 38 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f   80 + col0 AS co
c750: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
c760: 2d 2d 0d 0a 31 34 34 0d 0a 31 36 30 0d 0a 38 33  --..144..160..83
c770: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
c780: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
c790: 20 2b 20 35 38 20 41 53 20 63 6f 6c 31 20 46 52   + 58 AS col1 FR
c7a0: 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
c7b0: 34 30 0d 0a 35 39 0d 0a 39 31 0d 0a 0d 0a 6f 6e  40..59..91....on
c7c0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
c7d0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
c7e0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
c7f0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
c800: 6f 72 74 20 6c 61 62 65 6c 2d 33 37 30 0d 0a 53  ort label-370..S
c810: 45 4c 45 43 54 20 38 38 20 2b 20 34 34 20 44 49  ELECT 88 + 44 DI
c820: 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  V col1 FROM tab2
c830: 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 38 39 0d 0a  ..----..88..89..
c840: 39 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  90....skipif mys
c850: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
c860: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
c870: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 30 0d 0a  sort label-370..
c880: 53 45 4c 45 43 54 20 38 38 20 2b 20 34 34 20 2f  SELECT 88 + 44 /
c890: 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
c8a0: 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a 38 39 0d 0a 39  .----..88..89..9
c8b0: 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
c8c0: 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
c8d0: 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
c8e0: 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
c8f0: 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
c900: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37  rowsort label-37
c910: 31 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54  1..SELECT - CAST
c920: 28 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53  ( col0 * col1 AS
c930: 20 53 49 47 4e 45 44 20 29 20 2d 20 74 61 62 30   SIGNED ) - tab0
c940: 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d  .col0 FROM tab0.
c950: 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 38 0d 0a 2d 33  .----..-2088..-3
c960: 34 33 30 0d 0a 2d 38 31 38 38 0d 0a 0d 0a 73 6b  430..-8188....sk
c970: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
c980: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
c990: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
c9a0: 65 6c 2d 33 37 31 0d 0a 53 45 4c 45 43 54 20 2d  el-371..SELECT -
c9b0: 20 43 41 53 54 20 28 20 63 6f 6c 30 20 2a 20 63   CAST ( col0 * c
c9c0: 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
c9d0: 20 2d 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f   - tab0.col0 FRO
c9e0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
c9f0: 30 38 38 0d 0a 2d 33 34 33 30 0d 0a 2d 38 31 38  088..-3430..-818
ca00: 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
ca10: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ca20: 20 2d 20 33 37 20 41 53 20 63 6f 6c 32 20 46 52   - 37 AS col2 FR
ca30: 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
ca40: 33 37 0d 0a 2d 33 37 0d 0a 2d 33 37 0d 0a 0d 0a  37..-37..-37....
ca50: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ca60: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 63  .SELECT col2 - c
ca70: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
ca80: 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
ca90: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
caa0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
cab0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
cac0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
cad0: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
cae0: 72 74 20 6c 61 62 65 6c 2d 33 37 34 0d 0a 53 45  rt label-374..SE
caf0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
cb00: 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
cb10: 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20 46  GNED ) AS col1 F
cb20: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
cb30: 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
cb40: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
cb50: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
cb60: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 34  owsort label-374
cb70: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
cb80: 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  T - CAST ( NULL 
cb90: 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
cba0: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
cbb0: 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  ----..NULL....on
cbc0: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
cbd0: 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
cbe0: 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
cbf0: 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
cc00: 6f 72 74 20 6c 61 62 65 6c 2d 33 37 35 0d 0a 53  ort label-375..S
cc10: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
cc20: 6c 31 20 44 49 56 20 38 34 20 41 53 20 63 6f 6c  l1 DIV 84 AS col
cc30: 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
cc40: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
cc50: 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
cc60: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
cc70: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
cc80: 73 6f 72 74 20 6c 61 62 65 6c 2d 33 37 35 0d 0a  sort label-375..
cc90: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63  SELECT ALL + + c
cca0: 6f 6c 31 20 2f 20 38 34 20 41 53 20 63 6f 6c 31  ol1 / 84 AS col1
ccb0: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
ccc0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
ccd0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
cce0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
ccf0: 20 63 6f 6c 31 20 2a 20 2b 20 38 33 20 46 52 4f   col1 * + 83 FRO
cd00: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
cd10: 2d 0d 0a 31 34 31 31 0d 0a 32 35 37 33 0d 0a 34  -..1411..2573..4
cd20: 38 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  897....onlyif my
cd30: 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
cd40: 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
cd50: 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
cd60: 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
cd70: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
cd80: 33 37 37 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  377..SELECT DIST
cd90: 49 4e 43 54 20 2b 20 2b 20 43 41 53 54 28 20 2d  INCT + + CAST( -
cda0: 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20   col0 AS SIGNED 
cdb0: 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
cdc0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
cdd0: 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b 69 70  -35..-89....skip
cde0: 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
cdf0: 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
ce00: 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
ce10: 2d 33 37 37 0d 0a 53 45 4c 45 43 54 20 44 49 53  -377..SELECT DIS
ce20: 54 49 4e 43 54 20 2b 20 2b 20 43 41 53 54 20 28  TINCT + + CAST (
ce30: 20 2d 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47   - col0 AS INTEG
ce40: 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41  ER ) FROM tab0 A
ce50: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
ce60: 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 71  4..-35..-89....q
ce70: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ce80: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20  SELECT - + col2 
ce90: 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f  * cor0.col1 + co
cea0: 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c  l2 * col0 AS col
ceb0: 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
cec0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 34 38 0d  or0..----..-648.
ced0: 0a 32 33 35 36 0d 0a 34 39 34 0d 0a 0d 0a 71 75  .2356..494....qu
cee0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
cef0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
cf00: 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
cf10: 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l0 FROM tab0, ta
cf20: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
cf30: 0d 0a 2d 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a  ..-3..-64..-80..
cf40: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
cf50: 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
cf60: 20 74 61 62 32 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab2.col1 FROM 
cf70: 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d  tab2..----..137.
cf80: 0a 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79  .38..96....query
cf90: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
cfa0: 43 54 20 38 38 20 2a 20 74 61 62 30 2e 63 6f 6c  CT 88 * tab0.col
cfb0: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
cfc0: 2d 0d 0a 37 35 36 38 0d 0a 38 30 30 38 0d 0a 38  -..7568..8008..8
cfd0: 35 33 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  536....skipif po
cfe0: 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
cff0: 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
d000: 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
d010: 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
d020: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
d030: 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2b  .SELECT col2 * +
d040: 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 63 6f 6c   col1 + col2 col
d050: 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
d060: 2d 0d 0a 32 38 37 31 0d 0a 37 35 34 34 0d 0a 39  -..2871..7544..9
d070: 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  8....skipif post
d080: 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
d090: 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
d0a0: 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
d0b0: 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
d0c0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
d0d0: 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37 37 20 2d  ELECT ALL - 77 -
d0e0: 20 2b 20 63 6f 6c 31 20 2a 20 35 38 20 63 6f 6c   + col1 * 58 col
d0f0: 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
d100: 2d 0d 0a 2d 35 30 36 35 0d 0a 2d 35 33 35 35 0d  -..-5065..-5355.
d110: 0a 2d 35 37 30 33 0d 0a 0d 0a 71 75 65 72 79 20  .-5703....query 
d120: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d130: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 33 20  T DISTINCT + 63 
d140: 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c  FROM tab1, tab2,
d150: 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
d160: 2d 2d 2d 0d 0a 36 33 0d 0a 0d 0a 71 75 65 72 79  ---..63....query
d170: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d180: 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
d190: 20 2b 20 2b 20 34 34 20 46 52 4f 4d 20 74 61 62   + + 44 FROM tab
d1a0: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
d1b0: 0a 31 32 36 0d 0a 34 35 0d 0a 37 37 0d 0a 0d 0a  .126..45..77....
d1c0: 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
d1d0: 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
d1e0: 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
d1f0: 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
d200: 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
d210: 72 74 20 6c 61 62 65 6c 2d 33 38 36 0d 0a 53 45  rt label-386..SE
d220: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
d230: 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20  + cor0.col0 + - 
d240: 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20  CAST( - col1 AS 
d250: 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 30  SIGNED ) AS col0
d260: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
d270: 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d  .----..-54..-67.
d280: 0a 32 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .23....skipif my
d290: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
d2a0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
d2b0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 38 36 0d  wsort label-386.
d2c0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
d2d0: 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b   - + cor0.col0 +
d2e0: 20 2d 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 31   - CAST ( - col1
d2f0: 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53   AS INTEGER ) AS
d300: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
d310: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d  cor0..----..-54.
d320: 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72  .-67..23....quer
d330: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
d340: 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2d 20 63  ECT + - col0 - c
d350: 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
d360: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
d370: 30 0d 0a 2d 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d  0..-132..-180...
d380: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
d390: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
d3a0: 63 6f 6c 31 20 2b 20 39 32 20 41 53 20 63 6f 6c  col1 + 92 AS col
d3b0: 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
d3c0: 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d 0a 31 38 33  ..----..178..183
d3d0: 0d 0a 31 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..189....onlyif 
d3e0: 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
d3f0: 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
d400: 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
d410: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
d420: 61 62 65 6c 2d 33 38 39 0d 0a 53 45 4c 45 43 54  abel-389..SELECT
d430: 20 2b 20 38 37 20 44 49 56 20 63 6f 6c 30 20 41   + 87 DIV col0 A
d440: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
d450: 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 32  ..----..1..1..12
d460: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
d470: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
d480: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
d490: 72 74 20 6c 61 62 65 6c 2d 33 38 39 0d 0a 53 45  rt label-389..SE
d4a0: 4c 45 43 54 20 2b 20 38 37 20 2f 20 63 6f 6c 30  LECT + 87 / col0
d4b0: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
d4c0: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a  b2..----..1..1..
d4d0: 31 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  12....onlyif mys
d4e0: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
d4f0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
d500: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
d510: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
d520: 6c 2d 33 39 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-390..SELECT - 
d530: 2d 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30 20  - col2 DIV col0 
d540: 2b 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 36 31 20  + - col0 + + 61 
d550: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
d560: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33  0..----..-18..-3
d570: 0d 0a 37 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..76....skipif m
d580: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
d590: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
d5a0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 30  owsort label-390
d5b0: 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
d5c0: 32 20 2f 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  2 / col0 + - col
d5d0: 30 20 2b 20 2b 20 36 31 20 46 52 4f 4d 20 74 61  0 + + 61 FROM ta
d5e0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
d5f0: 0d 0a 2d 31 38 0d 0a 2d 33 0d 0a 37 36 0d 0a 0d  ..-18..-3..76...
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 74  ..SELECT ALL - t
d620: 61 62 32 2e 63 6f 6c 31 20 2d 20 63 6f 6c 31 20  ab2.col1 - col1 
d630: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
d640: 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 0d 0a 2d  2..----..-118..-
d650: 33 34 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79  34..-62....query
d660: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
d670: 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f  CT ALL col1 * co
d680: 6c 31 20 2d 20 28 20 34 33 20 29 20 2a 20 2d 20  l1 - ( 43 ) * - 
d690: 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
d6a0: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  M tab0..----..10
d6b0: 39 31 34 0d 0a 31 32 31 30 38 0d 0a 38 34 32 38  914..12108..8428
d6c0: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
d6d0: 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
d6e0: 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
d6f0: 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
d700: 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
d710: 33 39 33 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  393..SELECT + co
d720: 6c 32 20 2a 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  l2 * col2 + col1
d730: 20 44 49 56 20 2b 20 63 6f 6c 31 20 63 6f 6c 30   DIV + col1 col0
d740: 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
d750: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 31 37 0d 0a  r0..----..2917..
d760: 33 32 35 30 0d 0a 39 32 31 37 0d 0a 0d 0a 73 6b  3250..9217....sk
d770: 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
d780: 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
d790: 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
d7a0: 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
d7b0: 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79  lumns..skipif my
d7c0: 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
d7d0: 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
d7e0: 77 73 6f 72 74 20 6c 61 62 65 6c 2d 33 39 33 0d  wsort label-393.
d7f0: 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
d800: 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 2f 20 2b   col2 + col1 / +
d810: 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20   col1 col0 FROM 
d820: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
d830: 2d 2d 0d 0a 32 39 31 37 0d 0a 33 32 35 30 0d 0a  --..2917..3250..
d840: 39 32 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  9217....query I 
d850: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
d860: 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  ALL - col1 * col
d870: 30 20 2b 20 39 36 20 2a 20 2d 20 63 6f 6c 31 20  0 + 96 * - col1 
d880: 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
d890: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 32 30 38  b0..----..-71208
d8a0: 30 0d 0a 2d 38 30 33 30 37 35 0d 0a 2d 39 30 36  0..-803075..-906
d8b0: 36 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  659....query I r
d8c0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
d8d0: 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2d  ISTINCT col1 + -
d8e0: 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f   cor0.col2 AS co
d8f0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
d900: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d  cor0..----..-28.
d910: 0a 2d 34 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65  .-47..-83....que
d920: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
d930: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
d940: 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30  r0.col0 * + col0
d950: 20 2d 20 39 34 20 2a 20 63 6f 6c 31 20 46 52 4f   - 94 * col1 FRO
d960: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
d970: 2d 2d 2d 2d 0d 0a 2d 32 38 36 35 0d 0a 34 36 34  ----..-2865..464
d980: 33 0d 0a 35 33 38 0d 0a 0d 0a 71 75 65 72 79 20  3..538....query 
d990: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
d9a0: 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63  T DISTINCT + + c
d9b0: 6f 72 30 2e 63 6f 6c 31 20 2b 20 35 39 20 46 52  or0.col1 + 59 FR
d9c0: 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
d9d0: 0a 2d 2d 2d 2d 0d 0a 31 34 35 0d 0a 31 35 30 0d  .----..145..150.
d9e0: 0a 31 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .156....query I 
d9f0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
da00: 2d 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 36 39 20  - + col1 + - 69 
da10: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
da20: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d  0..----..-100..-
da30: 31 32 38 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72  128..-86....quer
da40: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
da50: 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32  ECT ALL - - col2
da60: 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
da70: 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
da80: 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  .0..0..0....skip
da90: 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
daa0: 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
dab0: 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
dac0: 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
dad0: 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
dae0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
daf0: 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 39  TINCT - col0 * 9
db00: 33 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c 32 20  3 + + col0 col2 
db10: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
db20: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 36 0d 0a 2d  0..----..-276..-
db30: 35 38 38 38 0d 0a 2d 37 33 36 30 0d 0a 0d 0a 71  5888..-7360....q
db40: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
db50: 53 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20  SELECT - + col1 
db60: 2a 20 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d  * + ( col1 ) * -
db70: 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41   col0 + + col2 A
db80: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
db90: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
dba0: 31 33 36 31 36 0d 0a 32 30 38 32 0d 0a 36 34 35  13616..2082..645
dbb0: 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
dbc0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
dbd0: 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f   - - col2 * - co
dbe0: 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  l2 + + col0 * co
dbf0: 6c 30 20 2d 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  l0 - - cor0.col1
dc00: 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
dc10: 0a 2d 2d 2d 2d 0d 0a 2d 36 34 39 0d 0a 34 38 31  .----..-649..481
dc20: 34 0d 0a 35 34 36 37 0d 0a 0d 0a 71 75 65 72 79  4..5467....query
dc30: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
dc40: 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
dc50: 33 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c  30 + col0 AS col
dc60: 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
dc70: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 35  or0..----..-1015
dc80: 0d 0a 2d 32 35 38 31 0d 0a 2d 36 39 36 0d 0a 0d  ..-2581..-696...
dc90: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
dca0: 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
dcb0: 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20  T col2 * col1 + 
dcc0: 38 35 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f  85 + + col1 * co
dcd0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
dce0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 34 36 0d 0a  0..----..15646..
dcf0: 33 35 37 37 0d 0a 34 39 38 37 0d 0a 0d 0a 6f 6e  3577..4987....on
dd00: 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
dd10: 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
dd20: 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
dd30: 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
dd40: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
dd50: 20 6c 61 62 65 6c 2d 34 30 35 0d 0a 53 45 4c 45   label-405..SELE
dd60: 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 43 41  CT + col2 * + CA
dd70: 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
dd80: 45 44 20 29 20 2b 20 63 6f 6c 32 20 63 6f 6c 31  ED ) + col2 col1
dd90: 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
dda0: 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
ddb0: 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
ddc0: 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
ddd0: 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
dde0: 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
ddf0: 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
de00: 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ns..skipif mysql
de10: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
de20: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
de30: 72 74 20 6c 61 62 65 6c 2d 34 30 35 0d 0a 53 45  rt label-405..SE
de40: 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20  LECT + col2 * + 
de50: 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
de60: 4e 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32 20  NTEGER ) + col2 
de70: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
de80: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
de90: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
dea0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
deb0: 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
dec0: 2b 20 63 6f 6c 32 20 2a 20 31 34 20 2a 20 63 6f  + col2 * 14 * co
ded0: 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
dee0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 30  cor0..----..1020
def0: 38 31 0d 0a 31 31 30 30 32 0d 0a 33 39 33 0d 0a  81..11002..393..
df00: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
df10: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
df20: 20 2a 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30   * col2 - - col0
df30: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
df40: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
df50: 0d 0a 37 30 0d 0a 37 33 38 37 0d 0a 38 31 36 0d  ..70..7387..816.
df60: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
df70: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
df80: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
df90: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
dfa0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
dfb0: 30 38 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61 62  08..SELECT - tab
dfc0: 32 2e 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20  2.col0 DIV col1 
dfd0: 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
dfe0: 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a 73 6b  .-1..-4..0....sk
dff0: 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
e000: 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
e010: 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
e020: 65 6c 2d 34 30 38 0d 0a 53 45 4c 45 43 54 20 2d  el-408..SELECT -
e030: 20 74 61 62 32 2e 63 6f 6c 30 20 2f 20 63 6f 6c   tab2.col0 / col
e040: 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
e050: 2d 0d 0a 2d 31 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a  -..-1..-4..0....
e060: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e070: 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63  .SELECT + tab1.c
e080: 6f 6c 32 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20  ol2 * tab1.col1 
e090: 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
e0a0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 32 0d 0a  b1..----..1152..
e0b0: 31 33 35 30 0d 0a 35 31 33 0d 0a 0d 0a 71 75 65  1350..513....que
e0c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e0d0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
e0e0: 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  l2 + - col1 * co
e0f0: 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
e100: 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36 32 32 0d 0a 2d  --..-43..-622..-
e110: 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  73....query I ro
e120: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
e130: 4c 20 74 61 62 32 2e 63 6f 6c 31 20 2b 20 63 6f  L tab2.col1 + co
e140: 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
e150: 2d 2d 0d 0a 31 31 38 0d 0a 33 34 0d 0a 36 32 0d  --..118..34..62.
e160: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
e170: 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
e180: 4e 43 54 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20  NCT - tab0.col2 
e190: 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
e1a0: 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
e1b0: 35 33 0d 0a 39 0d 0a 39 36 0d 0a 0d 0a 71 75 65  53..9..96....que
e1c0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
e1d0: 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61  LECT DISTINCT ta
e1e0: 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30  b1.col1 + - col0
e1f0: 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * + col0 AS col
e200: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
e210: 2d 0d 0a 2d 34 30 38 36 0d 0a 2d 36 33 38 37 0d  -..-4086..-6387.
e220: 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .17....query I r
e230: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
e240: 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  LL + col2 + col1
e250: 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
e260: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 31  b0..----..119..1
e270: 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  73..98....query 
e280: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e290: 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c  T ALL col0 + col
e2a0: 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 + + col0 AS co
e2b0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
e2c0: 2d 2d 0d 0a 32 31 0d 0a 32 33 34 0d 0a 32 33 37  --..21..234..237
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 2b 20 63 6f 6c 30 20 2b 20 2b 20  INCT + col0 + + 
e300: 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
e310: 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  M tab0..----..17
e320: 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65  8..48..70....que
e330: 72 79 20 49 49 49 49 49 49 49 49 49 20 72 6f 77  ry IIIIIIIII row
e340: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
e350: 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  TINCT * FROM tab
e360: 30 2c 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  0, tab2, tab0 AS
e370: 20 63 6f 72 30 20 57 48 45 52 45 20 4e 55 4c 4c   cor0 WHERE NULL
e380: 20 3c 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a   <= NULL..----..
e390: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e3a0: 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
e3b0: 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  l2 * + cor0.col1
e3c0: 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 31   + + col1 - col1
e3d0: 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
e3e0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a  r0..----..1534..
e3f0: 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75 65 72  646..837....quer
e400: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e410: 45 43 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20  ECT col1 + col1 
e420: 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  - + col1 AS col2
e430: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
e440: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31  r0..----..86..91
e450: 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..97....onlyif m
e460: 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
e470: 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
e480: 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
e490: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
e4a0: 62 65 6c 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20  bel-420..SELECT 
e4b0: 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c  - col1 DIV + col
e4c0: 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0 col0 FROM tab1
e4d0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30  ..----..-8..0..0
e4e0: 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
e4f0: 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
e500: 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
e510: 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
e520: 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
e530: 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
e540: 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
e550: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
e560: 6c 2d 34 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20  l-420..SELECT - 
e570: 63 6f 6c 31 20 2f 20 2b 20 63 6f 6c 30 20 63 6f  col1 / + col0 co
e580: 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
e590: 2d 2d 0d 0a 2d 38 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-8..0..0....
e5a0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
e5b0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
e5c0: 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 74   col2 * col0 * t
e5d0: 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ab1.col0 FROM ta
e5e0: 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33 34 37 32  b1..----..233472
e5f0: 0d 0a 34 38 36 0d 0a 36 31 34 34 30 30 0d 0a 0d  ..486..614400...
e600: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
e610: 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
e620: 2d 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  - tab0.col0 AS c
e630: 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
e640: 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d  ---..-35..-7298.
e650: 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  .-792....query I
e660: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
e670: 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
e680: 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
e690: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a  or0..----..119..
e6a0: 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79  173..98....query
e6b0: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
e6c0: 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20  CT ALL + col0 * 
e6d0: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
e6e0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
e6f0: 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38 34  ..----..49..6084
e700: 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79 20  ..6241....query 
e710: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
e720: 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
e730: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
e740: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38  or0..----..7..78
e750: 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..79....query I 
e760: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e770: 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20  DISTINCT col0 * 
e780: 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  tab0.col2 FROM t
e790: 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  ab0..----..35..7
e7a0: 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72  298..792....quer
e7b0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e7c0: 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  ECT - col2 * + c
e7d0: 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 - col1 AS co
e7e0: 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
e7f0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 38  cor0..----..-188
e800: 0d 0a 2d 33 36 35 38 0d 0a 2d 37 36 39 33 0d 0a  ..-3658..-7693..
e810: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
e820: 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
e830: 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f   + - col0 * + co
e840: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l2 FROM tab2 cor
e850: 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 32 0d 0a 2d  0..----..-182..-
e860: 31 39 35 30 0d 0a 2d 32 39 32 33 0d 0a 0d 0a 71  1950..-2923....q
e870: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
e880: 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63  SELECT ALL - + c
e890: 6f 6c 30 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  ol0 - col1 AS co
e8a0: 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
e8b0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 37  cor0..----..-137
e8c0: 0d 0a 2d 33 38 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  ..-38..-96....qu
e8d0: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
e8e0: 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b  ELECT + col2 * +
e8f0: 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b   col2 * - col2 +
e900: 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   + cor0.col2 FRO
e910: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
e920: 2d 2d 2d 2d 0d 0a 2d 33 35 39 30 34 0d 0a 2d 35  ----..-35904..-5
e930: 35 31 32 38 36 0d 0a 30 0d 0a 0d 0a 71 75 65 72  51286..0....quer
e940: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
e950: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
e960: 32 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 + + col0 AS co
e970: 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
e980: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36  0..----..171..36
e990: 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..57....query I 
e9a0: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
e9b0: 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
e9c0: 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l2 * col0 + + co
e9d0: 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
e9e0: 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 34  cor0..----..2054
e9f0: 0d 0a 32 31 36 0d 0a 33 30 34 30 0d 0a 0d 0a 71  ..216..3040....q
ea00: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
ea10: 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20  SELECT ALL col0 
ea20: 2b 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20  + col1 * - col2 
ea30: 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  * col0 FROM tab2
ea40: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
ea50: 39 35 37 34 0d 0a 2d 35 30 39 35 35 0d 0a 2d 35  9574..-50955..-5
ea60: 38 35 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  852....query I r
ea70: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
ea80: 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
ea90: 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20   cor0.col0 FROM 
eaa0: 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
eab0: 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36 0d  --..-1225..-576.
eac0: 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20  .-7921....query 
ead0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
eae0: 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  T col2 * + col0 
eaf0: 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
eb00: 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38  2 cor0..----..18
eb10: 39 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d  9..2028..3002...
eb20: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
eb30: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
eb40: 32 20 2a 20 2b 20 74 61 62 30 2e 63 6f 6c 30 20  2 * + tab0.col0 
eb50: 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  + - col0 FROM ta
eb60: 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 37 32 30  b0..----..0..720
eb70: 39 0d 0a 37 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  9..768....onlyif
eb80: 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
eb90: 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
eba0: 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
ebb0: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
ebc0: 6c 61 62 65 6c 2d 34 33 37 0d 0a 53 45 4c 45 43  label-437..SELEC
ebd0: 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b  T ALL + col0 + +
ebe0: 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 41   col0 DIV col0 A
ebf0: 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
ec00: 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 38 0d 0a 38  ..----..79..8..8
ec10: 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
ec20: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
ec30: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
ec40: 6f 72 74 20 6c 61 62 65 6c 2d 34 33 37 0d 0a 53  ort label-437..S
ec50: 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
ec60: 20 2b 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30   + + col0 / col0
ec70: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
ec80: 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 39 0d 0a 38 0d  b2..----..79..8.
ec90: 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .80....query I r
eca0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
ecb0: 6f 6c 30 20 2a 20 2d 20 74 61 62 32 2e 63 6f 6c  ol0 * - tab2.col
ecc0: 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
ecd0: 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  ab2..----..-1343
ece0: 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
ecf0: 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
ed00: 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
ed10: 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20 63  col2 * col2 AS c
ed20: 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
ed30: 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
ed40: 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71 75  1089..6724....qu
ed50: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
ed60: 45 4c 45 43 54 20 2d 20 2d 20 63 6f 72 30 2e 63  ELECT - - cor0.c
ed70: 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  ol0 * - col2 FRO
ed80: 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
ed90: 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a  -..-189..-2028..
eda0: 2d 33 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -3002....query I
edb0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
edc0: 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30   + col0 * + col0
edd0: 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74   - + col1 FROM t
ede0: 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
edf0: 2d 0d 0a 31 31 32 38 0d 0a 34 39 30 0d 0a 37 38  -..1128..490..78
ee00: 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  30....query I ro
ee10: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
ee20: 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b 20 2b 20  STINCT col2 + + 
ee30: 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74  cor0.col0 FROM t
ee40: 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
ee50: 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d  -..121..176..57.
ee60: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
ee70: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
ee80: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
ee90: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
eea0: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
eeb0: 34 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  43..SELECT DISTI
eec0: 4e 43 54 20 2d 20 63 6f 6c 32 20 44 49 56 20 63  NCT - col2 DIV c
eed0: 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  ol1 col0 FROM ta
eee0: 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
eef0: 0d 0a 2d 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a  ..-2..-5..-7....
ef00: 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
ef10: 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
ef20: 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
ef30: 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
ef40: 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20  columns..skipif 
ef50: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
ef60: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
ef70: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34  rowsort label-44
ef80: 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
ef90: 43 54 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31  CT - col2 / col1
efa0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
efb0: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
efc0: 32 0d 0a 2d 35 0d 0a 2d 37 0d 0a 0d 0a 71 75 65  2..-5..-7....que
efd0: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
efe0: 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  LECT col2 + - co
eff0: 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l1 * col2 FROM t
f000: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f010: 2d 0d 0a 2d 31 35 30 38 0d 0a 2d 36 30 38 0d 0a  -..-1508..-608..
f020: 2d 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -810....query I 
f030: 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
f040: 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29  ALL - ( + col1 )
f050: 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
f060: 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
f070: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
f080: 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .0....onlyif mys
f090: 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
f0a0: 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
f0b0: 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
f0c0: 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
f0d0: 6c 2d 34 34 36 0d 0a 53 45 4c 45 43 54 20 41 4c  l-446..SELECT AL
f0e0: 4c 20 2b 20 63 6f 6c 31 20 44 49 56 20 2b 20 63  L + col1 DIV + c
f0f0: 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  ol1 col1 FROM ta
f100: 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
f110: 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..1..1..1....ski
f120: 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
f130: 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
f140: 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
f150: 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
f160: 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
f170: 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
f180: 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
f190: 73 6f 72 74 20 6c 61 62 65 6c 2d 34 34 36 0d 0a  sort label-446..
f1a0: 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
f1b0: 31 20 2f 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20  1 / + col1 col1 
f1c0: 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
f1d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31  0..----..1..1..1
f1e0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f1f0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
f200: 34 35 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  45 AS col2 FROM 
f210: 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
f220: 2d 2d 0d 0a 34 35 0d 0a 34 35 0d 0a 34 35 0d 0a  --..45..45..45..
f230: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f240: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
f250: 37 39 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  79 * + cor0.col0
f260: 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
f270: 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 36 0d 0a 2d 32  .----..-1896..-2
f280: 37 36 35 0d 0a 2d 37 30 33 31 0d 0a 0d 0a 71 75  765..-7031....qu
f290: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
f2a0: 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
f2b0: 6f 72 30 2e 63 6f 6c 30 20 2b 20 63 6f 6c 32 20  or0.col0 + col2 
f2c0: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
f2d0: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 0d 0a 31 31  0..----..104..11
f2e0: 37 0d 0a 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  7..34....query I
f2f0: 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
f300: 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32   DISTINCT + col2
f310: 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   * cor0.col1 * -
f320: 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72   cor0.col2 + cor
f330: 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 46 52  0.col1 * col1 FR
f340: 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
f350: 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 33 39 0d 0a  .----..-119639..
f360: 2d 33 32 33 39 30 0d 0a 2d 37 35 31 34 30 0d 0a  -32390..-75140..
f370: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f380: 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
f390: 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f  - cor0.col2 * co
f3a0: 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  r0.col0 FROM tab
f3b0: 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
f3c0: 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
f3d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f3e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  ort..SELECT + + 
f3f0: 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  ( col1 ) FROM ta
f400: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b1 cor0..----..1
f410: 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65  0..13..26....que
f420: 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
f430: 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20  LECT - + col0 * 
f440: 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
f450: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
f460: 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39  064..-3395..-809
f470: 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
f480: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
f490: 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 41   - col1 * col1 A
f4a0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
f4b0: 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
f4c0: 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36  -100..-169..-676
f4d0: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
f4e0: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
f4f0: 49 4e 43 54 20 2d 20 2b 20 34 33 20 2a 20 2d 20  INCT - + 43 * - 
f500: 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
f510: 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
f520: 2d 0d 0a 31 33 33 33 0d 0a 32 35 33 37 0d 0a 37  -..1333..2537..7
f530: 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  31....query I ro
f540: 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
f550: 4c 20 31 36 20 46 52 4f 4d 20 74 61 62 30 20 41  L 16 FROM tab0 A
f560: 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36  S cor0..----..16
f570: 0d 0a 31 36 0d 0a 31 36 0d 0a 0d 0a 71 75 65 72  ..16..16....quer
f580: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f590: 45 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 63  ECT - - col2 * c
f5a0: 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32  or0.col1 AS col2
f5b0: 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
f5c0: 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a  r0..----..2838..
f5d0: 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79  7462..97....only
f5e0: 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
f5f0: 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
f600: 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
f610: 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
f620: 74 20 6c 61 62 65 6c 2d 34 35 38 0d 0a 53 45 4c  t label-458..SEL
f630: 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56  ECT ALL col2 DIV
f640: 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
f650: 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
f660: 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33  0..----..0..0..3
f670: 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
f680: 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
f690: 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
f6a0: 72 74 20 6c 61 62 65 6c 2d 34 35 38 0d 0a 53 45  rt label-458..SE
f6b0: 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20  LECT ALL col2 / 
f6c0: 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
f6d0: 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
f6e0: 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33 0d  ..----..0..0..3.
f6f0: 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
f700: 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
f710: 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol1 + - cor0.col
f720: 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * - cor0.col2 
f730: 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
f740: 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 38 0d 0a 33 36  0..----..188..36
f750: 35 38 0d 0a 37 36 39 33 0d 0a 0d 0a 71 75 65 72  58..7693....quer
f760: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
f770: 45 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2d 20 2b  ECT + + col0 - +
f780: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
f790: 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30  AS cor0..----..0
f7a0: 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20  ..0..0....query 
f7b0: 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
f7c0: 54 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20  T col1 * - col0 
f7d0: 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
f7e0: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 35 38  ..----..-24..-58
f7f0: 33 0d 0a 2d 39 34 34 0d 0a 0d 0a 71 75 65 72 79  3..-944....query
f800: 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
f810: 43 54 20 41 4c 4c 20 28 20 63 6f 6c 31 20 29 20  CT ALL ( col1 ) 
f820: 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30  * + col2 AS col0
f830: 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
f840: 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37  ..1248..1404..57
f850: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
f860: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 63  sort..SELECT ( c
f870: 6f 6c 31 20 29 20 2d 20 2d 20 38 30 20 46 52 4f  ol1 ) - - 80 FRO
f880: 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
f890: 2d 2d 2d 2d 0d 0a 31 36 36 0d 0a 31 37 31 0d 0a  ----..166..171..
f8a0: 31 37 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  177....query I r
f8b0: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
f8c0: 20 37 35 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 63   75 * + col0 + c
f8d0: 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ol1 + col2 FROM 
f8e0: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 31 39  tab0..----..1919
f8f0: 0d 0a 32 37 32 33 0d 0a 36 38 34 38 0d 0a 0d 0a  ..2723..6848....
f900: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
f910: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
f920: 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   + col0 + + col1
f930: 20 2a 20 74 61 62 31 2e 63 6f 6c 30 20 41 53 20   * tab1.col0 AS 
f940: 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col0 FROM tab1..
f950: 2d 2d 2d 2d 0d 0a 31 31 32 30 0d 0a 37 30 34 0d  ----..1120..704.
f960: 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .81....query I r
f970: 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
f980: 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30   - col2 * + col0
f990: 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
f9a0: 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
f9b0: 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38  162..-3648..-768
f9c0: 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
f9d0: 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33  sort..SELECT + 3
f9e0: 30 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20 41  0 * ( - col0 ) A
f9f0: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
fa00: 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30 0d 0a 2d 32  ..----..-210..-2
fa10: 33 34 30 0d 0a 2d 32 33 37 30 0d 0a 0d 0a 71 75  340..-2370....qu
fa20: 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
fa30: 45 4c 45 43 54 20 28 20 2b 20 35 36 20 29 20 2a  ELECT ( + 56 ) *
fa40: 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 33 20 41   tab0.col2 * 3 A
fa50: 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
fa60: 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 37 36 0d 0a 31  ..----..13776..1
fa70: 36 38 0d 0a 35 35 34 34 0d 0a 0d 0a 6f 6e 6c 79  68..5544....only
fa80: 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
fa90: 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
faa0: 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
fab0: 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
fac0: 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
fad0: 61 62 65 6c 2d 34 36 39 0d 0a 53 45 4c 45 43 54  abel-469..SELECT
fae0: 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
faf0: 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31 20  IGNED ) AS col1 
fb00: 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
fb10: 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
fb20: 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
fb30: 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
fb40: 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
fb50: 6f 72 74 20 6c 61 62 65 6c 2d 34 36 39 0d 0a 53  ort label-469..S
fb60: 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c  ELECT CAST ( NUL
fb70: 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 41  L AS INTEGER ) A
fb80: 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
fb90: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
fba0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
fbb0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fbc0: 45 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 41 53  ECT tab1.col2 AS
fbd0: 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 2c   col0 FROM tab1,
fbe0: 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
fbf0: 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or0..----..27 va
fc00: 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
fc10: 37 66 34 61 39 62 66 32 34 64 36 34 38 33 33 37  7f4a9bf24d648337
fc20: 30 36 64 66 62 64 64 30 62 61 66 34 39 64 37 39  06dfbdd0baf49d79
fc30: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
fc40: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
fc50: 28 20 2b 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c  ( + col0 ) + col
fc60: 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
fc70: 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
fc80: 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
fc90: 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
fca0: 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
fcb0: 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
fcc0: 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
fcd0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 32  owsort label-472
fce0: 0d 0a 53 45 4c 45 43 54 20 28 20 33 32 20 29 20  ..SELECT ( 32 ) 
fcf0: 2b 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 43 41 53  + + col1 / + CAS
fd00: 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
fd10: 44 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  D ) FROM tab0..-
fd20: 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
fd30: 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
fd40: 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
fd50: 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
fd60: 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37  rowsort label-47
fd70: 32 0d 0a 53 45 4c 45 43 54 20 28 20 33 32 20 29  2..SELECT ( 32 )
fd80: 20 2b 20 2b 20 63 6f 6c 31 20 2f 20 2b 20 43 41   + + col1 / + CA
fd90: 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
fda0: 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30  EGER ) FROM tab0
fdb0: 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
fdc0: 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
fdd0: 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
fde0: 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
fdf0: 31 20 2a 20 74 61 62 31 2e 63 6f 6c 32 20 2b 20  1 * tab1.col2 + 
fe00: 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
fe10: 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
fe20: 31 31 36 38 0d 0a 31 34 30 31 0d 0a 35 30 36 0d  1168..1401..506.
fe30: 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
fe40: 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
fe50: 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
fe60: 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
fe70: 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34   rowsort label-4
fe80: 37 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  74..SELECT ALL +
fe90: 20 63 6f 6c 30 20 44 49 56 20 33 31 20 2b 20 2d   col0 DIV 31 + -
fea0: 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
feb0: 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 35 35 0d  .----..-54..-55.
fec0: 0a 2d 39 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-94....skipif m
fed0: 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
fee0: 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
fef0: 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 34  owsort label-474
ff00: 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
ff10: 6f 6c 30 20 2f 20 33 31 20 2b 20 2d 20 63 6f 6c  ol0 / 31 + - col
ff20: 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  2 FROM tab1..---
ff30: 2d 0d 0a 2d 35 34 0d 0a 2d 35 35 0d 0a 2d 39 34  -..-54..-55..-94
ff40: 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
ff50: 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 34 20 2a  ort..SELECT 64 *
ff60: 20 74 61 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab0.col1 FROM 
ff70: 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 30 34  tab0..----..5504
ff80: 0d 0a 35 38 32 34 0d 0a 36 32 30 38 0d 0a 0d 0a  ..5824..6208....
ff90: 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
ffa0: 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
ffb0: 20 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f   - cor1.col1 FRO
ffc0: 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43  M tab2 AS cor0 C
ffd0: 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41  ROSS JOIN tab0 A
ffe0: 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 38  S cor1..----..-8
fff0: 36 0d 0a 2d 39 31 0d 0a 2d 39 37 0d 0a 0d 0a 73  6..-91..-97....s
10000 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
10010 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
10020 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
10030 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
10040 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
10050 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10060 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  + - cor0.col2 * 
10070 63 6f 6c 31 20 2b 20 2d 20 28 20 2b 20 28 20 63  col1 + - ( + ( c
10080 6f 6c 31 20 29 20 29 20 63 6f 6c 32 20 46 52 4f  ol1 ) ) col2 FRO
10090 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
100a0 2d 2d 2d 2d 0d 0a 2d 31 35 39 33 0d 0a 2d 36 36  ----..-1593..-66
100b0 33 0d 0a 2d 38 36 38 0d 0a 0d 0a 71 75 65 72 79  3..-868....query
100c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
100d0 43 54 20 2b 20 2d 20 33 32 20 41 53 20 63 6f 6c  CT + - 32 AS col
100e0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
100f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 32 0d 0a  or0..----..-32..
10100 2d 33 32 0d 0a 2d 33 32 0d 0a 0d 0a 6f 6e 6c 79  -32..-32....only
10110 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
10120 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
10130 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
10140 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10150 74 20 6c 61 62 65 6c 2d 34 37 39 0d 0a 53 45 4c  t label-479..SEL
10160 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ECT + cor0.col2 
10170 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  + - col2 DIV - c
10180 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
10190 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
101a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38  r0..----..55..58
101b0 0d 0a 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..97....skipif m
101c0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
101d0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
101e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 37 39  owsort label-479
101f0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e  ..SELECT + cor0.
10200 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2f 20  col2 + - col2 / 
10210 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  - cor0.col2 AS c
10220 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
10230 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d   cor0..----..55.
10240 0a 35 38 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79  .58..97....query
10250 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
10260 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
10270 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
10280 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
10290 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d 0a 2d  ----..-1..-33..-
102a0 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
102b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
102c0 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72  L + col0 + - cor
102d0 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  0.col1 * + col0 
102e0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
102f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
10300 0a 2d 32 30 34 30 0d 0a 2d 33 33 36 30 0d 0a 2d  .-2040..-3360..-
10310 38 30 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8010....query I 
10320 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10330 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20  + col2 + col0 * 
10340 2d 20 32 37 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 27 AS col2 FRO
10350 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
10360 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 32 30 38  ----..-162..-208
10370 30 0d 0a 2d 32 30 39 35 0d 0a 0d 0a 71 75 65 72  0..-2095....quer
10380 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
10390 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
103a0 6f 6c 30 20 2b 20 2d 20 28 20 2d 20 63 6f 72 30  ol0 + - ( - cor0
103b0 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62  .col0 ) FROM tab
103c0 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  1 cor0..----..0.
103d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
103e0 72 74 0d 0a 53 45 4c 45 43 54 20 39 34 20 41 53  rt..SELECT 94 AS
103f0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
10400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34 0d 0a  cor0..----..94..
10410 39 34 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72 79 20  94..94....query 
10420 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
10430 54 20 63 6f 72 31 2e 63 6f 6c 32 20 46 52 4f 4d  T cor1.col2 FROM
10440 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
10450 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72  or0, tab1 AS cor
10460 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
10470 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 66  es hashing to 7f
10480 34 61 39 62 66 32 34 64 36 34 38 33 33 37 30 36  4a9bf24d64833706
10490 64 66 62 64 64 30 62 61 66 34 39 64 37 39 0d 0a  dfbdd0baf49d79..
104a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
104b0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  t..SELECT + col0
104c0 20 2a 20 2d 20 37 36 20 46 52 4f 4d 20 74 61 62   * - 76 FROM tab
104d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
104e0 0a 2d 31 38 32 34 0d 0a 2d 32 36 36 30 0d 0a 2d  .-1824..-2660..-
104f0 36 37 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6764....query I 
10500 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10510 41 4c 4c 20 2d 20 28 20 2b 20 39 39 20 29 20 41  ALL - ( + 99 ) A
10520 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
10530 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 39 0d 0a 2d 39 39  ..----..-99..-99
10540 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-99....query I
10550 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10560 20 28 20 2b 20 63 6f 6c 31 20 29 20 2a 20 63 6f   ( + col1 ) * co
10570 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
10580 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  cor0..----..1534
10590 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75  ..646..837....qu
105a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
105b0 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 35  ELECT + col1 * 5
105c0 33 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  3 AS col0 FROM t
105d0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
105e0 2d 0d 0a 34 35 35 38 0d 0a 34 38 32 33 0d 0a 35  -..4558..4823..5
105f0 31 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  141....query I r
10600 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
10610 20 30 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   0 + col0 AS col
10620 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
10630 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 33  or0..----..24..3
10640 35 0d 0a 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20  5..89....skipif 
10650 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
10660 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
10670 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
10680 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
10690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
106a0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
106b0 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a 20 2d  CT tab1.col2 * -
106c0 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20   col0 col0 FROM 
106d0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32  tab1..----..-162
106e0 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a  ..-3648..-7680..
106f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
10700 74 0d 0a 53 45 4c 45 43 54 20 37 30 20 2b 20 63  t..SELECT 70 + c
10710 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
10720 2d 2d 2d 0d 0a 31 33 34 0d 0a 31 35 30 0d 0a 37  ---..134..150..7
10730 33 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  3....query IIIII
10740 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
10750 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
10760 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c  NCT * FROM tab1,
10770 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
10780 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74  OSS JOIN tab0, t
10790 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
107a0 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61  1..----..3645 va
107b0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
107c0 35 38 62 35 33 64 39 66 32 63 35 64 37 39 65 36  58b53d9f2c5d79e6
107d0 66 65 39 34 62 34 61 39 37 32 37 32 34 34 30 65  fe94b4a97272440e
107e0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
107f0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
10800 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
10810 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
10820 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
10830 34 39 34 0d 0a 53 45 4c 45 43 54 20 2b 20 31 39  494..SELECT + 19
10840 20 44 49 56 20 2b 20 63 6f 6c 30 20 41 53 20 63   DIV + col0 AS c
10850 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
10860 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a   cor0..----..0..
10870 30 0d 0a 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0..6....skipif m
10880 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
10890 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
108a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 34  owsort label-494
108b0 0d 0a 53 45 4c 45 43 54 20 2b 20 31 39 20 2f 20  ..SELECT + 19 / 
108c0 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  + col0 AS col1 F
108d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
108e0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 36 0d  ..----..0..0..6.
108f0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
10900 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
10910 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
10920 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
10930 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
10940 77 73 6f 72 74 20 6c 61 62 65 6c 2d 34 39 35 0d  wsort label-495.
10950 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41  .SELECT ALL - CA
10960 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
10970 45 44 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  ED ) + + cor0.co
10980 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
10990 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
109a0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
109b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
109c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
109d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
109e0 61 62 65 6c 2d 34 39 35 0d 0a 53 45 4c 45 43 54  abel-495..SELECT
109f0 20 41 4c 4c 20 2d 20 43 41 53 54 20 28 20 4e 55   ALL - CAST ( NU
10a00 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
10a10 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  + + cor0.col0 FR
10a20 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
10a30 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
10a40 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e 6c 79 69  L..NULL....onlyi
10a50 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
10a60 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
10a70 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
10a80 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
10a90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10aa0 62 65 6c 2d 34 39 36 0d 0a 53 45 4c 45 43 54 20  bel-496..SELECT 
10ab0 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  - CAST( NULL AS 
10ac0 53 49 47 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c  SIGNED ) * + col
10ad0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
10ae0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
10af0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
10b00 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
10b10 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
10b20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
10b30 62 65 6c 2d 34 39 36 0d 0a 53 45 4c 45 43 54 20  bel-496..SELECT 
10b40 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
10b50 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63   INTEGER ) * + c
10b60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
10b70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
10b80 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
10b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
10ba0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28  ..SELECT ALL - (
10bb0 20 63 6f 6c 31 20 29 20 2a 20 2b 20 63 6f 6c 32   col1 ) * + col2
10bc0 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   * col2 AS col2 
10bd0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
10be0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 35 39 39 0d  0..----..-22599.
10bf0 0a 2d 32 34 35 34 38 0d 0a 2d 33 39 38 38 34 0d  .-24548..-39884.
10c00 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
10c10 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
10c20 6f 72 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c  or0.col0 - - col
10c30 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
10c40 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
10c50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 30 0d 0a  0..----..-2040..
10c60 2d 33 33 36 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a  -3360..-8010....
10c70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
10c80 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
10c90 20 2b 20 2b 20 31 33 20 41 53 20 63 6f 6c 32 20   + + 13 AS col2 
10ca0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
10cb0 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a 0d 0a 73  0..----..13....s
10cc0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
10cd0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
10ce0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
10cf0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
10d00 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
10d10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10d20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20  - col2 * - col2 
10d30 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
10d40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d  S cor0..----..1.
10d50 0a 31 30 38 39 0d 0a 36 37 32 34 0d 0a 0d 0a 71  .1089..6724....q
10d60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
10d70 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63 6f 72  SELECT - ( + cor
10d80 30 2e 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32  0.col1 ) AS col2
10d90 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
10da0 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d  .----..-86..-91.
10db0 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-97....query I 
10dc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
10dd0 2d 20 2b 20 38 32 20 41 53 20 63 6f 6c 31 20 46  - + 82 AS col1 F
10de0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
10df0 2d 2d 2d 0d 0a 2d 38 32 0d 0a 2d 38 32 0d 0a 2d  ---..-82..-82..-
10e00 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  82....query I ro
10e10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
10e20 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 29 20 41  + ( - col1 ) ) A
10e30 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
10e40 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31  ..----..-17..-31
10e50 0d 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-59....query I
10e60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
10e70 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30   DISTINCT - cor0
10e80 2e 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 31 20 46  .col2 - - col1 F
10e90 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
10ea0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d  ..----..-21..33.
10eb0 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .4....query I ro
10ec0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
10ed0 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e  STINCT + + cor0.
10ee0 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2d 20  col1 + col0 * - 
10ef0 28 20 32 37 20 29 20 46 52 4f 4d 20 74 61 62 32  ( 27 ) FROM tab2
10f00 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
10f10 2d 31 35 38 0d 0a 2d 32 30 34 37 0d 0a 2d 32 31  -158..-2047..-21
10f20 31 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  16....onlyif mys
10f30 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
10f40 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
10f50 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
10f60 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
10f70 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
10f80 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  06..SELECT DISTI
10f90 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  NCT col2 * col2 
10fa0 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
10fb0 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61  SIGNED ) FROM ta
10fc0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
10fd0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
10fe0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
10ff0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
11000 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35   rowsort label-5
11010 30 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  06..SELECT DISTI
11020 4e 43 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  NCT col2 * col2 
11030 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  * CAST ( NULL AS
11040 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20   INTEGER ) FROM 
11050 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
11060 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  --..NULL....quer
11070 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
11080 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
11090 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41 53 20   col2 * col2 AS 
110a0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
110b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
110c0 37 35 0d 0a 36 38 31 35 0d 0a 39 38 0d 0a 0d 0a  75..6815..98....
110d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
110e0 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c  .SELECT cor0.col
110f0 31 20 2a 20 2b 20 34 34 20 41 53 20 63 6f 6c 31  1 * + 44 AS col1
11100 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
11110 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 38 34 0d 0a  r0..----..3784..
11120 34 30 30 34 0d 0a 34 32 36 38 0d 0a 0d 0a 6f 6e  4004..4268....on
11130 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
11140 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
11150 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
11160 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
11170 6f 72 74 20 6c 61 62 65 6c 2d 35 30 39 0d 0a 53  ort label-509..S
11180 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20 28 20 2b  ELECT col1 + ( +
11190 20 63 6f 6c 31 20 29 20 44 49 56 20 63 6f 6c 31   col1 ) DIV col1
111a0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
111b0 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32  .----..11..14..2
111c0 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  7....skipif post
111d0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
111e0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
111f0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
11200 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
11210 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
11220 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
11230 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
11240 65 6c 2d 35 30 39 0d 0a 53 45 4c 45 43 54 20 63  el-509..SELECT c
11250 6f 6c 31 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29  ol1 + ( + col1 )
11260 20 2f 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f   / col1 col0 FRO
11270 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31  M tab1..----..11
11280 0d 0a 31 34 0d 0a 32 37 0d 0a 0d 0a 71 75 65 72  ..14..27....quer
11290 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
112a0 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63  ECT ALL + cor0.c
112b0 6f 6c 30 20 2d 20 28 20 2b 20 63 6f 72 30 2e 63  ol0 - ( + cor0.c
112c0 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 2c  ol2 ) FROM tab1,
112d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
112e0 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
112f0 73 68 69 6e 67 20 74 6f 20 34 36 34 36 65 64 38  shing to 4646ed8
11300 37 65 38 63 63 35 61 61 63 62 35 31 66 39 62 34  7e8cc5aacb51f9b4
11310 65 34 37 32 63 33 63 34 62 0d 0a 0d 0a 71 75 65  e472c3c4b....que
11320 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11330 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
11340 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  col2 + col2 FROM
11350 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
11360 2d 2d 2d 0d 0a 31 30 38 0d 0a 31 31 34 0d 0a 31  ---..108..114..1
11370 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  92....onlyif mys
11380 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
11390 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
113a0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
113b0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
113c0 6c 2d 35 31 32 0d 0a 53 45 4c 45 43 54 20 2d 20  l-512..SELECT - 
113d0 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col1 + - cor0.co
113e0 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20  l2 + + col2 DIV 
113f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63  col2 FROM tab1 c
11400 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d  or0..----..-108.
11410 0a 2d 36 36 0d 0a 2d 37 39 0d 0a 0d 0a 73 6b 69  .-66..-79....ski
11420 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11430 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11440 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11450 6c 2d 35 31 32 0d 0a 53 45 4c 45 43 54 20 2d 20  l-512..SELECT - 
11460 63 6f 6c 31 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col1 + - cor0.co
11470 6c 32 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 63 6f  l2 + + col2 / co
11480 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
11490 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d  0..----..-108..-
114a0 36 36 0d 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c 79 69  66..-79....onlyi
114b0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
114c0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
114d0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
114e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
114f0 20 6c 61 62 65 6c 2d 35 31 33 0d 0a 53 45 4c 45   label-513..SELE
11500 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
11510 20 44 49 56 20 2d 20 36 37 20 2b 20 2b 20 63 6f   DIV - 67 + + co
11520 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
11530 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
11540 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 35 0d 0a  --..54..57..95..
11550 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
11560 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
11570 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11580 20 6c 61 62 65 6c 2d 35 31 33 0d 0a 53 45 4c 45   label-513..SELE
11590 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
115a0 20 2f 20 2d 20 36 37 20 2b 20 2b 20 63 6f 6c 32   / - 67 + + col2
115b0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
115c0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
115d0 0d 0a 35 34 0d 0a 35 37 0d 0a 39 35 0d 0a 0d 0a  ..54..57..95....
115e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
115f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74 61  .SELECT ALL - ta
11600 62 31 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46  b1.col2 * col0 F
11610 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
11620 2d 31 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36  -162..-3648..-76
11630 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
11640 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
11650 53 54 49 4e 43 54 20 2d 20 2b 20 34 20 46 52 4f  STINCT - + 4 FRO
11660 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
11670 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 0d 0a 6f 6e 6c 79  ----..-4....only
11680 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
11690 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
116a0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
116b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
116c0 74 20 6c 61 62 65 6c 2d 35 31 36 0d 0a 53 45 4c  t label-516..SEL
116d0 45 43 54 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29  ECT + - ( col1 )
116e0 20 44 49 56 20 63 6f 6c 31 20 46 52 4f 4d 20 74   DIV col1 FROM t
116f0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
11700 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d  -..-1..-1..-1...
11710 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
11720 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
11730 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
11740 6c 61 62 65 6c 2d 35 31 36 0d 0a 53 45 4c 45 43  label-516..SELEC
11750 54 20 2b 20 2d 20 28 20 63 6f 6c 31 20 29 20 2f  T + - ( col1 ) /
11760 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
11770 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
11780 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 6f 6e 6c  1..-1..-1....onl
11790 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
117a0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
117b0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
117c0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
117d0 72 74 20 6c 61 62 65 6c 2d 35 31 37 0d 0a 53 45  rt label-517..SE
117e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
117f0 63 6f 6c 30 20 2b 20 2b 20 34 34 20 44 49 56 20  col0 + + 44 DIV 
11800 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  - col0 AS col1 F
11810 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
11820 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 36 34 0d  ..----..-11..64.
11830 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .80....skipif my
11840 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
11850 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
11860 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 31 37 0d  wsort label-517.
11870 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
11880 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 34 34 20 2f   + col0 + + 44 /
11890 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
118a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
118b0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 36 34  0..----..-11..64
118c0 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..80....onlyif m
118d0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
118e0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
118f0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
11900 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
11910 62 65 6c 2d 35 31 38 0d 0a 53 45 4c 45 43 54 20  bel-518..SELECT 
11920 2d 20 28 20 63 6f 6c 30 20 29 20 44 49 56 20 2b  - ( col0 ) DIV +
11930 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
11940 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
11950 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69  1..-1..-1....ski
11960 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
11970 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
11980 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
11990 6c 2d 35 31 38 0d 0a 53 45 4c 45 43 54 20 2d 20  l-518..SELECT - 
119a0 28 20 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f 6c  ( col0 ) / + col
119b0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
119c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d  or0..----..-1..-
119d0 31 0d 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49  1..-1....query I
119e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
119f0 20 2b 20 63 6f 6c 32 20 2a 20 28 20 63 6f 6c 30   + col2 * ( col0
11a00 20 2b 20 2b 20 38 36 20 29 20 46 52 4f 4d 20 74   + + 86 ) FROM t
11a10 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
11a20 31 32 31 0d 0a 31 34 33 35 30 0d 0a 33 36 33 30  121..14350..3630
11a30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
11a40 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
11a50 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
11a60 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
11a70 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
11a80 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
11a90 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
11aa0 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  + + col2 * col1 
11ab0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
11ac0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38  S cor0..----..28
11ad0 30 35 0d 0a 37 33 38 30 0d 0a 39 36 0d 0a 0d 0a  05..7380..96....
11ae0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
11af0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20 63 6f  .SELECT ALL ( co
11b00 6c 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l2 ) AS col0 FRO
11b10 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
11b20 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35 37 0d 0a 39 36  ----..54..57..96
11b30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
11b40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
11b50 2b 20 63 6f 6c 32 20 2a 20 38 37 20 46 52 4f 4d  + col2 * 87 FROM
11b60 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 36 39   tab1..----..469
11b70 38 0d 0a 34 39 35 39 0d 0a 38 33 35 32 0d 0a 0d  8..4959..8352...
11b80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11b90 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
11ba0 54 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 28 20 2b  T - col1 * - ( +
11bb0 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 29 20 41   col2 * col1 ) A
11bc0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
11bd0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d 0a 32  ..----..10982..2
11be0 35 39 34 37 0d 0a 39 30 35 30 36 0d 0a 0d 0a 73  5947..90506....s
11bf0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
11c00 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
11c10 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
11c20 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
11c30 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
11c40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11c50 41 4c 4c 20 63 6f 6c 32 20 2b 20 36 37 20 2b 20  ALL col2 + 67 + 
11c60 36 38 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  68 col2 FROM tab
11c70 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 31 0d 0a 31 36  2..----..161..16
11c80 32 0d 0a 31 37 33 0d 0a 0d 0a 71 75 65 72 79 20  2..173....query 
11c90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
11ca0 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30 2e  T DISTINCT tab0.
11cb0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20  col2 FROM tab0, 
11cc0 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
11cd0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33 33 0d  r0..----..1..33.
11ce0 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .82....query I r
11cf0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
11d00 4c 4c 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31  LL col0 * ( col1
11d10 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   ) FROM tab2..--
11d20 2d 2d 0d 0a 31 33 34 33 0d 0a 32 31 37 0d 0a 34  --..1343..217..4
11d30 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
11d40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
11d50 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 36 20 46 52  LL + col0 * 6 FR
11d60 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 34  OM tab2..----..4
11d70 32 0d 0a 34 36 38 0d 0a 34 37 34 0d 0a 0d 0a 71  2..468..474....q
11d80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
11d90 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
11da0 30 20 2b 20 2d 20 28 20 28 20 63 6f 6c 30 20 29  0 + - ( ( col0 )
11db0 20 29 20 2b 20 38 32 20 41 53 20 63 6f 6c 32 20   ) + 82 AS col2 
11dc0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
11dd0 0a 38 32 0d 0a 38 32 0d 0a 38 32 0d 0a 0d 0a 71  .82..82..82....q
11de0 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
11df0 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
11e00 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20  LECT ALL * FROM 
11e10 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52 4f  tab2 AS cor0 CRO
11e20 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20 74 61  SS JOIN tab0, ta
11e30 62 30 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53  b0 cor1, tab2 AS
11e40 20 63 6f 72 32 2c 20 74 61 62 31 20 41 53 20 63   cor2, tab1 AS c
11e50 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20  or3..----..3645 
11e60 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
11e70 6f 20 30 37 35 30 34 30 39 32 65 62 36 34 61 32  o 07504092eb64a2
11e80 36 39 37 39 63 30 62 64 65 30 35 66 37 37 31 38  6979c0bde05f7718
11e90 63 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  cb....query I ro
11ea0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
11eb0 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 36 31 20  L - col2 + + 61 
11ec0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
11ed0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 32 38  0..----..-21..28
11ee0 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..60....query I 
11ef0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
11f00 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20  DISTINCT col2 * 
11f10 2b 20 33 38 20 2a 20 2d 20 63 6f 6c 30 20 46 52  + 38 * - col0 FR
11f20 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
11f30 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 30 0d 0a 2d 32  .----..-1330..-2
11f40 37 37 33 32 34 0d 0a 2d 33 30 30 39 36 0d 0a 0d  77324..-30096...
11f50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
11f60 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e  ..SELECT - cor0.
11f70 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2d 20  col2 + - col0 - 
11f80 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  + col0 AS col2 F
11f90 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
11fa0 2d 2d 2d 0d 0a 2d 32 36 30 0d 0a 2d 37 31 0d 0a  ---..-260..-71..
11fb0 2d 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -81....query I r
11fc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
11fd0 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63  ISTINCT - cor0.c
11fe0 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol2 * col0 FROM 
11ff0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
12000 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a  --..-35..-7298..
12010 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -792....query I 
12020 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
12030 41 4c 4c 20 63 6f 6c 31 20 2a 20 28 20 39 34 20  ALL col1 * ( 94 
12040 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
12050 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 30 38 34 0d  or0..----..8084.
12060 0a 38 35 35 34 0d 0a 39 31 31 38 0d 0a 0d 0a 73  .8554..9118....s
12070 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
12080 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
12090 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
120a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
120b0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
120c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
120d0 2b 20 63 6f 6c 31 20 2a 20 38 36 20 63 6f 6c 31  + col1 * 86 col1
120e0 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
120f0 0a 2d 2d 2d 2d 0d 0a 37 33 39 36 0d 0a 37 38 32  .----..7396..782
12100 36 0d 0a 38 33 34 32 0d 0a 0d 0a 71 75 65 72 79  6..8342....query
12110 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
12120 43 54 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f  CT + col2 * + co
12130 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 + col1 FROM t
12140 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
12150 2d 0d 0a 31 39 34 0d 0a 32 39 32 34 0d 0a 37 35  -..194..2924..75
12160 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
12170 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
12180 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2b 20  STINCT + col2 + 
12190 28 20 2b 20 31 20 29 20 2a 20 63 6f 6c 31 20 46  ( + 1 ) * col1 F
121a0 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
121b0 2d 2d 2d 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30  ---..109..67..80
121c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
121d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
121e0 49 4e 43 54 20 63 6f 6c 30 20 2a 20 28 20 63 6f  INCT col0 * ( co
121f0 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
12200 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
12210 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34  -..49..6084..624
12220 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
12230 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
12240 6f 6c 30 20 2a 20 34 34 20 2a 20 63 6f 6c 31 20  ol0 * 44 * col1 
12250 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
12260 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
12270 0a 31 34 39 33 38 30 0d 0a 33 35 36 33 35 36 0d  .149380..356356.
12280 0a 39 30 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20  .90816....query 
12290 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 20  IIIIIIIIIIIIIII 
122a0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
122b0 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
122c0 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f  tab1, tab2 AS co
122d0 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
122e0 2c 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  , tab0, tab1 AS 
122f0 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35  cor2..----..3645
12300 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
12310 74 6f 20 62 33 65 61 38 32 30 38 39 30 34 34 35  to b3ea820890445
12320 64 35 39 66 33 66 37 34 36 34 61 31 35 32 31 64  d59f3f7464a1521d
12330 34 32 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  42d....query I r
12340 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
12350 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
12360 20 33 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53   30 FROM tab1 AS
12370 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 32   cor0..----..192
12380 30 0d 0a 32 34 30 30 0d 0a 39 30 0d 0a 0d 0a 71  0..2400..90....q
12390 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
123a0 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
123b0 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32  LECT * FROM tab2
123c0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c 20  , tab0 AS cor0, 
123d0 74 61 62 30 20 41 53 20 63 6f 72 31 2c 20 74 61  tab0 AS cor1, ta
123e0 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 32  b1, tab1 AS cor2
123f0 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
12400 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
12410 31 65 32 30 35 31 61 66 66 37 35 63 35 38 61 35  1e2051aff75c58a5
12420 65 64 61 61 33 31 34 66 31 34 31 32 39 38 33 0d  edaa314f1412983.
12430 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12440 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 35 20  rt..SELECT - 45 
12450 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
12460 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
12470 0a 2d 34 35 0d 0a 2d 34 35 0d 0a 2d 34 35 0d 0a  .-45..-45..-45..
12480 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12490 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
124a0 20 2a 20 32 33 20 46 52 4f 4d 20 74 61 62 31 20   * 23 FROM tab1 
124b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
124c0 32 34 32 0d 0a 31 33 31 31 0d 0a 32 32 30 38 0d  242..1311..2208.
124d0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
124e0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
124f0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
12500 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
12510 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
12520 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12530 45 43 54 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 31  ECT ALL + ( col1
12540 20 29 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   ) col2 FROM tab
12550 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
12560 0a 38 36 0d 0a 39 31 0d 0a 39 37 0d 0a 0d 0a 71  .86..91..97....q
12570 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
12580 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
12590 39 37 20 2a 20 28 20 63 6f 6c 30 20 29 20 41 53  97 * ( col0 ) AS
125a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
125b0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
125c0 33 32 38 0d 0a 33 33 39 35 0d 0a 38 36 33 33 0d  328..3395..8633.
125d0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
125e0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
125f0 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  0.col1 AS col0 F
12600 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 63  ROM tab2, tab0 c
12610 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
12620 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35  ues hashing to 5
12630 38 35 61 34 31 61 35 32 63 30 63 36 63 30 64 36  85a41a52c0c6c0d6
12640 39 37 62 35 64 33 39 32 36 35 62 37 34 64 63 0d  97b5d39265b74dc.
12650 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
12660 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20  rt..SELECT col2 
12670 2b 20 39 31 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  + 91 * col1 FROM
12680 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
12690 2d 2d 2d 0d 0a 37 38 35 39 0d 0a 38 33 36 33 0d  ---..7859..8363.
126a0 0a 38 38 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .8828....query I
126b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
126c0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
126d0 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
126e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
126f0 2d 0d 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30  -..110..132..180
12700 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
12710 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
12720 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
12730 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
12740 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
12750 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 35 30  owsort label-550
12760 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
12770 54 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  T + CAST( NULL A
12780 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20 63  S SIGNED ) + - c
12790 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
127a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
127b0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ---..NULL....ski
127c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
127d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
127e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
127f0 6c 2d 35 35 30 0d 0a 53 45 4c 45 43 54 20 44 49  l-550..SELECT DI
12800 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20  STINCT + CAST ( 
12810 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
12820 29 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ) + - col2 AS co
12830 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
12840 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
12850 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12860 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
12870 2b 20 63 6f 72 31 2e 63 6f 6c 31 20 46 52 4f 4d  + cor1.col1 FROM
12880 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
12890 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74  OSS JOIN tab2, t
128a0 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab2 AS cor1, tab
128b0 32 20 41 53 20 63 6f 72 32 2c 20 74 61 62 32 20  2 AS cor2, tab2 
128c0 41 53 20 63 6f 72 33 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor3..----..2
128d0 34 33 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  43 values hashin
128e0 67 20 74 6f 20 34 32 62 30 34 61 33 30 61 63 62  g to 42b04a30acb
128f0 33 32 66 63 64 33 35 62 66 39 37 61 66 64 65 65  32fcd35bf97afdee
12900 38 37 66 65 36 0d 0a 0d 0a 71 75 65 72 79 20 49  87fe6....query I
12910 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12920 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
12930 20 2b 20 38 32 20 2a 20 2d 20 28 20 2d 20 63 6f   + 82 * - ( - co
12940 6c 32 20 29 20 2b 20 31 35 20 2a 20 63 6f 6c 31  l2 ) + 15 * col1
12950 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
12960 0d 0a 34 38 32 31 0d 0a 34 38 38 38 0d 0a 38 31  ..4821..4888..81
12970 34 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  47....query IIII
12980 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
12990 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
129a0 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30 2c  tab1, tab0 cor0,
129b0 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20 74   tab1 AS cor1, t
129c0 61 62 30 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab0 AS cor2..---
129d0 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61  -..972 values ha
129e0 73 68 69 6e 67 20 74 6f 20 39 35 39 32 30 34 30  shing to 9592040
129f0 33 64 66 32 36 38 61 32 37 32 63 34 65 39 33 33  3df268a272c4e933
12a00 63 64 30 62 62 65 30 62 65 0d 0a 0d 0a 71 75 65  cd0bbe0be....que
12a10 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12a20 4c 45 43 54 20 2b 20 38 30 20 41 53 20 63 6f 6c  LECT + 80 AS col
12a30 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  1 FROM tab0 cor0
12a40 0d 0a 2d 2d 2d 2d 0d 0a 38 30 0d 0a 38 30 0d 0a  ..----..80..80..
12a50 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  80....query I ro
12a60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
12a70 28 20 2b 20 63 6f 72 31 2e 63 6f 6c 32 20 29 20  ( + cor1.col2 ) 
12a80 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20  FROM tab0, tab0 
12a90 41 53 20 63 6f 72 30 2c 20 74 61 62 32 20 41 53  AS cor0, tab2 AS
12aa0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20   cor1..----..27 
12ab0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
12ac0 6f 20 34 30 66 64 38 63 63 30 64 65 39 32 65 61  o 40fd8cc0de92ea
12ad0 36 38 64 37 33 36 33 34 63 32 64 38 66 37 35 62  68d73634c2d8f75b
12ae0 66 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  f5....query I ro
12af0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
12b00 4c 20 38 34 20 2b 20 63 6f 6c 30 20 41 53 20 63  L 84 + col0 AS c
12b10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
12b20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38   cor0..----..148
12b30 0d 0a 31 36 34 0d 0a 38 37 0d 0a 0d 0a 71 75 65  ..164..87....que
12b40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12b50 4c 45 43 54 20 2b 20 37 30 20 2a 20 63 6f 6c 32  LECT + 70 * col2
12b60 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
12b70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 30 0d 0a  r0..----..2310..
12b80 35 37 34 30 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72  5740..70....quer
12b90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12ba0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
12bb0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
12bc0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
12bd0 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72  ..33..82....quer
12be0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
12bf0 45 43 54 20 41 4c 4c 20 2b 20 39 33 20 41 53 20  ECT ALL + 93 AS 
12c00 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
12c10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 33 0d 0a 39  or0..----..93..9
12c20 33 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..93....skipif 
12c30 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
12c40 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
12c50 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
12c60 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
12c70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12c80 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
12c90 2b 20 28 20 63 6f 6c 31 20 29 20 2a 20 2d 20 63  + ( col1 ) * - c
12ca0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c  ol1 + - col0 col
12cb0 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
12cc0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30 0d 0a  or0..----..210..
12cd0 33 34 30 33 0d 0a 39 35 34 0d 0a 0d 0a 71 75 65  3403..954....que
12ce0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
12cf0 4c 45 43 54 20 2b 20 33 38 20 2a 20 63 6f 6c 32  LECT + 38 * col2
12d00 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
12d10 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 35 32 0d 0a  r0..----..2052..
12d20 32 31 36 36 0d 0a 33 36 34 38 0d 0a 0d 0a 71 75  2166..3648....qu
12d30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
12d40 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f  ELECT ALL + + co
12d50 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30  r0.col0 * - col0
12d60 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 36 33 20 41   + col2 + + 63 A
12d70 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
12d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
12d90 2d 35 39 39 35 0d 0a 2d 36 31 34 30 0d 0a 34 31  -5995..-6140..41
12da0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
12db0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
12dc0 49 4e 43 54 20 28 20 2b 20 74 61 62 32 2e 63 6f  INCT ( + tab2.co
12dd0 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l0 ) AS col2 FRO
12de0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 37 0d  M tab2..----..7.
12df0 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72 79  .78..79....query
12e00 20 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49   IIIIIIIIIIIIIII
12e10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
12e20 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d   DISTINCT * FROM
12e30 20 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63   tab2, tab1 AS c
12e40 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
12e50 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab0, tab2 AS cor
12e60 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 32 0d  1, tab0 AS cor2.
12e70 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75  .----..3645 valu
12e80 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 30 37  es hashing to 07
12e90 30 35 64 66 35 32 36 62 65 38 65 65 64 65 64 39  05df526be8eeded9
12ea0 36 64 30 63 32 30 61 65 39 33 38 37 31 32 0d 0a  6d0c20ae938712..
12eb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
12ec0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
12ed0 43 54 20 2d 20 37 20 41 53 20 63 6f 6c 31 20 46  CT - 7 AS col1 F
12ee0 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
12ef0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37  S cor0..----..-7
12f00 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
12f10 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
12f20 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
12f30 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
12f40 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
12f50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 36  owsort label-566
12f60 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28  ..SELECT + CAST(
12f70 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
12f80 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  ) FROM tab2..---
12f90 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e  -..NULL..NULL..N
12fa0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ULL....skipif my
12fb0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
12fc0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
12fd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 36 36 0d  wsort label-566.
12fe0 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20 28  .SELECT + CAST (
12ff0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
13000 20 29 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d   ) FROM tab2..--
13010 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
13020 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
13030 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13040 2b 20 2b 20 39 37 20 46 52 4f 4d 20 74 61 62 32  + + 97 FROM tab2
13050 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
13060 39 37 0d 0a 39 37 0d 0a 39 37 0d 0a 0d 0a 71 75  97..97..97....qu
13070 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13080 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36  ELECT DISTINCT 6
13090 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
130a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 0d  or0..----..60...
130b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
130c0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
130d0 54 20 36 31 20 2a 20 63 6f 6c 30 20 41 53 20 63  T 61 * col0 AS c
130e0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
130f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 33   cor0..----..183
13100 0d 0a 33 39 30 34 0d 0a 34 38 38 30 0d 0a 0d 0a  ..3904..4880....
13110 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13120 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
13130 6c 32 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31  l2 - col2 * col1
13140 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
13150 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 37 31 0d  b0..----..-2871.
13160 0a 2d 37 35 34 34 0d 0a 2d 39 38 0d 0a 0d 0a 6f  .-7544..-98....o
13170 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
13180 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
13190 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
131a0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
131b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
131c0 74 20 6c 61 62 65 6c 2d 35 37 31 0d 0a 53 45 4c  t label-571..SEL
131d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 31 20  ECT DISTINCT 41 
131e0 2b 20 63 6f 6c 30 20 2f 20 2b 20 43 41 53 54 28  + col0 / + CAST(
131f0 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c   NULL AS DECIMAL
13200 20 29 20 2d 20 32 36 20 41 53 20 63 6f 6c 30 20   ) - 26 AS col0 
13210 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
13220 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
13230 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
13240 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
13250 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
13260 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  1..SELECT DISTIN
13270 43 54 20 34 31 20 2b 20 63 6f 6c 30 20 2f 20 2b  CT 41 + col0 / +
13280 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
13290 52 45 41 4c 20 29 20 2d 20 32 36 20 41 53 20 63  REAL ) - 26 AS c
132a0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
132b0 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65  ---..NULL....que
132c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
132d0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LECT - col0 + - 
132e0 74 61 62 31 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f  tab1.col1 + - co
132f0 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l0 FROM tab1..--
13300 2d 2d 0d 0a 2d 31 33 38 0d 0a 2d 31 37 33 0d 0a  --..-138..-173..
13310 2d 33 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -32....query I r
13320 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
13330 4c 4c 20 2b 20 63 6f 6c 31 20 2d 20 2d 20 74 61  LL + col1 - - ta
13340 62 32 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  b2.col0 FROM tab
13350 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38  2..----..137..38
13360 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..96....query I 
13370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
13380 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 41 53  col1 + - col1 AS
13390 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
133a0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
133b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
133c0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
133d0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
133e0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
133f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
13400 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  5..SELECT + + co
13410 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20  l2 + - ( col2 ) 
13420 44 49 56 20 63 6f 6c 32 20 2d 20 2b 20 35 31 20  DIV col2 - + 51 
13430 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
13440 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 35  0..----..-19..-5
13450 31 0d 0a 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  1..30....skipif 
13460 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
13470 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
13480 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 35 37  rowsort label-57
13490 35 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f  5..SELECT + + co
134a0 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 32 20 29 20  l2 + - ( col2 ) 
134b0 2f 20 63 6f 6c 32 20 2d 20 2b 20 35 31 20 46 52  / col2 - + 51 FR
134c0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
134d0 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 35 31 0d  .----..-19..-51.
134e0 0a 33 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .30....skipif po
134f0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
13500 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
13510 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
13520 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
13530 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
13540 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
13550 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 63   col2 + - col1 c
13560 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63 6f  ol0 FROM tab2 co
13570 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d  r0..----..-33..-
13580 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  4..21....query I
13590 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
135a0 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 36 36   + + col0 + + 66
135b0 20 2a 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30   * - col1 * col0
135c0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
135d0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
135e0 0d 0a 2d 31 33 36 32 30 30 0d 0a 2d 32 32 34 30  ..-136200..-2240
135f0 33 35 0d 0a 2d 35 33 34 34 34 35 0d 0a 0d 0a 6f  35..-534445....o
13600 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
13610 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
13620 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
13630 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
13640 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
13650 74 20 6c 61 62 65 6c 2d 35 37 38 0d 0a 53 45 4c  t label-578..SEL
13660 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 2d  ECT + - col0 * -
13670 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
13680 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62  IGNED ) FROM tab
13690 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
136a0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
136b0 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  L....skipif mysq
136c0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
136d0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
136e0 6f 72 74 20 6c 61 62 65 6c 2d 35 37 38 0d 0a 53  ort label-578..S
136f0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2a  ELECT + - col0 *
13700 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
13710 53 20 49 4e 54 45 47 45 52 20 29 20 46 52 4f 4d  S INTEGER ) FROM
13720 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
13730 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
13740 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
13750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13760 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a   DISTINCT col2 *
13770 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 32   - col1 + - tab2
13780 2e 63 6f 6c 31 20 2a 20 2b 20 37 36 20 2d 20 63  .col1 * + 76 - c
13790 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
137a0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39   tab2..----..-19
137b0 35 35 0d 0a 2d 33 32 32 34 0d 0a 2d 36 30 37 37  55..-3224..-6077
137c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
137d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
137e0 33 36 20 2a 20 74 61 62 32 2e 63 6f 6c 30 20 46  36 * tab2.col0 F
137f0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
13800 32 35 32 0d 0a 32 38 30 38 0d 0a 32 38 34 34 0d  252..2808..2844.
13810 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13820 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
13830 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   tab0.col2 * col
13840 30 20 2d 20 2b 20 30 20 41 53 20 63 6f 6c 32 20  0 - + 0 AS col2 
13850 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
13860 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a  .35..7298..792..
13870 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
13880 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
13890 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
138a0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
138b0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
138c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
138d0 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 63 6f  CT ALL col1 * co
138e0 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32  l0 + col2 * col2
138f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
13900 0a 2d 2d 2d 2d 0d 0a 32 37 38 37 0d 0a 35 32 37  .----..2787..527
13910 38 0d 0a 39 34 36 0d 0a 0d 0a 6f 6e 6c 79 69 66  8..946....onlyif
13920 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
13930 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
13940 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
13950 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13960 6c 61 62 65 6c 2d 35 38 33 0d 0a 53 45 4c 45 43  label-583..SELEC
13970 54 20 2d 20 63 6f 6c 31 20 44 49 56 20 28 20 2b  T - col1 DIV ( +
13980 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c   tab0.col2 + col
13990 30 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  0 ) FROM tab0..-
139a0 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a  ---..-1..-2..0..
139b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
139c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
139d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
139e0 20 6c 61 62 65 6c 2d 35 38 33 0d 0a 53 45 4c 45   label-583..SELE
139f0 43 54 20 2d 20 63 6f 6c 31 20 2f 20 28 20 2b 20  CT - col1 / ( + 
13a00 74 61 62 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30  tab0.col2 + col0
13a10 20 29 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d   ) FROM tab0..--
13a20 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 30 0d 0a 0d  --..-1..-2..0...
13a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13a40 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 37  ..SELECT ALL - 7
13a50 37 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  7 AS col0 FROM t
13a60 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
13a70 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
13a80 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 61 32  s hashing to 3a2
13a90 34 31 35 35 63 62 39 31 63 65 66 66 31 65 36 37  4155cb91ceff1e67
13aa0 62 62 35 31 63 30 37 62 37 32 31 30 37 0d 0a 0d  bb51c07b72107...
13ab0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
13ac0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
13ad0 2a 20 63 6f 6c 31 20 2b 20 33 33 20 2a 20 2d 20  * col1 + 33 * - 
13ae0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
13af0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 31 38  or0..----..-2318
13b00 0d 0a 37 33 30 0d 0a 39 30 37 0d 0a 0d 0a 71 75  ..730..907....qu
13b10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
13b20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
13b30 20 63 6f 6c 32 20 2b 20 38 30 20 46 52 4f 4d 20   col2 + 80 FROM 
13b40 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
13b50 2d 2d 0d 0a 31 31 33 0d 0a 31 36 32 0d 0a 38 31  --..113..162..81
13b60 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
13b70 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
13b80 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a 20 74 61  INCT + col0 * ta
13b90 62 31 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  b1.col1 AS col0 
13ba0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
13bb0 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a  .1040..640..78..
13bc0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
13bd0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
13be0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
13bf0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
13c00 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
13c10 73 6f 72 74 20 6c 61 62 65 6c 2d 35 38 38 0d 0a  sort label-588..
13c20 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
13c30 63 6f 6c 32 20 2a 20 2d 20 43 41 53 54 28 20 4e  col2 * - CAST( N
13c40 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
13c50 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
13c60 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d  0..----..NULL...
13c70 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
13c80 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
13c90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
13ca0 6c 61 62 65 6c 2d 35 38 38 0d 0a 53 45 4c 45 43  label-588..SELEC
13cb0 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
13cc0 2a 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20  * - CAST ( NULL 
13cd0 41 53 20 49 4e 54 45 47 45 52 20 29 20 41 53 20  AS INTEGER ) AS 
13ce0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
13cf0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 6f 6e  ----..NULL....on
13d00 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
13d10 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
13d20 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
13d30 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
13d40 6f 72 74 20 6c 61 62 65 6c 2d 35 38 39 0d 0a 53  ort label-589..S
13d50 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2a 20 38  ELECT + col0 * 8
13d60 36 20 44 49 56 20 2b 20 63 6f 6c 32 20 46 52 4f  6 DIV + col2 FRO
13d70 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 0d  M tab1..----..4.
13d80 0a 37 31 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  .71..96....skipi
13d90 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
13da0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
13db0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
13dc0 35 38 39 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  589..SELECT + co
13dd0 6c 30 20 2a 20 38 36 20 2f 20 2b 20 63 6f 6c 32  l0 * 86 / + col2
13de0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
13df0 0d 0a 34 0d 0a 37 31 0d 0a 39 36 0d 0a 0d 0a 71  ..4..71..96....q
13e00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
13e10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
13e20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53  - col0 * col2 AS
13e30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
13e40 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
13e50 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d  35..-7298..-792.
13e60 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
13e70 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
13e80 4e 43 54 20 2b 20 37 20 2a 20 2b 20 63 6f 6c 30  NCT + 7 * + col0
13e90 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
13ea0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
13eb0 0a 33 34 33 0d 0a 34 32 35 38 38 0d 0a 34 33 36  .343..42588..436
13ec0 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
13ed0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
13ee0 53 54 49 4e 43 54 20 31 37 20 41 53 20 63 6f 6c  STINCT 17 AS col
13ef0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
13f00 2d 0d 0a 31 37 0d 0a 0d 0a 71 75 65 72 79 20 49  -..17....query I
13f10 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
13f20 20 2d 20 34 32 20 46 52 4f 4d 20 74 61 62 32 2c   - 42 FROM tab2,
13f30 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
13f40 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
13f50 6e 67 20 74 6f 20 39 38 39 34 30 39 33 66 32 39  ng to 9894093f29
13f60 63 30 64 65 66 61 65 39 31 33 34 37 39 33 34 66  c0defae91347934f
13f70 30 36 30 33 32 39 0d 0a 0d 0a 71 75 65 72 79 20  060329....query 
13f80 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
13f90 54 20 63 6f 6c 32 20 2a 20 2d 20 34 36 20 46 52  T col2 * - 46 FR
13fa0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
13fb0 32 34 38 34 0d 0a 2d 32 36 32 32 0d 0a 2d 34 34  2484..-2622..-44
13fc0 31 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  16....skipif pos
13fd0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
13fe0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
13ff0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
14000 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
14010 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14020 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
14030 28 20 35 39 20 29 20 63 6f 6c 30 20 46 52 4f 4d  ( 59 ) col0 FROM
14040 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 0d   tab0..----..59.
14050 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14060 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 39 39 20  rt..SELECT + 99 
14070 2a 20 63 6f 6c 30 20 2a 20 2d 20 36 33 20 2b 20  * col0 * - 63 + 
14080 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
14090 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
140a0 34 39 36 30 32 0d 0a 2d 32 31 38 31 39 38 0d 0a  49602..-218198..
140b0 2d 35 35 35 30 30 32 0d 0a 0d 0a 6f 6e 6c 79 69  -555002....onlyi
140c0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
140d0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
140e0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
140f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14100 20 6c 61 62 65 6c 2d 35 39 37 0d 0a 53 45 4c 45   label-597..SELE
14110 43 54 20 2d 20 32 37 20 44 49 56 20 63 6f 6c 30  CT - 27 DIV col0
14120 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 44 49 56   + tab1.col1 DIV
14130 20 2d 20 31 35 20 41 53 20 63 6f 6c 32 20 46 52   - 15 AS col2 FR
14140 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
14150 31 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  10..0..0....skip
14160 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
14170 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
14180 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
14190 2d 35 39 37 0d 0a 53 45 4c 45 43 54 20 2d 20 32  -597..SELECT - 2
141a0 37 20 2f 20 63 6f 6c 30 20 2b 20 74 61 62 31 2e  7 / col0 + tab1.
141b0 63 6f 6c 31 20 2f 20 2d 20 31 35 20 41 53 20 63  col1 / - 15 AS c
141c0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
141d0 2d 2d 2d 0d 0a 2d 31 30 0d 0a 30 0d 0a 30 0d 0a  ---..-10..0..0..
141e0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
141f0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
14200 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
14210 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
14220 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..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 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20  CT ALL - + col0 
14250 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d  * col0 col2 FROM
14260 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
14270 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35 37 36  ---..-1225..-576
14280 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79  ..-7921....query
14290 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
142a0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
142b0 20 2a 20 35 35 20 41 53 20 63 6f 6c 32 20 46 52   * 55 AS col2 FR
142c0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
142d0 0a 2d 2d 2d 2d 0d 0a 31 34 33 30 0d 0a 35 35 30  .----..1430..550
142e0 0d 0a 37 31 35 0d 0a 0d 0a 71 75 65 72 79 20 49  ..715....query I
142f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14300 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20 63 6f   ALL + col1 + co
14310 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  r0.col1 FROM tab
14320 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  1 cor0..----..20
14330 0d 0a 32 36 0d 0a 35 32 0d 0a 0d 0a 71 75 65 72  ..26..52....quer
14340 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14350 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 74  ECT - col0 + + t
14360 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab1.col2 FROM ta
14370 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 31 36  b1..----..-7..16
14380 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..51....query I 
14390 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
143a0 2b 20 37 39 20 46 52 4f 4d 20 74 61 62 30 0d 0a  + 79 FROM tab0..
143b0 2d 2d 2d 2d 0d 0a 37 39 0d 0a 37 39 0d 0a 37 39  ----..79..79..79
143c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
143d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
143e0 2b 20 28 20 2d 20 34 35 20 29 20 46 52 4f 4d 20  + ( - 45 ) FROM 
143f0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 35 0d  tab1..----..-45.
14400 0a 2d 34 35 0d 0a 2d 34 35 0d 0a 0d 0a 71 75 65  .-45..-45....que
14410 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14420 4c 45 43 54 20 41 4c 4c 20 2d 20 32 39 20 2b 20  LECT ALL - 29 + 
14430 63 6f 6c 30 20 2a 20 2d 20 35 34 20 2d 20 2d 20  col0 * - 54 - - 
14440 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
14450 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
14460 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 30 0d  or0..----..-400.
14470 0a 2d 34 31 36 33 0d 0a 2d 34 32 31 36 0d 0a 0d  .-4163..-4216...
14480 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14490 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
144a0 20 34 38 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 72   48 * col0 + cor
144b0 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20  0.col2 * col0 * 
144c0 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  - col1 AS col1 F
144d0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
144e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 33 36 38 30 0d  ..----..-103680.
144f0 0a 2d 33 39 35 35 32 0d 0a 2d 34 33 35 36 0d 0a  .-39552..-4356..
14500 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14510 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
14520 34 38 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 63 6f  48 - + col0 * co
14530 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
14540 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38  cor0..----..-108
14550 38 0d 0a 2d 31 32 36 0d 0a 2d 36 38 38 0d 0a 0d  8..-126..-688...
14560 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
14570 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
14580 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 72  T + col1 * + cor
14590 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
145a0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
145b0 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36 34  ..----..1040..64
145c0 30 0d 0a 37 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  0..78....skipif 
145d0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
145e0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
145f0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
14600 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
14610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14620 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
14630 30 20 2a 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52  0 * col2 col0 FR
14640 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
14650 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
14660 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
14670 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
14680 43 54 20 2b 20 31 30 20 41 53 20 63 6f 6c 30 20  CT + 10 AS col0 
14690 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
146a0 0a 31 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .10....onlyif my
146b0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
146c0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
146d0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
146e0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
146f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14700 36 31 30 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20  610..SELECT - ( 
14710 2b 20 63 6f 6c 32 20 29 20 2a 20 43 41 53 54 28  + col2 ) * CAST(
14720 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45   + col0 AS SIGNE
14730 44 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  D ) AS col1 FROM
14740 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab2 cor0..----
14750 0d 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d  ..-189..-2028..-
14760 33 30 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  3002....skipif m
14770 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
14780 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
14790 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 31 30  owsort label-610
147a0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 63  ..SELECT - ( + c
147b0 6f 6c 32 20 29 20 2a 20 43 41 53 54 20 28 20 2b  ol2 ) * CAST ( +
147c0 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52   col0 AS INTEGER
147d0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
147e0 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
147f0 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
14800 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
14810 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
14820 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 46   col1 + + col1 F
14830 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14840 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
14850 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14860 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 38 20  rt..SELECT + 68 
14870 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20  FROM tab0, tab2 
14880 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53  AS cor0, tab1 AS
14890 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63   cor1, tab2 AS c
148a0 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  or2..----..81 va
148b0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
148c0 37 66 66 36 34 33 33 64 64 61 33 32 34 38 64 63  7ff6433dda3248dc
148d0 65 37 33 30 34 30 62 32 63 35 39 30 66 33 64 61  e73040b2c590f3da
148e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
148f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 20 2b 20  ort..SELECT 9 + 
14900 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
14910 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
14920 2d 2d 2d 2d 0d 0a 31 30 0d 0a 34 32 0d 0a 39 31  ----..10..42..91
14930 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
14940 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
14950 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
14960 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
14970 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
14980 36 31 34 0d 0a 53 45 4c 45 43 54 20 2d 20 37 32  614..SELECT - 72
14990 20 44 49 56 20 37 39 20 41 53 20 63 6f 6c 32 20   DIV 79 AS col2 
149a0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
149b0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
149c0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
149d0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
149e0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
149f0 72 74 20 6c 61 62 65 6c 2d 36 31 34 0d 0a 53 45  rt label-614..SE
14a00 4c 45 43 54 20 2d 20 37 32 20 2f 20 37 39 20 41  LECT - 72 / 79 A
14a10 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
14a20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14a30 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
14a40 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14a50 43 54 20 41 4c 4c 20 2b 20 34 20 46 52 4f 4d 20  CT ALL + 4 FROM 
14a60 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
14a70 2d 2d 0d 0a 34 0d 0a 34 0d 0a 34 0d 0a 0d 0a 71  --..4..4..4....q
14a80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
14a90 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 31 20  SELECT + ( col1 
14aa0 29 20 2a 20 2b 20 39 34 20 46 52 4f 4d 20 74 61  ) * + 94 FROM ta
14ab0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
14ac0 0d 0a 31 35 39 38 0d 0a 32 39 31 34 0d 0a 35 35  ..1598..2914..55
14ad0 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  46....query I ro
14ae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
14af0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
14b00 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
14b10 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
14b20 2d 31 30 34 30 0d 0a 2d 36 34 30 0d 0a 2d 37 38  -1040..-640..-78
14b30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14b40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
14b50 6c 31 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l1 + col1 FROM t
14b60 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
14b70 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
14b80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
14b90 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 32  CT DISTINCT tab2
14ba0 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 2c  .col2 FROM tab2,
14bb0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
14bc0 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d  ---..26..27..38.
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 2d 20 63 6f 72  rt..SELECT - cor
14bf0 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  0.col1 * + col0 
14c00 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
14c10 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14c20 2d 35 37 36 0d 0a 2d 37 35 0d 0a 2d 39 36 30 0d  -576..-75..-960.
14c30 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
14c40 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b  rt..SELECT - ( +
14c50 20 63 6f 6c 30 20 29 20 2b 20 39 34 20 46 52 4f   col0 ) + 94 FRO
14c60 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
14c70 2d 0d 0a 35 0d 0a 35 39 0d 0a 37 30 0d 0a 0d 0a  -..5..59..70....
14c80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14c90 0a 53 45 4c 45 43 54 20 2b 20 30 20 2a 20 2d 20  .SELECT + 0 * - 
14ca0 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 46 52  col2 + - col0 FR
14cb0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
14cc0 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39  --..-7..-78..-79
14cd0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
14ce0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
14cf0 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 30 20  ( col0 ) + col0 
14d00 2a 20 39 33 20 41 53 20 63 6f 6c 31 20 46 52 4f  * 93 AS col1 FRO
14d10 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
14d20 2d 2d 2d 2d 0d 0a 36 35 38 0d 0a 37 33 33 32 0d  ----..658..7332.
14d30 0a 37 34 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49  .7426....query I
14d40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
14d50 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 28 20   DISTINCT + - ( 
14d60 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32 20 46  col2 ) AS col2 F
14d70 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
14d80 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33 0d  ..----..-1..-33.
14d90 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-82....query I 
14da0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
14db0 41 4c 4c 20 35 37 20 2a 20 2b 20 63 6f 6c 31 20  ALL 57 * + col1 
14dc0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
14dd0 30 0d 0a 2d 2d 2d 2d 0d 0a 34 39 30 32 0d 0a 35  0..----..4902..5
14de0 31 38 37 0d 0a 35 35 32 39 0d 0a 0d 0a 71 75 65  187..5529....que
14df0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
14e00 4c 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 31 20  LECT - ( - col1 
14e10 2a 20 2b 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  * + col1 ) FROM 
14e20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  tab1..----..100.
14e30 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 73 6b 69  .169..676....ski
14e40 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
14e50 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
14e60 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
14e70 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
14e80 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
14e90 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
14ea0 53 54 49 4e 43 54 20 2d 20 35 35 20 63 6f 6c 30  STINCT - 55 col0
14eb0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32   FROM tab1, tab2
14ec0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
14ed0 2d 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -55....query I r
14ee0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
14ef0 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 63  ISTINCT col2 * c
14f00 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
14f10 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 38 39   tab2..----..189
14f20 0d 0a 32 30 32 38 0d 0a 33 30 30 32 0d 0a 0d 0a  ..2028..3002....
14f30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
14f40 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
14f50 20 2d 20 35 38 20 46 52 4f 4d 20 74 61 62 32 2c   - 58 FROM tab2,
14f60 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
14f70 2d 2d 2d 0d 0a 2d 35 38 0d 0a 0d 0a 71 75 65 72  ---..-58....quer
14f80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
14f90 45 43 54 20 2d 20 36 20 46 52 4f 4d 20 74 61 62  ECT - 6 FROM tab
14fa0 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  2, tab0 AS cor0.
14fb0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
14fc0 68 61 73 68 69 6e 67 20 74 6f 20 65 39 32 62 32  hashing to e92b2
14fd0 36 37 39 66 61 61 63 37 62 65 36 33 37 30 31 39  679faac7be637019
14fe0 36 37 65 33 66 30 63 30 39 33 34 0d 0a 0d 0a 73  67e3f0c0934....s
14ff0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
15000 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
15010 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
15020 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
15030 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
15040 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15050 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  ALL + col2 * col
15060 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  0 col2 FROM tab0
15070 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38  ..----..35..7298
15080 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..792....query I
15090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
150a0 20 2d 20 35 20 46 52 4f 4d 20 74 61 62 30 0d 0a   - 5 FROM tab0..
150b0 2d 2d 2d 2d 0d 0a 2d 35 0d 0a 2d 35 0d 0a 2d 35  ----..-5..-5..-5
150c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
150d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
150e0 72 30 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31  r0.col1 * - col1
150f0 20 2b 20 31 32 20 2a 20 2d 20 63 6f 6c 30 20 41   + 12 * - col0 A
15100 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
15110 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15120 2d 37 36 38 34 0d 0a 2d 39 33 34 39 0d 0a 2d 39  -7684..-9349..-9
15130 38 32 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  829....query I r
15140 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
15150 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d   col0 * col2 + -
15160 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 41   col1 * + col2 A
15170 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
15180 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15190 2d 31 36 34 0d 0a 2d 32 30 34 36 0d 0a 2d 36 32  -164..-2046..-62
151a0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
151b0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
151c0 62 30 2e 63 6f 6c 30 20 2d 20 38 33 20 2a 20 2b  b0.col0 - 83 * +
151d0 20 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f   tab0.col1 AS co
151e0 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
151f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
15200 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
15210 6e 67 20 74 6f 20 34 61 65 63 30 31 37 39 61 35  ng to 4aec0179a5
15220 62 35 33 37 62 30 31 61 36 37 66 62 62 66 62 34  b537b01a67fbbfb4
15230 63 39 32 66 63 66 0d 0a 0d 0a 6f 6e 6c 79 69 66  c92fcf....onlyif
15240 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
15250 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
15260 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
15270 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
15280 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
15290 65 6c 2d 36 33 36 0d 0a 53 45 4c 45 43 54 20 74  el-636..SELECT t
152a0 61 62 31 2e 63 6f 6c 32 20 2b 20 2d 20 43 41 53  ab1.col2 + - CAS
152b0 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45  T( NULL AS SIGNE
152c0 44 20 29 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  D ) FROM tab1, t
152d0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
152e0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
152f0 69 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65  ing to cd7a7901e
15300 34 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64  47c15155404aff0d
15310 32 31 36 66 65 30 62 0d 0a 0d 0a 73 6b 69 70 69  216fe0b....skipi
15320 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
15330 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
15340 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
15350 36 33 36 0d 0a 53 45 4c 45 43 54 20 74 61 62 31  636..SELECT tab1
15360 2e 63 6f 6c 32 20 2b 20 2d 20 43 41 53 54 20 28  .col2 + - CAST (
15370 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
15380 20 29 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61   ) FROM tab1, ta
15390 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
153a0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
153b0 6e 67 20 74 6f 20 63 64 37 61 37 39 30 31 65 34  ng to cd7a7901e4
153c0 37 63 31 35 31 35 35 34 30 34 61 66 66 30 64 32  7c15155404aff0d2
153d0 31 36 66 65 30 62 0d 0a 0d 0a 6f 6e 6c 79 69 66  16fe0b....onlyif
153e0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
153f0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
15400 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
15410 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
15420 6c 61 62 65 6c 2d 36 33 37 0d 0a 53 45 4c 45 43  label-637..SELEC
15430 54 20 41 4c 4c 20 63 6f 6c 30 20 44 49 56 20 38  T ALL col0 DIV 8
15440 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
15450 0d 0a 31 31 0d 0a 33 0d 0a 34 0d 0a 0d 0a 73 6b  ..11..3..4....sk
15460 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
15470 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
15480 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
15490 65 6c 2d 36 33 37 0d 0a 53 45 4c 45 43 54 20 41  el-637..SELECT A
154a0 4c 4c 20 63 6f 6c 30 20 2f 20 38 20 46 52 4f 4d  LL col0 / 8 FROM
154b0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 0d   tab0..----..11.
154c0 0a 33 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .3..4....query I
154d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
154e0 20 2b 20 36 32 20 41 53 20 63 6f 6c 30 20 46 52   + 62 AS col0 FR
154f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20  OM tab0 AS cor0 
15500 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c  CROSS JOIN tab1,
15510 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
15520 61 62 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d  ab2 AS cor2..---
15530 2d 0d 0a 38 31 20 76 61 6c 75 65 73 20 68 61 73  -..81 values has
15540 68 69 6e 67 20 74 6f 20 30 62 63 36 35 32 35 36  hing to 0bc65256
15550 34 61 31 35 38 62 39 63 30 66 37 39 35 32 30 32  4a158b9c0f795202
15560 36 66 39 30 62 36 30 61 0d 0a 0d 0a 71 75 65 72  6f90b60a....quer
15570 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
15580 45 43 54 20 44 49 53 54 49 4e 43 54 20 31 34 20  ECT DISTINCT 14 
15590 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
155a0 31 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  1, tab1 cor0..--
155b0 2d 2d 0d 0a 31 34 0d 0a 0d 0a 71 75 65 72 79 20  --..14....query 
155c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
155d0 54 20 41 4c 4c 20 37 30 20 41 53 20 63 6f 6c 31  T ALL 70 AS col1
155e0 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31   FROM tab1, tab1
155f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15600 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
15610 20 74 6f 20 39 37 35 38 64 61 36 35 61 65 34 37   to 9758da65ae47
15620 31 31 65 33 65 38 63 38 64 65 66 32 66 65 30 32  11e3e8c8def2fe02
15630 36 39 31 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6911....query I 
15640 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
15650 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 2b  ALL + + col1 + +
15660 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
15670 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35  AS cor0..----..5
15680 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 6f 6e 6c  5..58..85....onl
15690 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
156a0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
156b0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
156c0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
156d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
156e0 6c 61 62 65 6c 2d 36 34 32 0d 0a 53 45 4c 45 43  label-642..SELEC
156f0 54 20 2b 20 2d 20 43 41 53 54 28 20 63 6f 6c 32  T + - CAST( col2
15700 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2b   AS SIGNED ) + +
15710 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
15720 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
15730 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d  .----..-16..-51.
15740 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .7....skipif mys
15750 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
15760 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
15770 73 6f 72 74 20 6c 61 62 65 6c 2d 36 34 32 0d 0a  sort label-642..
15780 53 45 4c 45 43 54 20 2b 20 2d 20 43 41 53 54 20  SELECT + - CAST 
15790 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45 47 45  ( col2 AS INTEGE
157a0 52 20 29 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20  R ) + + col0 AS 
157b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
157c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
157d0 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65  6..-51..7....que
157e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
157f0 4c 45 43 54 20 2d 20 36 33 20 41 53 20 63 6f 6c  LECT - 63 AS col
15800 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
15810 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
15820 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
15830 67 20 74 6f 20 35 61 37 38 34 35 65 66 36 65 32  g to 5a7845ef6e2
15840 33 39 35 36 31 63 61 66 39 61 31 37 61 32 38 65  39561caf9a17a28e
15850 32 37 34 62 35 0d 0a 0d 0a 71 75 65 72 79 20 49  274b5....query I
15860 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
15870 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f   ALL + col1 * co
15880 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 + col2 FROM t
15890 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
158a0 31 33 34 34 0d 0a 31 34 35 38 0d 0a 36 32 37 0d  1344..1458..627.
158b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
158c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63  rt..SELECT + + c
158d0 6f 6c 32 20 2b 20 2d 20 37 30 20 46 52 4f 4d 20  ol2 + - 70 FROM 
158e0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
158f0 2d 2d 0d 0a 2d 33 32 0d 0a 2d 34 33 0d 0a 2d 34  --..-32..-43..-4
15900 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
15910 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
15920 54 49 4e 43 54 20 2d 20 33 36 20 2a 20 2d 20 31  TINCT - 36 * - 1
15930 37 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  7 FROM tab1 AS c
15940 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 32 0d 0a  or0..----..612..
15950 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15960 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
15970 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2a 20  col1 + - col2 * 
15980 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
15990 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
159a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 35  or0..----..-1475
159b0 0d 0a 2d 36 32 39 0d 0a 2d 38 30 36 0d 0a 0d 0a  ..-629..-806....
159c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
159d0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 36 33  .SELECT ALL - 63
159e0 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 63 6f 72 30   * - col1 - cor0
159f0 2e 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46 52 4f  .col0 * col0 FRO
15a00 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
15a10 2d 2d 2d 2d 0d 0a 2d 32 33 36 37 0d 0a 2d 35 31  ----..-2367..-51
15a20 37 30 0d 0a 31 39 30 34 0d 0a 0d 0a 6f 6e 6c 79  70..1904....only
15a30 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
15a40 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
15a50 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
15a60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
15a70 74 20 6c 61 62 65 6c 2d 36 34 39 0d 0a 53 45 4c  t label-649..SEL
15a80 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d  ECT DISTINCT + -
15a90 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31 20 41   col2 DIV col1 A
15aa0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
15ab0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15ac0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
15ad0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
15ae0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
15af0 6f 72 74 20 6c 61 62 65 6c 2d 36 34 39 0d 0a 53  ort label-649..S
15b00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
15b10 20 2d 20 63 6f 6c 32 20 2f 20 63 6f 6c 31 20 41   - col2 / col1 A
15b20 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
15b30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15b40 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
15b50 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
15b60 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
15b70 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
15b80 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
15b90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
15ba0 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  0..SELECT ALL - 
15bb0 2d 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c  - CAST( cor0.col
15bc0 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20  1 AS SIGNED ) * 
15bd0 63 6f 6c 30 20 2b 20 2d 20 37 36 20 41 53 20 63  col0 + - 76 AS c
15be0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol2 FROM tab1 co
15bf0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35 36 34  r0..----..2..564
15c00 0d 0a 39 36 34 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..964....skipif 
15c10 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
15c20 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
15c30 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35  rowsort label-65
15c40 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  0..SELECT ALL - 
15c50 2d 20 43 41 53 54 20 28 20 63 6f 72 30 2e 63 6f  - CAST ( cor0.co
15c60 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l1 AS INTEGER ) 
15c70 2a 20 63 6f 6c 30 20 2b 20 2d 20 37 36 20 41 53  * col0 + - 76 AS
15c80 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
15c90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35  cor0..----..2..5
15ca0 36 34 0d 0a 39 36 34 0d 0a 0d 0a 71 75 65 72 79  64..964....query
15cb0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
15cc0 43 54 20 2b 20 2d 20 28 20 2d 20 63 6f 72 30 2e  CT + - ( - cor0.
15cd0 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 32  col0 ) FROM tab2
15ce0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
15cf0 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75 65  7..78..79....que
15d00 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15d10 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20  LECT ALL + col1 
15d20 2a 20 2b 20 28 20 2d 20 35 31 20 29 20 2b 20 2b  * + ( - 51 ) + +
15d30 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52   col0 AS col1 FR
15d40 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab1..----..-
15d50 31 33 32 33 0d 0a 2d 34 34 36 0d 0a 2d 35 38 33  1323..-446..-583
15d60 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
15d70 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
15d80 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
15d90 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
15da0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
15db0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 35 33  owsort label-653
15dc0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
15dd0 6f 6c 31 20 2a 20 2b 20 43 41 53 54 28 20 4e 55  ol1 * + CAST( NU
15de0 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2f  LL AS SIGNED ) /
15df0 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30   - col2 + - col0
15e00 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
15e10 62 31 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b1..----..NULL..
15e20 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
15e30 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
15e40 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
15e50 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
15e60 65 6c 2d 36 35 33 0d 0a 53 45 4c 45 43 54 20 41  el-653..SELECT A
15e70 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 43 41  LL - col1 * + CA
15e80 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54  ST ( NULL AS INT
15e90 45 47 45 52 20 29 20 2f 20 2d 20 63 6f 6c 32 20  EGER ) / - col2 
15ea0 2b 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  + - col0 AS col2
15eb0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
15ec0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
15ed0 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
15ee0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
15ef0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
15f00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 43  sort..SELECT + C
15f10 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20 52 45  AST ( col1 AS RE
15f20 41 4c 20 29 20 2b 20 2b 20 74 61 62 31 2e 63 6f  AL ) + + tab1.co
15f30 6c 30 20 2a 20 2d 20 28 20 63 6f 6c 30 20 29 20  l0 * - ( col0 ) 
15f40 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
15f50 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 38 36 0d 0a  1..----..-4086..
15f60 2d 36 33 38 37 0d 0a 31 37 0d 0a 0d 0a 71 75 65  -6387..17....que
15f70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
15f80 4c 45 43 54 20 41 4c 4c 20 2b 20 33 37 20 46 52  LECT ALL + 37 FR
15f90 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53  OM tab0, tab2 AS
15fa0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
15fb0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
15fc0 20 61 31 30 62 30 33 65 37 32 38 36 30 62 39 34   a10b03e72860b94
15fd0 39 62 64 66 66 35 33 38 32 37 37 30 30 61 39 61  9bdff53827700a9a
15fe0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
15ff0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
16000 20 2d 20 63 6f 6c 32 20 2b 20 33 36 20 2a 20 2d   - col2 + 36 * -
16010 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
16020 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
16030 31 31 34 33 0d 0a 2d 32 31 35 30 0d 0a 2d 36 35  1143..-2150..-65
16040 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
16050 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
16060 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
16070 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
16080 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16090 2d 36 35 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -657..SELECT - c
160a0 6f 6c 31 20 2b 20 37 30 20 44 49 56 20 2b 20 63  ol1 + 70 DIV + c
160b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
160c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   cor0..----..-24
160d0 0d 0a 2d 33 0d 0a 2d 38 0d 0a 0d 0a 73 6b 69 70  ..-3..-8....skip
160e0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
160f0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16100 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16110 2d 36 35 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -657..SELECT - c
16120 6f 6c 31 20 2b 20 37 30 20 2f 20 2b 20 63 6f 6c  ol1 + 70 / + col
16130 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
16140 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a  or0..----..-24..
16150 2d 33 0d 0a 2d 38 0d 0a 0d 0a 71 75 65 72 79 20  -3..-8....query 
16160 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16170 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 63  T DISTINCT + ( c
16180 6f 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 30 20 41  ol2 ) + + col0 A
16190 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
161a0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
161b0 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a 0d 0a 71  171..36..57....q
161c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
161d0 53 45 4c 45 43 54 20 41 4c 4c 20 33 35 20 2a 20  SELECT ALL 35 * 
161e0 63 6f 6c 31 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  col1 * - cor0.co
161f0 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
16200 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
16210 2d 2d 0d 0a 2d 32 32 34 30 30 0d 0a 2d 32 37 33  --..-22400..-273
16220 30 0d 0a 2d 33 36 34 30 30 0d 0a 0d 0a 71 75 65  0..-36400....que
16230 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
16240 4c 45 43 54 20 63 6f 6c 32 20 2a 20 2d 20 33 39  LECT col2 * - 39
16250 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
16260 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 31 34 0d  r0..----..-1014.
16270 0a 2d 31 30 35 33 0d 0a 2d 31 34 38 32 0d 0a 0d  .-1053..-1482...
16280 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
16290 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
162a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
162b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
162c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 31  owsort label-661
162d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
162e0 6f 6c 32 20 44 49 56 20 2d 20 28 20 63 6f 6c 31  ol2 DIV - ( col1
162f0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
16300 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
16310 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d 0a 73 6b 69 70  .2..5..7....skip
16320 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
16330 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
16340 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
16350 2d 36 36 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -661..SELECT ALL
16360 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 28 20 63 6f   - col2 / - ( co
16370 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  l1 ) AS col2 FRO
16380 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
16390 2d 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d 0a 71 75  -..2..5..7....qu
163a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
163b0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
163c0 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol1 + cor0.col1 
163d0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  * cor0.col0 FROM
163e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
163f0 2d 2d 2d 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a  ---..1360..248..
16400 34 36 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4661....query I 
16410 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16420 2b 20 34 37 20 46 52 4f 4d 20 74 61 62 31 20 41  + 47 FROM tab1 A
16430 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37  S cor0..----..47
16440 0d 0a 34 37 0d 0a 34 37 0d 0a 0d 0a 71 75 65 72  ..47..47....quer
16450 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
16460 45 43 54 20 41 4c 4c 20 2b 20 2d 20 31 20 2a 20  ECT ALL + - 1 * 
16470 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
16480 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
16490 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
164a0 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 6f 6e 6c  .-78..-79....onl
164b0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
164c0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
164d0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
164e0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
164f0 72 74 20 6c 61 62 65 6c 2d 36 36 35 0d 0a 53 45  rt label-665..SE
16500 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  LECT + col1 + - 
16510 63 6f 6c 30 20 44 49 56 20 2b 20 63 6f 6c 30 20  col0 DIV + col0 
16520 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
16530 2d 2d 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39 36  ----..85..90..96
16540 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
16550 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
16560 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
16570 72 74 20 6c 61 62 65 6c 2d 36 36 35 0d 0a 53 45  rt label-665..SE
16580 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 2d 20  LECT + col1 + - 
16590 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 46 52  col0 / + col0 FR
165a0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
165b0 2d 2d 0d 0a 38 35 0d 0a 39 30 0d 0a 39 36 0d 0a  --..85..90..96..
165c0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
165d0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 28 20  t..SELECT - - ( 
165e0 35 39 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52  59 ) * - col2 FR
165f0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
16600 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 31  .----..-1534..-1
16610 35 39 33 0d 0a 2d 32 32 34 32 0d 0a 0d 0a 71 75  593..-2242....qu
16620 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16630 45 4c 45 43 54 20 32 34 20 2b 20 63 6f 6c 30 20  ELECT 24 + col0 
16640 2b 20 28 20 74 61 62 30 2e 63 6f 6c 30 20 29 20  + ( tab0.col0 ) 
16650 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
16660 0a 32 30 32 0d 0a 37 32 0d 0a 39 34 0d 0a 0d 0a  .202..72..94....
16670 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
16680 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
16690 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
166a0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
166b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 36 38 0d  wsort label-668.
166c0 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 30  .SELECT + - col0
166d0 20 44 49 56 20 2b 20 63 6f 6c 30 20 2d 20 63 6f   DIV + col0 - co
166e0 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  r0.col2 FROM tab
166f0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
16700 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d 39 37 0d 0a  .-55..-58..-97..
16710 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
16720 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
16730 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16740 20 6c 61 62 65 6c 2d 36 36 38 0d 0a 53 45 4c 45   label-668..SELE
16750 43 54 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2b 20  CT + - col0 / + 
16760 63 6f 6c 30 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  col0 - cor0.col2
16770 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
16780 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d  r0..----..-55..-
16790 35 38 0d 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79  58..-97....query
167a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
167b0 43 54 20 2b 20 35 31 20 2b 20 63 6f 6c 31 20 41  CT + 51 + col1 A
167c0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
167d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37   cor0..----..137
167e0 0d 0a 31 34 32 0d 0a 31 34 38 0d 0a 0d 0a 71 75  ..142..148....qu
167f0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
16800 45 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2b  ELECT - + col1 +
16810 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
16820 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a  cor0..----..-2..
16830 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a 73 6b 69 70  -62..-62....skip
16840 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
16850 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
16860 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
16870 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
16880 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
16890 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
168a0 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 34 33 20  or0.col0 + - 43 
168b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
168c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
168d0 30 0d 0a 32 31 0d 0a 33 37 0d 0a 0d 0a 71 75 65  0..21..37....que
168e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
168f0 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 38 39  LECT - col2 * 89
16900 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
16910 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
16920 0d 0a 2d 32 33 31 34 0d 0a 2d 32 34 30 33 0d 0a  ..-2314..-2403..
16930 2d 33 33 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  -3382....query I
16940 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
16950 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
16960 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
16970 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
16980 2d 0d 0a 2d 31 31 39 0d 0a 2d 31 37 33 0d 0a 2d  -..-119..-173..-
16990 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  98....query I ro
169a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
169b0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 28 20  STINCT col0 + ( 
169c0 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  + col0 ) AS col1
169d0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
169e0 0d 0a 31 37 38 0d 0a 34 38 0d 0a 37 30 0d 0a 0d  ..178..48..70...
169f0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
16a00 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
16a10 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
16a20 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
16a30 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
16a40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16a50 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20  T + cor0.col2 * 
16a60 2d 20 32 35 20 63 6f 6c 30 20 46 52 4f 4d 20 74  - 25 col0 FROM t
16a70 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
16a80 2d 0d 0a 2d 36 35 30 0d 0a 2d 36 37 35 0d 0a 2d  -..-650..-675..-
16a90 39 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  950....query I r
16aa0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
16ab0 6f 6c 31 20 2a 20 33 20 2b 20 28 20 2b 20 63 6f  ol1 * 3 + ( + co
16ac0 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
16ad0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
16ae0 2d 2d 2d 2d 0d 0a 31 31 39 0d 0a 38 31 0d 0a 39  ----..119..81..9
16af0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49  4....query IIIII
16b00 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
16b10 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74  .SELECT * FROM t
16b20 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
16b30 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c  0, tab2 AS cor1,
16b40 20 74 61 62 32 20 63 6f 72 32 0d 0a 2d 2d 2d 2d   tab2 cor2..----
16b50 0d 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73  ..972 values has
16b60 68 69 6e 67 20 74 6f 20 36 31 37 63 39 35 34 35  hing to 617c9545
16b70 64 66 32 36 64 36 64 39 38 33 65 33 39 36 37 38  df26d6d983e39678
16b80 36 34 65 38 65 39 65 34 0d 0a 0d 0a 73 6b 69 70  64e8e9e4....skip
16b90 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
16ba0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
16bb0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
16bc0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
16bd0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
16be0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d  sort..SELECT + -
16bf0 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 32 20   cor0.col2 col2 
16c00 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
16c10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  0..----..-26..-2
16c20 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20  7..-38....query 
16c30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
16c40 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30 20 2b  T ALL - + col0 +
16c50 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
16c60 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
16c70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a 2d  0..----..-171..-
16c80 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 73 6b 69 70 69  36..-57....skipi
16c90 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
16ca0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
16cb0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
16cc0 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
16cd0 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
16ce0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 31  ort..SELECT - 41
16cf0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
16d00 0a 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 34 31 0d  .----..-41..-41.
16d10 0a 2d 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  .-41....skipif p
16d20 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
16d30 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
16d40 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
16d50 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
16d60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
16d70 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
16d80 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20 74 61 62  or0.col2 - - tab
16d90 31 2e 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d  1.col1 col2 FROM
16da0 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
16db0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
16dc0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62  ues hashing to b
16dd0 38 62 36 32 37 36 32 30 30 35 64 63 30 64 37 32  8b62762005dc0d72
16de0 33 37 31 34 35 64 30 35 33 38 65 64 62 33 34 0d  37145d0538edb34.
16df0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
16e00 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
16e10 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
16e20 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
16e30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16e40 38 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  82..SELECT ALL +
16e50 20 39 37 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d   97 - col1 DIV -
16e60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
16e70 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 38 0d 0a  cor0..----..98..
16e80 39 38 0d 0a 39 38 0d 0a 0d 0a 73 6b 69 70 69 66  98..98....skipif
16e90 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
16ea0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
16eb0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36   rowsort label-6
16ec0 38 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  82..SELECT ALL +
16ed0 20 39 37 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63   97 - col1 / - c
16ee0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
16ef0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 38 0d 0a 39 38  r0..----..98..98
16f00 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..98....query I 
16f10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
16f20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 2a 20 63 6f  col1 * col0 * co
16f30 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
16f40 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 39 35 0d 0a 36  0..----..3395..6
16f50 36 34 31 31 38 0d 0a 36 38 31 31 32 0d 0a 0d 0a  64118..68112....
16f60 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
16f70 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
16f80 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
16f90 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
16fa0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
16fb0 72 74 20 6c 61 62 65 6c 2d 36 38 34 0d 0a 53 45  rt label-684..SE
16fc0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43 41  LECT DISTINCT CA
16fd0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
16fe0 45 44 20 29 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  ED ) + + col2 * 
16ff0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
17000 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
17010 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
17020 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
17030 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
17040 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
17050 65 6c 2d 36 38 34 0d 0a 53 45 4c 45 43 54 20 44  el-684..SELECT D
17060 49 53 54 49 4e 43 54 20 43 41 53 54 20 28 20 4e  ISTINCT CAST ( N
17070 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
17080 20 2b 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   + + col2 * col1
17090 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
170a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
170b0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
170c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
170d0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c  T DISTINCT - col
170e0 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20  0 * cor0.col1 + 
170f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
17100 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
17110 30 33 31 0d 0a 2d 33 33 39 34 0d 0a 2d 38 30 31  031..-3394..-801
17120 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
17130 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20 34  sort..SELECT ( 4
17140 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63   ) * + col0 AS c
17150 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
17160 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 0d   cor0..----..12.
17170 0a 32 35 36 0d 0a 33 32 30 0d 0a 0d 0a 73 6b 69  .256..320....ski
17180 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
17190 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
171a0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
171b0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
171c0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
171d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
171e0 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 63 6f 6c 32  l1 * - col2 col2
171f0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
17200 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 34 0d  r0..----..-1534.
17210 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d 0a 0d 0a 71  .-646..-837....q
17220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17230 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
17240 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 63 6f  col0 + col2 * co
17250 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l1 AS col1 FROM 
17260 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
17270 2d 2d 0d 0a 31 33 32 0d 0a 32 38 36 32 0d 0a 37  --..132..2862..7
17280 35 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  551....query I r
17290 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
172a0 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 46 52 4f   col2 * col0 FRO
172b0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
172c0 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d  -..-35..-7298..-
172d0 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  792....query I r
172e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
172f0 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a  ISTINCT - col0 *
17300 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 46 52 4f   col1 * col2 FRO
17310 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
17320 2d 2d 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d  ----..-119652..-
17330 35 31 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a  51034..-5859....
17340 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
17350 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
17360 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
17370 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
17380 77 73 6f 72 74 20 6c 61 62 65 6c 2d 36 39 31 0d  wsort label-691.
17390 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
173a0 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 44 49 56   col2 + col2 DIV
173b0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20   + col2 AS col2 
173c0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
173d0 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 39 37  ----..55..58..97
173e0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
173f0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
17400 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
17410 72 74 20 6c 61 62 65 6c 2d 36 39 31 0d 0a 53 45  rt label-691..SE
17420 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
17430 6c 32 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 63 6f  l2 + col2 / + co
17440 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
17450 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
17460 0a 35 35 0d 0a 35 38 0d 0a 39 37 0d 0a 0d 0a 73  .55..58..97....s
17470 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
17480 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
17490 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
174a0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
174b0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
174c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
174d0 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
174e0 6c 32 20 2a 20 2d 20 74 61 62 30 2e 63 6f 6c 31  l2 * - tab0.col1
174f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c   col2 FROM tab1,
17500 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
17510 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 0d 0a 2d  OSS JOIN tab0..-
17520 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
17530 73 68 69 6e 67 20 74 6f 20 33 38 61 65 34 61 62  shing to 38ae4ab
17540 36 61 38 66 64 66 63 64 38 35 35 64 35 37 61 37  6a8fdfcd855d57a7
17550 33 66 62 39 39 65 33 32 36 0d 0a 0d 0a 71 75 65  3fb99e326....que
17560 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17570 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20  LECT + + col1 * 
17580 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f  col2 + col2 + co
17590 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
175a0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
175b0 2d 2d 0d 0a 31 33 35 37 0d 0a 31 34 38 34 0d 0a  --..1357..1484..
175c0 36 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  637....onlyif my
175d0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
175e0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
175f0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
17600 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
17610 65 6c 2d 36 39 34 0d 0a 53 45 4c 45 43 54 20 44  el-694..SELECT D
17620 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30  ISTINCT + - cor0
17630 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 32 20 41  .col1 DIV col2 A
17640 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
17650 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
17660 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a 73  -1..-2..-97....s
17670 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
17680 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
17690 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
176a0 62 65 6c 2d 36 39 34 0d 0a 53 45 4c 45 43 54 20  bel-694..SELECT 
176b0 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72  DISTINCT + - cor
176c0 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 32 20 41 53  0.col1 / col2 AS
176d0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
176e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
176f0 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d 0a 73 6b  1..-2..-97....sk
17700 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
17710 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
17720 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
17730 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
17740 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
17750 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17760 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f 6c  ISTINCT cor0.col
17770 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  2 col1 FROM tab0
17780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a   cor0..----..1..
17790 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72 79 20  33..82....query 
177a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
177b0 54 20 41 4c 4c 20 2b 20 34 36 20 2a 20 63 6f 6c  T ALL + 46 * col
177c0 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30  0 FROM tab1 cor0
177d0 0d 0a 2d 2d 2d 2d 0d 0a 31 33 38 0d 0a 32 39 34  ..----..138..294
177e0 34 0d 0a 33 36 38 30 0d 0a 0d 0a 71 75 65 72 79  4..3680....query
177f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
17800 43 54 20 41 4c 4c 20 2d 20 35 37 20 2a 20 2d 20  CT ALL - 57 * - 
17810 63 6f 6c 32 20 2b 20 2d 20 33 39 20 2a 20 2d 20  col2 + - 39 * - 
17820 39 35 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  95 FROM tab0 AS 
17830 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 36 32  cor0..----..3762
17840 0d 0a 35 35 38 36 0d 0a 38 33 37 39 0d 0a 0d 0a  ..5586..8379....
17850 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17860 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
17870 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + - cor0.col1 *
17880 20 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 46 52 4f   col1 + col2 FRO
17890 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
178a0 2d 2d 2d 2d 0d 0a 2d 34 33 0d 0a 2d 36 32 32 0d  ----..-43..-622.
178b0 0a 2d 37 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-73....query I 
178c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
178d0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20  DISTINCT + col1 
178e0 2b 20 2d 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  + - tab2.col2 * 
178f0 28 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ( - col0 * col0 
17900 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  ) AS col0 FROM t
17910 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 35 34 0d  ab2..----..1354.
17920 0a 31 35 38 32 34 33 0d 0a 32 33 37 31 37 35 0d  .158243..237175.
17930 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
17940 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63  rt..SELECT - ( c
17950 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46 52  ol1 ) AS col1 FR
17960 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
17970 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a  17..-31..-59....
17980 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
17990 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
179a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
179b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
179c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 30 31 0d  wsort label-701.
179d0 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31 2e 63  .SELECT + tab1.c
179e0 6f 6c 32 20 44 49 56 20 2b 20 74 61 62 31 2e 63  ol2 DIV + tab1.c
179f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
17a00 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37 0d 0a 0d 0a  ---..2..5..7....
17a10 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
17a20 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
17a30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
17a40 61 62 65 6c 2d 37 30 31 0d 0a 53 45 4c 45 43 54  abel-701..SELECT
17a50 20 2b 20 74 61 62 31 2e 63 6f 6c 32 20 2f 20 2b   + tab1.col2 / +
17a60 20 74 61 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20   tab1.col1 FROM 
17a70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35  tab1..----..2..5
17a80 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..7....query I r
17a90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
17aa0 49 53 54 49 4e 43 54 20 2d 20 33 38 20 2d 20 2d  ISTINCT - 38 - -
17ab0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
17ac0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
17ad0 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d 0a 2d 35 0d 0a  .----..-37..-5..
17ae0 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  44....query I ro
17af0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
17b00 33 33 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  33 FROM tab1 cor
17b10 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33 33 0d  0..----..33..33.
17b20 0a 33 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .33....query I r
17b30 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
17b40 4c 4c 20 28 20 2b 20 63 6f 6c 30 20 29 20 46 52  LL ( + col0 ) FR
17b50 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
17b60 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d  --..3..64..80...
17b70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17b80 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
17b90 2a 20 2b 20 35 33 20 46 52 4f 4d 20 74 61 62 32  * + 53 FROM tab2
17ba0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 31   cor0..----..371
17bb0 0d 0a 34 31 33 34 0d 0a 34 31 38 37 0d 0a 0d 0a  ..4134..4187....
17bc0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
17bd0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32  .SELECT ALL tab2
17be0 2e 63 6f 6c 32 20 2a 20 36 30 20 46 52 4f 4d 20  .col2 * 60 FROM 
17bf0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30  tab2..----..1560
17c00 0d 0a 31 36 32 30 0d 0a 32 32 38 30 0d 0a 0d 0a  ..1620..2280....
17c10 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
17c20 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
17c30 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
17c40 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
17c50 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
17c60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17c70 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20   ALL - + col1 * 
17c80 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
17c90 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
17ca0 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d  ---..2064..3395.
17cb0 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .8099....query I
17cc0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
17cd0 20 44 49 53 54 49 4e 43 54 20 2d 20 2d 20 63 6f   DISTINCT - - co
17ce0 6c 32 20 2a 20 33 33 20 41 53 20 63 6f 6c 30 20  l2 * 33 AS col0 
17cf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
17d00 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 32 0d 0a 31  0..----..1782..1
17d10 38 38 31 0d 0a 33 31 36 38 0d 0a 0d 0a 71 75 65  881..3168....que
17d20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
17d30 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20  LECT - col0 * + 
17d40 32 38 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  28 FROM tab0 AS 
17d50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 39  cor0..----..-249
17d60 32 0d 0a 2d 36 37 32 0d 0a 2d 39 38 30 0d 0a 0d  2..-672..-980...
17d70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
17d80 0d 0a 53 45 4c 45 43 54 20 2d 20 38 32 20 2b 20  ..SELECT - 82 + 
17d90 2b 20 36 31 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  + 61 * col2 FROM
17da0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
17db0 2d 2d 2d 0d 0a 2d 32 31 0d 0a 31 39 33 31 0d 0a  ---..-21..1931..
17dc0 34 39 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4920....query I 
17dd0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
17de0 41 4c 4c 20 31 36 20 41 53 20 63 6f 6c 30 20 46  ALL 16 AS col0 F
17df0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
17e00 0d 0a 2d 2d 2d 2d 0d 0a 31 36 0d 0a 31 36 0d 0a  ..----..16..16..
17e10 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
17e20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
17e30 4c 20 39 34 20 46 52 4f 4d 20 74 61 62 32 20 41  L 94 FROM tab2 A
17e40 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 34  S cor0..----..94
17e50 0d 0a 39 34 0d 0a 39 34 0d 0a 0d 0a 71 75 65 72  ..94..94....quer
17e60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
17e70 45 43 54 20 2b 20 2d 20 35 33 20 41 53 20 63 6f  ECT + - 53 AS co
17e80 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
17e90 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a 2d 35  0..----..-53..-5
17ea0 33 0d 0a 2d 35 33 0d 0a 0d 0a 71 75 65 72 79 20  3..-53....query 
17eb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
17ec0 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 31 20 2b  T ALL + + col1 +
17ed0 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31   - col0 * - col1
17ee0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
17ef0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
17f00 0d 0a 31 33 36 30 0d 0a 32 34 38 0d 0a 34 36 36  ..1360..248..466
17f10 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
17f20 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
17f30 54 49 4e 43 54 20 2d 20 37 32 20 2d 20 63 6f 6c  TINCT - 72 - col
17f40 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
17f50 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
17f60 2d 0d 0a 2d 31 35 38 0d 0a 2d 31 36 33 0d 0a 2d  -..-158..-163..-
17f70 31 36 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  169....query I r
17f80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
17f90 20 2b 20 28 20 31 37 20 29 20 2b 20 63 6f 6c 31   + ( 17 ) + col1
17fa0 20 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * - col1 AS col
17fb0 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  2 FROM tab0 cor0
17fc0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 37 39 0d 0a 2d  ..----..-7379..-
17fd0 38 32 36 34 0d 0a 2d 39 33 39 32 0d 0a 0d 0a 71  8264..-9392....q
17fe0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
17ff0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
18000 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  - col1 + + col1 
18010 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
18020 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75  0..----..0....qu
18030 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
18040 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
18050 20 34 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   43 AS col2 FROM
18060 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
18070 2d 2d 2d 0d 0a 34 33 0d 0a 0d 0a 71 75 65 72 79  ---..43....query
18080 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18090 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
180a0 20 2a 20 2d 20 39 20 46 52 4f 4d 20 74 61 62 31   * - 9 FROM tab1
180b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 37 0d 0a 2d 32  ..----..-117..-2
180c0 33 34 0d 0a 2d 39 30 0d 0a 0d 0a 71 75 65 72 79  34..-90....query
180d0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
180e0 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2d 20 38 20  CT - col0 * - 8 
180f0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
18100 0d 0a 2d 2d 2d 2d 0d 0a 32 37 38 0d 0a 33 37 37  ..----..278..377
18110 0d 0a 38 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..803....query I
18120 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18130 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   - cor0.col2 FRO
18140 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74 61  M tab1, tab2, ta
18150 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
18160 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
18170 69 6e 67 20 74 6f 20 34 34 66 64 63 64 37 63 64  ing to 44fdcd7cd
18180 36 30 33 33 35 32 64 34 64 31 32 37 38 31 31 64  603352d4d127811d
18190 31 36 34 63 63 31 65 0d 0a 0d 0a 71 75 65 72 79  164cc1e....query
181a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
181b0 43 54 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31  CT col0 * + col1
181c0 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41   * col0 + col0 A
181d0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
181e0 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 38 36 30 0d 0a  ..----..118860..
181f0 34 39 35 36 30 0d 0a 37 32 30 39 30 30 0d 0a 0d  49560..720900...
18200 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18210 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d  ..SELECT ALL + -
18220 20 63 6f 6c 30 20 2b 20 2d 20 36 33 20 46 52 4f   col0 + - 63 FRO
18230 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
18240 2d 2d 2d 2d 0d 0a 2d 31 34 31 0d 0a 2d 31 34 32  ----..-141..-142
18250 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-70....query I
18260 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18270 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31   DISTINCT - col1
18280 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + + col2 AS col
18290 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
182a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33 0d 0a  or0..----..-53..
182b0 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 71 75 65 72 79  -9..-96....query
182c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
182d0 43 54 20 2b 20 2d 20 31 37 20 41 53 20 63 6f 6c  CT + - 17 AS col
182e0 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
182f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a  or0..----..-17..
18300 2d 31 37 0d 0a 2d 31 37 0d 0a 0d 0a 6f 6e 6c 79  -17..-17....only
18310 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
18320 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
18330 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
18340 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18350 74 20 6c 61 62 65 6c 2d 37 32 36 0d 0a 53 45 4c  t label-726..SEL
18360 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 44 49 56  ECT - + col2 DIV
18370 20 2b 20 37 36 20 41 53 20 63 6f 6c 30 20 46 52   + 76 AS col0 FR
18380 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
18390 2d 2d 0d 0a 2d 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-1..0..0....
183a0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
183b0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
183c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
183d0 61 62 65 6c 2d 37 32 36 0d 0a 53 45 4c 45 43 54  abel-726..SELECT
183e0 20 2d 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 37 36   - + col2 / + 76
183f0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
18400 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b0 cor0..----..-
18410 31 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  1..0..0....query
18420 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
18430 43 54 20 41 4c 4c 20 2b 20 38 20 46 52 4f 4d 20  CT ALL + 8 FROM 
18440 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
18450 0a 38 0d 0a 38 0d 0a 38 0d 0a 0d 0a 71 75 65 72  .8..8..8....quer
18460 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
18470 45 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63  ECT ALL - cor0.c
18480 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol0 FROM tab0, t
18490 61 62 30 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab0 AS cor0, tab
184a0 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d  2 AS cor1..----.
184b0 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
184c0 6e 67 20 74 6f 20 63 33 65 62 66 31 36 39 35 63  ng to c3ebf1695c
184d0 61 37 34 35 36 37 62 64 63 31 37 33 64 62 65 31  a74567bdc173dbe1
184e0 35 31 38 36 61 38 0d 0a 0d 0a 71 75 65 72 79 20  5186a8....query 
184f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
18500 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c  T ALL - cor0.col
18510 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
18520 61 62 31 2c 20 74 61 62 32 20 41 53 20 63 6f 72  ab1, tab2 AS cor
18530 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
18540 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 62 35  s hashing to 7b5
18550 39 33 38 31 32 34 32 35 33 37 39 38 34 32 36 66  938124253798426f
18560 62 66 30 39 63 31 38 65 31 66 64 37 35 0d 0a 0d  bf09c18e1fd75...
18570 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18580 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c  ..SELECT + + col
18590 31 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c  1 * col1 + - col
185a0 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  1 * col0 AS col2
185b0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
185c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 34 0d  r0..----..-1054.
185d0 0a 2d 31 31 32 31 0d 0a 37 34 34 0d 0a 0d 0a 6f  .-1121..744....o
185e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
185f0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
18600 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
18610 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
18620 73 6f 72 74 20 6c 61 62 65 6c 2d 37 33 31 0d 0a  sort label-731..
18630 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20  SELECT ALL col1 
18640 44 49 56 20 2b 20 28 20 63 6f 6c 31 20 29 20 46  DIV + ( col1 ) F
18650 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
18660 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  1..1..1....skipi
18670 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
18680 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
18690 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
186a0 37 33 31 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  731..SELECT ALL 
186b0 63 6f 6c 31 20 2f 20 2b 20 28 20 63 6f 6c 31 20  col1 / + ( col1 
186c0 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  ) FROM tab1..---
186d0 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75  -..1..1..1....qu
186e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
186f0 45 4c 45 43 54 20 41 4c 4c 20 38 33 20 46 52 4f  ELECT ALL 83 FRO
18700 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
18710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
18720 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
18730 31 38 66 34 30 35 63 33 31 61 30 66 62 34 37 63  18f405c31a0fb47c
18740 65 33 63 63 39 66 37 65 66 66 61 38 38 35 35 63  e3cc9f7effa8855c
18750 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18760 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
18770 20 2a 20 2b 20 36 30 20 2b 20 63 6f 6c 30 20 46   * + 60 + col0 F
18780 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
18790 2d 2d 2d 0d 0a 35 31 38 34 0d 0a 35 35 34 39 0d  ---..5184..5549.
187a0 0a 35 38 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49  .5855....query I
187b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
187c0 20 2d 20 39 37 20 41 53 20 63 6f 6c 31 20 46 52   - 97 AS col1 FR
187d0 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 63 6f  OM tab1, tab0 co
187e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
187f0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 34  es hashing to e4
18800 61 36 62 64 38 34 38 61 36 39 32 32 36 63 62 62  a6bd848a69226cbb
18810 37 61 64 33 64 31 35 34 62 65 33 32 31 62 0d 0a  7ad3d154be321b..
18820 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18830 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 28 20  t..SELECT + + ( 
18840 35 34 20 29 20 2a 20 63 6f 6c 32 20 46 52 4f 4d  54 ) * col2 FROM
18850 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
18860 0d 0a 31 37 38 32 0d 0a 34 34 32 38 0d 0a 35 34  ..1782..4428..54
18870 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
18880 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
18890 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   + + col1 * + co
188a0 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
188b0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 30  tab2..----..1560
188c0 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a 0d 0a 71 75  ..684..864....qu
188d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
188e0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 32  ELECT DISTINCT 2
188f0 35 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20  5 * - col2 FROM 
18900 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 35  tab1..----..-135
18910 30 0d 0a 2d 31 34 32 35 0d 0a 2d 32 34 30 30 0d  0..-1425..-2400.
18920 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
18930 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
18940 20 28 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 63   ( tab2.col0 * c
18950 6f 6c 31 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol1 ) AS col2 FR
18960 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
18970 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30  1343..-217..-460
18980 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
18990 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 30 20  sort..SELECT 50 
189a0 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
189b0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
189c0 0d 0a 2d 31 32 30 30 0d 0a 2d 31 37 35 30 0d 0a  ..-1200..-1750..
189d0 2d 34 34 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49  -4450....query I
189e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
189f0 20 41 4c 4c 20 2b 20 37 33 20 2a 20 2d 20 32 32   ALL + 73 * - 22
18a00 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
18a10 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 30 36 0d  b2..----..-1606.
18a20 0a 2d 31 36 30 36 0d 0a 2d 31 36 30 36 0d 0a 0d  .-1606..-1606...
18a30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
18a40 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 2d 20 63  ..SELECT + ( - c
18a50 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 32 0d  ol2 ) FROM tab2.
18a60 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d  .----..-26..-27.
18a70 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-38....query I 
18a80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
18a90 2d 20 32 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  - 25 AS col1 FRO
18aa0 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53 20  M tab2, tab2 AS 
18ab0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
18ac0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
18ad0 34 30 61 63 38 66 64 30 30 30 62 32 65 34 39 33  40ac8fd000b2e493
18ae0 31 37 61 65 64 32 34 31 31 30 37 37 38 33 39 65  17aed2411077839e
18af0 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
18b00 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
18b10 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f  SELECT ALL * FRO
18b20 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74 61  M tab2, tab0, ta
18b30 62 30 20 63 6f 72 30 2c 20 74 61 62 31 0d 0a 2d  b0 cor0, tab1..-
18b40 2d 2d 2d 0d 0a 39 37 32 20 76 61 6c 75 65 73 20  ---..972 values 
18b50 68 61 73 68 69 6e 67 20 74 6f 20 35 36 32 31 36  hashing to 56216
18b60 37 35 62 31 62 64 33 32 62 30 36 31 64 32 38 34  75b1bd32b061d284
18b70 64 30 34 34 34 63 37 36 36 30 31 0d 0a 0d 0a 71  d0444c76601....q
18b80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18b90 53 45 4c 45 43 54 20 2d 20 33 20 41 53 20 63 6f  SELECT - 3 AS co
18ba0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
18bb0 2d 2d 0d 0a 2d 33 0d 0a 2d 33 0d 0a 2d 33 0d 0a  --..-3..-3..-3..
18bc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
18bd0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20  t..SELECT ALL - 
18be0 39 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  91 AS col1 FROM 
18bf0 74 61 62 32 2c 20 74 61 62 31 20 41 53 20 63 6f  tab2, tab1 AS co
18c00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
18c10 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 37 34  es hashing to 74
18c20 35 64 31 63 33 61 30 39 64 39 33 35 34 36 35 63  5d1c3a09d935465c
18c30 61 64 35 35 32 33 32 35 63 35 63 39 34 35 0d 0a  ad552325c5c945..
18c40 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
18c50 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
18c60 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
18c70 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
18c80 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
18c90 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 36 0d 0a  sort label-746..
18ca0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20  SELECT col0 + + 
18cb0 43 41 53 54 28 20 2d 20 63 6f 6c 32 20 41 53 20  CAST( - col2 AS 
18cc0 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
18cd0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
18ce0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
18cf0 2d 0d 0a 32 39 31 39 0d 0a 33 33 31 33 0d 0a 39  -..2919..3313..9
18d00 32 39 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  296....skipif my
18d10 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
18d20 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
18d30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 34 36 0d  wsort label-746.
18d40 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2b  .SELECT col0 + +
18d50 20 43 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 41   CAST ( - col2 A
18d60 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20  S INTEGER ) * - 
18d70 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  col2 AS col1 FRO
18d80 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
18d90 2d 2d 2d 2d 0d 0a 32 39 31 39 0d 0a 33 33 31 33  ----..2919..3313
18da0 0d 0a 39 32 39 36 0d 0a 0d 0a 73 6b 69 70 69 66  ..9296....skipif
18db0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
18dc0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
18dd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18de0 20 2b 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28   + col0 + CAST (
18df0 20 63 6f 6c 32 20 41 53 20 52 45 41 4c 20 29 20   col2 AS REAL ) 
18e00 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
18e10 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37  0..----..121..17
18e20 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..57....query I
18e30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
18e40 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f   ALL - col1 * co
18e50 6c 30 20 2b 20 31 30 20 46 52 4f 4d 20 74 61 62  l0 + 10 FROM tab
18e60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
18e70 0a 2d 31 33 33 33 0d 0a 2d 32 30 37 0d 0a 2d 34  .-1333..-207..-4
18e80 35 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  592....query I r
18e90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
18ea0 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 41 53 20   col1 + col1 AS 
18eb0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
18ec0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
18ed0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
18ee0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
18ef0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
18f00 2d 20 63 6f 6c 31 20 2b 20 35 34 20 2a 20 39 33  - col1 + 54 * 93
18f10 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
18f20 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 31 32 31 0d  b0..----..13121.
18f30 0a 37 30 38 36 0d 0a 38 34 31 37 0d 0a 0d 0a 71  .7086..8417....q
18f40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
18f50 53 45 4c 45 43 54 20 2b 20 35 37 20 2a 20 2b 20  SELECT + 57 * + 
18f60 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
18f70 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  1 FROM tab2, tab
18f80 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  1, tab1 AS cor0.
18f90 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73  .----..27 values
18fa0 20 68 61 73 68 69 6e 67 20 74 6f 20 63 34 35 66   hashing to c45f
18fb0 62 31 35 65 38 37 39 32 65 63 39 64 61 35 36 32  b15e8792ec9da562
18fc0 36 37 33 39 63 64 39 66 64 33 62 63 0d 0a 0d 0a  6739cd9fd3bc....
18fd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
18fe0 0a 53 45 4c 45 43 54 20 2d 20 37 35 20 2a 20 63  .SELECT - 75 * c
18ff0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
19000 2d 2d 2d 0d 0a 2d 32 32 35 0d 0a 2d 34 38 30 30  ---..-225..-4800
19010 0d 0a 2d 36 30 30 30 0d 0a 0d 0a 71 75 65 72 79  ..-6000....query
19020 20 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f   IIIIIIIII rowso
19030 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a  rt..SELECT ALL *
19040 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
19050 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
19060 62 32 2c 20 74 61 62 30 20 63 6f 72 31 0d 0a 2d  b2, tab0 cor1..-
19070 2d 2d 2d 0d 0a 32 34 33 20 76 61 6c 75 65 73 20  ---..243 values 
19080 68 61 73 68 69 6e 67 20 74 6f 20 62 33 33 32 33  hashing to b3323
19090 37 30 34 66 36 38 37 33 31 31 33 64 38 36 33 66  704f6873113d863f
190a0 38 65 32 37 33 38 36 62 33 35 36 0d 0a 0d 0a 71  8e27386b356....q
190b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
190c0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
190d0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  + cor0.col2 FROM
190e0 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
190f0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 20 41 53  OSS JOIN tab1 AS
19100 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d   cor1..----..54.
19110 0a 35 37 0d 0a 39 36 0d 0a 0d 0a 73 6b 69 70 69  .57..96....skipi
19120 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
19130 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
19140 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
19150 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
19160 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
19170 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
19180 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d 20  - cor0.col1 * - 
19190 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 63 6f 6c 30  col2 * col1 col0
191a0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
191b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d  r0..----..10982.
191c0 0a 32 35 39 34 37 0d 0a 39 30 35 30 36 0d 0a 0d  .25947..90506...
191d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
191e0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
191f0 2a 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c  * ( col2 ) + col
19200 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
19210 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
19220 2d 0d 0a 32 31 36 0d 0a 33 37 30 35 0d 0a 37 37  -..216..3705..77
19230 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
19240 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
19250 4c 20 63 6f 6c 30 20 2a 20 2d 20 28 20 63 6f 72  L col0 * - ( cor
19260 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20  0.col0 * col1 ) 
19270 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
19280 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
19290 0a 2d 32 33 34 0d 0a 2d 34 30 39 36 30 0d 0a 2d  .-234..-40960..-
192a0 38 33 32 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  83200....query I
192b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
192c0 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30   DISTINCT - col0
192d0 20 2a 20 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f   * ( col1 ) + co
192e0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
192f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 37  cor0..----..-197
19300 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38 30 30 38 0d  8..-3298..-8008.
19310 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19320 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30 2e  rt..SELECT cor0.
19330 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46 52  col2 + - col1 FR
19340 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
19350 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a 38  .----..28..47..8
19360 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  3....onlyif mysq
19370 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
19380 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
19390 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
193a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
193b0 2d 37 36 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  -760..SELECT ALL
193c0 20 2b 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 30   + col2 DIV col0
193d0 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c   + + col0 AS col
193e0 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
193f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 0d 0a 36  or0..----..21..6
19400 34 0d 0a 38 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..81....skipif 
19410 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
19420 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
19430 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36  rowsort label-76
19440 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  0..SELECT ALL + 
19450 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 2b 20 2b 20  col2 / col0 + + 
19460 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f  col0 AS col0 FRO
19470 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
19480 2d 2d 2d 2d 0d 0a 32 31 0d 0a 36 34 0d 0a 38 31  ----..21..64..81
19490 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
194a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32  ort..SELECT col2
194b0 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   * cor0.col1 + c
194c0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
194d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36   cor0..----..126
194e0 31 0d 0a 31 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a  1..1430..580....
194f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
19500 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
19510 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41   + col1 * col2 A
19520 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
19530 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
19540 31 35 33 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a  1534..646..837..
19550 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
19560 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
19570 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
19580 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
19590 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 36  rowsort label-76
195a0 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
195b0 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 38 32  CT + col0 DIV 82
195c0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
195d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73  r0..----..0....s
195e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
195f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
19600 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
19610 62 65 6c 2d 37 36 33 0d 0a 53 45 4c 45 43 54 20  bel-763..SELECT 
19620 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20  DISTINCT + col0 
19630 2f 20 38 32 20 46 52 4f 4d 20 74 61 62 31 20 41  / 82 FROM tab1 A
19640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
19650 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19660 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
19670 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b 20 28   cor0.col0 * + (
19680 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 29 20 2b   + cor0.col0 ) +
19690 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   - col1 FROM tab
196a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
196b0 0a 31 38 0d 0a 36 30 32 35 0d 0a 36 32 32 34 0d  .18..6025..6224.
196c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
196d0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  rt..SELECT - col
196e0 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  0 + cor0.col0 + 
196f0 39 38 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63  98 * + col1 AS c
19700 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
19710 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37   cor0..----..127
19720 34 0d 0a 32 35 34 38 0d 0a 39 38 30 0d 0a 0d 0a  4..2548..980....
19730 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
19740 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
19750 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
19760 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
19770 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
19780 72 74 20 6c 61 62 65 6c 2d 37 36 36 0d 0a 53 45  rt label-766..SE
19790 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20  LECT ALL - col0 
197a0 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20  * CAST( NULL AS 
197b0 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 31  SIGNED ) AS col1
197c0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
197d0 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
197e0 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
197f0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
19800 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
19810 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
19820 37 36 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  766..SELECT ALL 
19830 2d 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20  - col0 * CAST ( 
19840 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20  NULL AS INTEGER 
19850 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  ) AS col1 FROM t
19860 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
19870 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
19880 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19890 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
198a0 6c 30 20 2a 20 2b 20 28 20 63 6f 72 30 2e 63 6f  l0 * + ( cor0.co
198b0 6c 32 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  l2 ) + cor0.col0
198c0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
198d0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
198e0 0d 0a 2d 31 38 32 0d 0a 2d 31 39 35 30 0d 0a 2d  ..-182..-1950..-
198f0 32 39 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2923....query I 
19900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19910 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20  DISTINCT + col2 
19920 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30  + + col0 AS col0
19930 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
19940 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31  r0..----..121..1
19950 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  76..57....query 
19960 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19970 54 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  T + - cor0.col2 
19980 2a 20 63 6f 6c 32 20 2b 20 2b 20 28 20 63 6f 6c  * col2 + + ( col
19990 30 20 29 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63  0 ) * - col0 * c
199a0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol2 FROM tab2 AS
199b0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
199c0 38 38 36 30 0d 0a 2d 32 30 35 32 0d 0a 2d 32 33  8860..-2052..-23
199d0 38 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 49  8602....query II
199e0 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d  IIIIIII rowsort.
199f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52  .SELECT ALL * FR
19a00 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 2c 20 74  OM tab2, tab0, t
19a10 61 62 32 20 63 6f 72 30 20 57 48 45 52 45 20 4e  ab2 cor0 WHERE N
19a20 4f 54 20 28 20 4e 55 4c 4c 20 29 20 4e 4f 54 20  OT ( NULL ) NOT 
19a30 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e 44  BETWEEN NULL AND
19a40 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   NULL..----....q
19a50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19a60 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 72  SELECT ALL + cor
19a70 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
19a80 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20  ROM tab1, tab2, 
19a90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
19aa0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
19ab0 73 68 69 6e 67 20 74 6f 20 37 66 34 61 39 62 66  shing to 7f4a9bf
19ac0 32 34 64 36 34 38 33 33 37 30 36 64 66 62 64 64  24d64833706dfbdd
19ad0 30 62 61 66 34 39 64 37 39 0d 0a 0d 0a 71 75 65  0baf49d79....que
19ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19af0 4c 45 43 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31  LECT - tab1.col1
19b00 20 2a 20 2d 20 31 33 20 2d 20 2d 20 34 32 20 41   * - 13 - - 42 A
19b10 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
19b20 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
19b30 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
19b40 61 73 68 69 6e 67 20 74 6f 20 63 33 36 65 30 33  ashing to c36e03
19b50 64 30 39 62 36 38 35 31 30 36 37 37 31 66 34 36  d09b685106771f46
19b60 61 35 32 31 37 61 32 33 31 38 0d 0a 0d 0a 71 75  a5217a2318....qu
19b70 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19b80 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
19b90 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 36   col2 + col0 * 6
19ba0 37 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  7 AS col1 FROM t
19bb0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 35 35 0d 0a  ab1..----..255..
19bc0 34 33 34 35 0d 0a 35 34 35 36 0d 0a 0d 0a 71 75  4345..5456....qu
19bd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
19be0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30  ELECT ALL + col0
19bf0 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
19c00 32 0d 0a 2d 2d 2d 2d 0d 0a 34 39 0d 0a 36 30 38  2..----..49..608
19c10 34 0d 0a 36 32 34 31 0d 0a 0d 0a 71 75 65 72 79  4..6241....query
19c20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
19c30 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30  CT DISTINCT tab0
19c40 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
19c50 4f 4d 20 74 61 62 30 2c 20 74 61 62 32 2c 20 74  OM tab0, tab2, t
19c60 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
19c70 2d 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d  -..24..35..89...
19c80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
19c90 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2b 20 74  ..SELECT - ( + t
19ca0 61 62 32 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20  ab2.col1 ) FROM 
19cb0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d  tab2..----..-17.
19cc0 0a 2d 33 31 0d 0a 2d 35 39 0d 0a 0d 0a 71 75 65  .-31..-59....que
19cd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
19ce0 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2b 20  LECT - col1 * + 
19cf0 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  col2 * col1 FROM
19d00 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
19d10 2d 2d 2d 0d 0a 2d 31 30 39 38 32 0d 0a 2d 32 35  ---..-10982..-25
19d20 39 34 37 0d 0a 2d 39 30 35 30 36 0d 0a 0d 0a 71  947..-90506....q
19d30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
19d40 53 45 4c 45 43 54 20 2d 20 2d 20 37 20 46 52 4f  SELECT - - 7 FRO
19d50 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
19d60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
19d70 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
19d80 33 33 36 32 63 30 63 62 32 62 32 63 36 36 33 30  3362c0cb2b2c6630
19d90 33 37 31 35 39 64 30 36 39 39 64 34 36 62 37 36  37159d0699d46b76
19da0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
19db0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
19dc0 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 31  INCT - cor0.col1
19dd0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
19de0 62 31 2c 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  b1, tab0 cor0..-
19df0 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d  ---..-86..-91..-
19e00 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
19e10 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
19e20 2d 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  - col0 + cor0.co
19e30 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l0 FROM tab0 AS 
19e40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 38 0d  cor0..----..178.
19e50 0a 34 38 0d 0a 37 30 0d 0a 0d 0a 71 75 65 72 79  .48..70....query
19e60 20 49 49 49 49 49 49 49 49 49 49 49 49 20 72 6f   IIIIIIIIIIII ro
19e70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
19e80 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61  STINCT * FROM ta
19e90 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
19ea0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20  , tab1 AS cor1, 
19eb0 74 61 62 30 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  tab0 cor2..----.
19ec0 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
19ed0 69 6e 67 20 74 6f 20 39 35 39 32 30 34 30 33 64  ing to 95920403d
19ee0 66 32 36 38 61 32 37 32 63 34 65 39 33 33 63 64  f268a272c4e933cd
19ef0 30 62 62 65 30 62 65 0d 0a 0d 0a 73 6b 69 70 69  0bbe0be....skipi
19f00 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
19f10 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
19f20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
19f30 54 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 43 41 53  T - col2 * + CAS
19f40 54 20 28 20 2d 20 34 30 20 41 53 20 52 45 41 4c  T ( - 40 AS REAL
19f50 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
19f60 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
19f70 0a 31 33 32 30 0d 0a 33 32 38 30 0d 0a 34 30 0d  .1320..3280..40.
19f80 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
19f90 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 72  rt..SELECT + cor
19fa0 30 2e 63 6f 6c 30 20 2a 20 2b 20 37 32 20 46 52  0.col0 * + 72 FR
19fb0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
19fc0 2d 2d 0d 0a 31 37 32 38 0d 0a 32 35 32 30 0d 0a  --..1728..2520..
19fd0 36 34 30 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6408....query I 
19fe0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
19ff0 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  cor0.col1 AS col
1a000 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  2 FROM tab0, tab
1a010 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
1a020 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
1a030 67 20 74 6f 20 63 36 31 64 32 37 61 30 30 32 32  g to c61d27a0022
1a040 65 36 64 30 32 32 33 37 31 64 63 35 38 38 31 39  e6d022371dc58819
1a050 61 62 32 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ab272....query I
1a060 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1a070 20 35 38 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   58 AS col1 FROM
1a080 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 38 0d   tab1..----..58.
1a090 0a 35 38 0d 0a 35 38 0d 0a 0d 0a 71 75 65 72 79  .58..58....query
1a0a0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1a0b0 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 28  CT cor0.col0 + (
1a0c0 20 2b 20 35 39 20 29 20 2a 20 2d 20 63 6f 6c 31   + 59 ) * - col1
1a0d0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1a0e0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 33 31 0d  r0..----..-1531.
1a0f0 0a 2d 35 32 36 0d 0a 2d 36 38 37 0d 0a 0d 0a 71  .-526..-687....q
1a100 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1a110 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1a120 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  col0 + - cor0.co
1a130 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
1a140 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1a150 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d  --..-16..-51..7.
1a160 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1a170 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
1a180 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20 63 6f 6c   cor0.col0 - col
1a190 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1a1a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
1a1b0 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .0....query I ro
1a1c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1a1d0 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20  STINCT - + col1 
1a1e0 2a 20 35 32 20 2b 20 2d 20 31 32 20 46 52 4f 4d  * 52 + - 12 FROM
1a1f0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1a200 2d 2d 2d 0d 0a 2d 34 34 38 34 0d 0a 2d 34 37 34  ---..-4484..-474
1a210 34 0d 0a 2d 35 30 35 36 0d 0a 0d 0a 71 75 65 72  4..-5056....quer
1a220 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a230 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63 6f 6c 31  ECT ALL + - col1
1a240 20 2a 20 28 20 2d 20 63 6f 6c 31 20 29 20 2a 20   * ( - col1 ) * 
1a250 2d 20 63 6f 6c 31 20 2b 20 2d 20 35 31 20 41 53  - col1 + - 51 AS
1a260 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1a270 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1a280 36 33 36 31 30 37 0d 0a 2d 37 35 33 36 32 32 0d  636107..-753622.
1a290 0a 2d 39 31 32 37 32 34 0d 0a 0d 0a 73 6b 69 70  .-912724....skip
1a2a0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1a2b0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1a2c0 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1a2d0 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1a2e0 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1a2f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 32  sort..SELECT - 2
1a300 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 63 6f  0 * cor0.col1 co
1a310 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1a320 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38  cor0..----..-118
1a330 30 0d 0a 2d 33 34 30 0d 0a 2d 36 32 30 0d 0a 0d  0..-340..-620...
1a340 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1a350 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1a360 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1a370 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1a380 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 32  owsort label-792
1a390 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1a3a0 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 44 49  T col1 + col1 DI
1a3b0 56 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  V - col2 FROM ta
1a3c0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1a3d0 0d 0a 30 0d 0a 38 34 0d 0a 39 30 0d 0a 0d 0a 73  ..0..84..90....s
1a3e0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
1a3f0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
1a400 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a410 62 65 6c 2d 37 39 32 0d 0a 53 45 4c 45 43 54 20  bel-792..SELECT 
1a420 44 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20  DISTINCT col1 + 
1a430 63 6f 6c 31 20 2f 20 2d 20 63 6f 6c 32 20 46 52  col1 / - col2 FR
1a440 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1a450 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 38 34 0d 0a 39 30  .----..0..84..90
1a460 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1a470 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 32 20 2b  ort..SELECT 52 +
1a480 20 2d 20 33 37 20 46 52 4f 4d 20 74 61 62 32 20   - 37 FROM tab2 
1a490 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1a4a0 35 0d 0a 31 35 0d 0a 31 35 0d 0a 0d 0a 71 75 65  5..15..15....que
1a4b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1a4c0 4c 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2b 20  LECT - + col2 + 
1a4d0 2d 20 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  - ( col2 ) FROM 
1a4e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1a4f0 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 31 31 34 0d 0a  --..-108..-114..
1a500 2d 31 39 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -192....onlyif m
1a510 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1a520 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1a530 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1a540 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a550 62 65 6c 2d 37 39 35 0d 0a 53 45 4c 45 43 54 20  bel-795..SELECT 
1a560 2b 20 2b 20 33 35 20 44 49 56 20 2b 20 63 6f 6c  + + 35 DIV + col
1a570 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
1a580 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d  or0..----..0..0.
1a590 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .0....skipif mys
1a5a0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1a5b0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1a5c0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 35 0d 0a  sort label-795..
1a5d0 53 45 4c 45 43 54 20 2b 20 2b 20 33 35 20 2f 20  SELECT + + 35 / 
1a5e0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
1a5f0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1a600 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69  0..0..0....onlyi
1a610 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72  f mysql # suppor
1a620 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63  t for MySQL spec
1a630 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65  ific system type
1a640 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75  s and syntax..qu
1a650 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1a660 62 65 6c 2d 37 39 36 0d 0a 53 45 4c 45 43 54 20  bel-796..SELECT 
1a670 2d 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20  - CAST( col2 AS 
1a680 53 49 47 4e 45 44 20 29 20 2a 20 63 6f 6c 32 20  SIGNED ) * col2 
1a690 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
1a6a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1a6b0 34 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d  444..-676..-729.
1a6c0 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1a6d0 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1a6e0 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1a6f0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1a700 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70  ut columns..skip
1a710 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1a720 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1a730 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1a740 2d 37 39 36 0d 0a 53 45 4c 45 43 54 20 2d 20 43  -796..SELECT - C
1a750 41 53 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e  AST ( col2 AS IN
1a760 54 45 47 45 52 20 29 20 2a 20 63 6f 6c 32 20 63  TEGER ) * col2 c
1a770 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1a780 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
1a790 34 34 0d 0a 2d 36 37 36 0d 0a 2d 37 32 39 0d 0a  44..-676..-729..
1a7a0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1a7b0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1a7c0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1a7d0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1a7e0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1a7f0 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 37 0d 0a  sort label-797..
1a800 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20  SELECT - - col1 
1a810 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  - + col2 * - col
1a820 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c 20 41  0 * CAST( NULL A
1a830 53 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20  S SIGNED ) FROM 
1a840 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1a850 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
1a860 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
1a870 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1a880 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1a890 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 37 39 37  owsort label-797
1a8a0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
1a8b0 31 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63  1 - + col2 * - c
1a8c0 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e 55 4c  ol0 * CAST ( NUL
1a8d0 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 46  L AS INTEGER ) F
1a8e0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1a8f0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
1a900 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72  LL..NULL....quer
1a910 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1a920 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
1a930 20 63 6f 6c 32 20 2b 20 34 39 20 41 53 20 63 6f   col2 + 49 AS co
1a940 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
1a950 2d 2d 0d 0a 31 34 39 33 0d 0a 37 32 35 0d 0a 37  --..1493..725..7
1a960 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  78....query I ro
1a970 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1a980 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20 38 36  cor0.col2 + - 86
1a990 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1a9a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 32 0d 0a  r0..----..-112..
1a9b0 2d 31 31 33 0d 0a 2d 31 32 34 0d 0a 0d 0a 71 75  -113..-124....qu
1a9c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1a9d0 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a  ELECT - - col1 *
1a9e0 20 2b 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32   + ( + cor0.col2
1a9f0 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
1aa00 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1aa10 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a 38  --..1534..646..8
1aa20 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
1aa30 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1aa40 31 36 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  16 + + col0 FROM
1aa50 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab0 cor0..----
1aa60 0d 0a 31 30 35 0d 0a 34 30 0d 0a 35 31 0d 0a 0d  ..105..40..51...
1aa70 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1aa80 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1aa90 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1aaa0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1aab0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 30 32  owsort label-802
1aac0 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f 6c  ..SELECT - - col
1aad0 31 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f  1 DIV - col1 FRO
1aae0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
1aaf0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31  ----..-1..-1..-1
1ab00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
1ab10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
1ab20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
1ab30 72 74 20 6c 61 62 65 6c 2d 38 30 32 0d 0a 53 45  rt label-802..SE
1ab40 4c 45 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2f 20  LECT - - col1 / 
1ab50 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
1ab60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1ab70 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 71 75  -1..-1..-1....qu
1ab80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ab90 45 4c 45 43 54 20 2d 20 31 32 20 46 52 4f 4d 20  ELECT - 12 FROM 
1aba0 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72 30 0d  tab1, tab0 cor0.
1abb0 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
1abc0 68 61 73 68 69 6e 67 20 74 6f 20 65 36 39 38 64  hashing to e698d
1abd0 64 35 37 64 33 61 61 63 33 30 61 66 31 34 63 65  d57d3aac30af14ce
1abe0 33 35 64 61 34 33 34 62 62 34 35 0d 0a 0d 0a 71  35da434bb45....q
1abf0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ac00 53 45 4c 45 43 54 20 2d 20 33 31 20 2b 20 63 6f  SELECT - 31 + co
1ac10 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
1ac20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1ac30 2d 2d 0d 0a 2d 32 38 0d 0a 33 33 0d 0a 34 39 0d  --..-28..33..49.
1ac40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1ac50 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 32 20  rt..SELECT - 52 
1ac60 2a 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 46 52  * - tab2.col0 FR
1ac70 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab2..----..3
1ac80 36 34 0d 0a 34 30 35 36 0d 0a 34 31 30 38 0d 0a  64..4056..4108..
1ac90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1aca0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 34 31  t..SELECT ALL 41
1acb0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
1acc0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 34 31 0d 0a 34 31  b1..----..41..41
1acd0 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..41....query I 
1ace0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1acf0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
1ad00 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  * col0 + col0 AS
1ad10 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
1ad20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
1ad30 37 32 30 39 0d 0a 2d 37 36 38 0d 0a 30 0d 0a 0d  7209..-768..0...
1ad40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ad50 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
1ad60 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + + col1 AS col2
1ad70 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
1ad80 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a  .----..0..0..0..
1ad90 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1ada0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1adb0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1adc0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1add0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1ade0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1adf0 43 54 20 41 4c 4c 20 2b 20 36 20 63 6f 6c 30 20  CT ALL + 6 col0 
1ae00 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1ae10 2d 2d 2d 2d 0d 0a 36 0d 0a 36 0d 0a 36 0d 0a 0d  ----..6..6..6...
1ae20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ae30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1ae40 54 20 2b 20 37 35 20 2b 20 2d 20 63 6f 72 30 2e  T + 75 + - cor0.
1ae50 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
1ae60 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1ae70 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 34 0d 0a 36 38  ----..-3..-4..68
1ae80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1ae90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1aea0 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 2d 20 63  - ( col2 ) * - c
1aeb0 6f 6c 32 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  ol2 - col2 AS co
1aec0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1aed0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 30 36  cor0..----..1406
1aee0 0d 0a 36 35 30 0d 0a 37 30 32 0d 0a 0d 0a 71 75  ..650..702....qu
1aef0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1af00 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63  ELECT - col2 * c
1af10 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2b 20 63  ol0 * col2 + + c
1af20 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
1af30 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1af40 2d 2d 2d 0d 0a 2d 32 30 37 39 32 36 0d 0a 2d 37  ---..-207926..-7
1af50 33 37 32 36 37 0d 0a 2d 38 37 32 32 0d 0a 0d 0a  37267..-8722....
1af60 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
1af70 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
1af80 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
1af90 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
1afa0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 31 33 0d  wsort label-813.
1afb0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1afc0 20 2d 20 32 39 20 44 49 56 20 2b 20 63 6f 72 30   - 29 DIV + cor0
1afd0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
1afe0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1aff0 0a 2d 2d 2d 2d 0d 0a 2d 34 0d 0a 30 0d 0a 0d 0a  .----..-4..0....
1b000 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
1b010 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
1b020 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1b030 61 62 65 6c 2d 38 31 33 0d 0a 53 45 4c 45 43 54  abel-813..SELECT
1b040 20 44 49 53 54 49 4e 43 54 20 2d 20 32 39 20 2f   DISTINCT - 29 /
1b050 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
1b060 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1b070 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  S cor0..----..-4
1b080 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
1b090 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1b0a0 20 38 38 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f   88 - col0 AS co
1b0b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
1b0c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 36  cor0..----..-166
1b0d0 0d 0a 2d 31 36 37 0d 0a 2d 39 35 0d 0a 0d 0a 71  ..-167..-95....q
1b0e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b0f0 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
1b100 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  * cor0.col1 AS c
1b110 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
1b120 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33   cor0..----..153
1b130 34 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71  4..646..837....q
1b140 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1b150 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
1b160 63 6f 6c 31 20 2b 20 36 36 20 46 52 4f 4d 20 74  col1 + 66 FROM t
1b170 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
1b180 2d 0d 0a 2d 31 32 0d 0a 2d 35 37 34 0d 0a 2d 39  -..-12..-574..-9
1b190 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  74....query I ro
1b1a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 28 20  wsort..SELECT ( 
1b1b0 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 29 20  col1 + - col1 ) 
1b1c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1b1d0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
1b1e0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b1f0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b200 2b 20 74 61 62 30 2e 63 6f 6c 30 20 46 52 4f 4d  + tab0.col0 FROM
1b210 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
1b220 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
1b230 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
1b240 62 34 39 37 39 39 39 34 32 61 39 65 33 35 33 61  b49799942a9e353a
1b250 33 64 32 37 39 63 66 36 34 65 66 33 66 36 33 0d  3d279cf64ef3f63.
1b260 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b270 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1b280 4e 43 54 20 34 20 41 53 20 63 6f 6c 30 20 46 52  NCT 4 AS col0 FR
1b290 4f 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  OM tab2, tab0 AS
1b2a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 0d 0a   cor0..----..4..
1b2b0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1b2c0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1b2d0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1b2e0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1b2f0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1b300 73 6f 72 74 20 6c 61 62 65 6c 2d 38 32 30 0d 0a  sort label-820..
1b310 53 45 4c 45 43 54 20 2b 20 2d 20 31 36 20 2a 20  SELECT + - 16 * 
1b320 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2d 20 43 41  cor0.col0 + - CA
1b330 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
1b340 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  ED ) AS col0 FRO
1b350 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1b360 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
1b370 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
1b380 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1b390 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1b3a0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1b3b0 32 30 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 31  20..SELECT + - 1
1b3c0 36 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  6 * cor0.col0 + 
1b3d0 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53  - CAST ( NULL AS
1b3e0 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
1b3f0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1b400 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
1b410 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
1b420 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1b430 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20  .SELECT ALL - - 
1b440 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31  cor0.col1 * col1
1b450 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1b460 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d 0a 31  r0..----..100..1
1b470 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75 65 72 79  69..676....query
1b480 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b490 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
1b4a0 35 31 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f 4d  51 ) * col1 FROM
1b4b0 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32   tab1..----..132
1b4c0 36 0d 0a 35 31 30 0d 0a 36 36 33 0d 0a 0d 0a 6f  6..510..663....o
1b4d0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
1b4e0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
1b4f0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
1b500 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
1b510 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b520 74 20 6c 61 62 65 6c 2d 38 32 33 0d 0a 53 45 4c  t label-823..SEL
1b530 45 43 54 20 2d 20 28 20 2d 20 63 6f 6c 31 20 29  ECT - ( - col1 )
1b540 20 2b 20 2d 20 43 41 53 54 28 20 2b 20 38 30 20   + - CAST( + 80 
1b550 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 63 6f  AS SIGNED ) + co
1b560 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l2 FROM tab0 AS 
1b570 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a  cor0..----..18..
1b580 33 39 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70 69 66  39..93....skipif
1b590 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1b5a0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1b5b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1b5c0 32 33 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 2d  23..SELECT - ( -
1b5d0 20 63 6f 6c 31 20 29 20 2b 20 2d 20 43 41 53 54   col1 ) + - CAST
1b5e0 20 28 20 2b 20 38 30 20 41 53 20 49 4e 54 45 47   ( + 80 AS INTEG
1b5f0 45 52 20 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  ER ) + col2 FROM
1b600 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1b610 2d 2d 2d 0d 0a 31 38 0d 0a 33 39 0d 0a 39 33 0d  ---..18..39..93.
1b620 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1b630 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1b640 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1b650 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1b660 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1b670 32 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  24..SELECT DISTI
1b680 4e 43 54 20 74 61 62 31 2e 63 6f 6c 30 20 44 49  NCT tab1.col0 DI
1b690 56 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  V col0 FROM tab1
1b6a0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69  ..----..1....ski
1b6b0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1b6c0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1b6d0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1b6e0 6c 2d 38 32 34 0d 0a 53 45 4c 45 43 54 20 44 49  l-824..SELECT DI
1b6f0 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 30  STINCT tab1.col0
1b700 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   / col0 FROM tab
1b710 31 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 71 75  1..----..1....qu
1b720 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1b730 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
1b740 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
1b750 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
1b760 31 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d  1343..217..4602.
1b770 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1b780 72 74 0d 0a 53 45 4c 45 43 54 20 34 31 20 41 53  rt..SELECT 41 AS
1b790 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1b7a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
1b7b0 31 0d 0a 34 31 0d 0a 34 31 0d 0a 0d 0a 71 75 65  1..41..41....que
1b7c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1b7d0 4c 45 43 54 20 28 20 74 61 62 31 2e 63 6f 6c 31  LECT ( tab1.col1
1b7e0 20 29 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63   ) * - col2 AS c
1b7f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
1b800 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30  ---..-1248..-140
1b810 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79  4..-570....query
1b820 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1b830 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30  CT DISTINCT cor0
1b840 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52  .col1 AS col1 FR
1b850 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  OM tab1 cor0..--
1b860 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a  --..10..13..26..
1b870 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b880 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1b890 43 54 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 72 30  CT col1 - + cor0
1b8a0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52  .col0 AS col1 FR
1b8b0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
1b8c0 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34  --..-19..-62..24
1b8d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1b8e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1b8f0 32 33 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f  23 + col2 * - co
1b900 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1b910 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 36  cor0..----..-166
1b920 0d 0a 2d 32 30 30 35 0d 0a 2d 32 39 37 39 0d 0a  ..-2005..-2979..
1b930 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1b940 74 0d 0a 53 45 4c 45 43 54 20 2b 20 33 35 20 2b  t..SELECT + 35 +
1b950 20 39 39 20 46 52 4f 4d 20 74 61 62 31 20 41 53   99 FROM tab1 AS
1b960 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 34   cor0..----..134
1b970 0d 0a 31 33 34 0d 0a 31 33 34 0d 0a 0d 0a 6f 6e  ..134..134....on
1b980 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
1b990 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
1b9a0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
1b9b0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
1b9c0 6f 72 74 20 6c 61 62 65 6c 2d 38 33 32 0d 0a 53  ort label-832..S
1b9d0 45 4c 45 43 54 20 2b 20 38 34 20 44 49 56 20 39  ELECT + 84 DIV 9
1b9e0 34 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  4 FROM tab0 AS c
1b9f0 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
1ba00 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab2, tab0 AS cor
1ba10 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
1ba20 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 32  es hashing to e2
1ba30 35 36 38 62 30 31 64 64 34 31 31 62 35 61 32 30  568b01dd411b5a20
1ba40 36 30 36 38 36 39 37 64 30 65 64 30 64 32 0d 0a  6068697d0ed0d2..
1ba50 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1ba60 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1ba70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1ba80 20 6c 61 62 65 6c 2d 38 33 32 0d 0a 53 45 4c 45   label-832..SELE
1ba90 43 54 20 2b 20 38 34 20 2f 20 39 34 20 46 52 4f  CT + 84 / 94 FRO
1baa0 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  M tab0 AS cor0 C
1bab0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20  ROSS JOIN tab2, 
1bac0 74 61 62 30 20 41 53 20 63 6f 72 31 0d 0a 2d 2d  tab0 AS cor1..--
1bad0 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
1bae0 73 68 69 6e 67 20 74 6f 20 65 32 35 36 38 62 30  shing to e2568b0
1baf0 31 64 64 34 31 31 62 35 61 32 30 36 30 36 38 36  1dd411b5a2060686
1bb00 39 37 64 30 65 64 30 64 32 0d 0a 0d 0a 71 75 65  97d0ed0d2....que
1bb10 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
1bb20 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1bb30 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 41  CT * FROM tab1 A
1bb40 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49  S cor0 CROSS JOI
1bb50 4e 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20  N tab1, tab2 AS 
1bb60 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63 6f  cor1, tab2 AS co
1bb70 72 32 2c 20 74 61 62 32 20 41 53 20 63 6f 72 33  r2, tab2 AS cor3
1bb80 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c  ..----..3645 val
1bb90 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
1bba0 30 34 63 33 36 34 31 32 37 37 35 65 38 38 30 35  04c36412775e8805
1bbb0 64 36 62 33 62 65 66 61 32 66 35 32 39 31 37 0d  d6b3befa2f52917.
1bbc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1bbd0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36 34 20  rt..SELECT + 64 
1bbe0 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20  FROM tab2, tab1 
1bbf0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
1bc00 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1bc10 74 6f 20 36 30 61 62 30 34 30 65 39 33 31 63 35  to 60ab040e931c5
1bc20 63 38 35 64 62 37 62 61 31 39 33 36 34 65 61 63  c85db7ba19364eac
1bc30 63 38 65 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  c8e....skipif po
1bc40 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1bc50 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1bc60 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1bc70 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1bc80 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1bc90 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32  .SELECT ALL tab2
1bca0 2e 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 63 6f 6c  .col0 - col1 col
1bcb0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
1bcc0 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36 32 0d 0a  -..-24..19..62..
1bcd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1bce0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
1bcf0 62 30 2e 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 30  b0.col2 - - col0
1bd00 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
1bd10 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33  b0..----..171..3
1bd20 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  6..57....query I
1bd30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1bd40 20 41 4c 4c 20 38 37 20 2a 20 2b 20 63 6f 6c 30   ALL 87 * + col0
1bd50 20 2a 20 63 6f 6c 31 20 2d 20 31 39 20 46 52 4f   * col1 - 19 FRO
1bd60 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 35 35  M tab1..----..55
1bd70 36 36 31 0d 0a 36 37 36 37 0d 0a 39 30 34 36 31  661..6767..90461
1bd80 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1bd90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
1bda0 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63  l1 - + col1 AS c
1bdb0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol0 FROM tab1 co
1bdc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d  r0..----..-20..-
1bdd0 32 36 0d 0a 2d 35 32 0d 0a 0d 0a 71 75 65 72 79  26..-52....query
1bde0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1bdf0 43 54 20 41 4c 4c 20 2b 20 63 6f 72 31 2e 63 6f  CT ALL + cor1.co
1be00 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
1be10 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63 6f  tab0, tab0 AS co
1be20 72 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 31  r0, tab0 AS cor1
1be30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65  ..----..27 value
1be40 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66 63  s hashing to 9fc
1be50 31 64 63 64 37 36 66 65 61 66 34 33 65 35 63 35  1dcd76feaf43e5c5
1be60 64 63 30 36 30 61 30 32 30 31 34 63 64 0d 0a 0d  dc060a02014cd...
1be70 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
1be80 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
1be90 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
1bea0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
1beb0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
1bec0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1bed0 54 20 2b 20 39 36 20 63 6f 6c 30 20 46 52 4f 4d  T + 96 col0 FROM
1bee0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1bef0 2d 2d 2d 0d 0a 39 36 0d 0a 39 36 0d 0a 39 36 0d  ---..96..96..96.
1bf00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
1bf10 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
1bf20 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
1bf30 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
1bf40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1bf50 34 31 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20  41..SELECT col0 
1bf60 2a 20 2d 20 31 20 2a 20 2d 20 63 6f 6c 30 20 2d  * - 1 * - col0 -
1bf70 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f   - col1 DIV - co
1bf80 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1bf90 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1bfa0 2d 2d 0d 0a 34 35 0d 0a 36 30 38 34 0d 0a 36 32  --..45..6084..62
1bfb0 34 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  41....skipif mys
1bfc0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1bfd0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1bfe0 73 6f 72 74 20 6c 61 62 65 6c 2d 38 34 31 0d 0a  sort label-841..
1bff0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 2d 20  SELECT col0 * - 
1c000 31 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63  1 * - col0 - - c
1c010 6f 6c 31 20 2f 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 / - col0 AS 
1c020 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
1c030 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35  S cor0..----..45
1c040 0d 0a 36 30 38 34 0d 0a 36 32 34 31 0d 0a 0d 0a  ..6084..6241....
1c050 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
1c060 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
1c070 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20  CT * FROM tab1, 
1c080 74 61 62 31 20 63 6f 72 30 2c 20 74 61 62 30 20  tab1 cor0, tab0 
1c090 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20 41 53  AS cor1, tab1 AS
1c0a0 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32   cor2..----..972
1c0b0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1c0c0 74 6f 20 34 36 35 64 30 37 32 64 32 64 39 65 61  to 465d072d2d9ea
1c0d0 62 61 62 62 66 63 38 65 38 38 62 38 32 37 30 37  babbfc8e88b82707
1c0e0 34 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  474....query I r
1c0f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63  owsort..SELECT c
1c100 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol2 + col0 * col
1c110 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
1c120 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1c130 2d 0d 0a 33 36 0d 0a 37 33 38 30 0d 0a 38 32 35  -..36..7380..825
1c140 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
1c150 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
1c160 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
1c170 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
1c180 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
1c190 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1c1a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
1c1b0 6c 32 20 2b 20 2b 20 28 20 35 32 20 29 20 2a 20  l2 + + ( 52 ) * 
1c1c0 2d 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52 4f 4d  - col0 col1 FROM
1c1d0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
1c1e0 2d 2d 2d 0d 0a 2d 31 32 31 35 0d 0a 2d 31 38 31  ---..-1215..-181
1c1f0 39 0d 0a 2d 34 35 34 36 0d 0a 0d 0a 71 75 65 72  9..-4546....quer
1c200 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1c210 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
1c220 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46   col1 * - col1 F
1c230 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1c240 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d  ..----..-7396..-
1c250 38 32 38 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71  8281..-9409....q
1c260 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1c270 53 45 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f  SELECT + cor0.co
1c280 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l2 * - cor0.col2
1c290 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1c2a0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
1c2b0 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a  ..-2916..-3249..
1c2c0 2d 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -9216....query I
1c2d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1c2e0 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2b 20   ALL - + col1 + 
1c2f0 28 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31  ( col1 ) AS col1
1c300 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1c310 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
1c320 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
1c330 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1c340 20 63 6f 6c 31 20 2a 20 38 39 20 2b 20 63 6f 6c   col1 * 89 + col
1c350 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  1 * - col1 FROM 
1c360 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1c370 2d 2d 0d 0a 31 36 33 38 0d 0a 37 39 30 0d 0a 39  --..1638..790..9
1c380 38 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  88....onlyif mys
1c390 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
1c3a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
1c3b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
1c3c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1c3d0 6c 2d 38 34 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-849..SELECT + 
1c3e0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56 20  + cor0.col1 DIV 
1c3f0 28 20 2d 20 63 6f 6c 30 20 29 20 46 52 4f 4d 20  ( - col0 ) FROM 
1c400 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1c410 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 33 0d 0a  --..-1..-2..-3..
1c420 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1c430 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1c440 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c450 20 6c 61 62 65 6c 2d 38 34 39 0d 0a 53 45 4c 45   label-849..SELE
1c460 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  CT + + cor0.col1
1c470 20 2f 20 28 20 2d 20 63 6f 6c 30 20 29 20 46 52   / ( - col0 ) FR
1c480 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1c490 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d  .----..-1..-2..-
1c4a0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
1c4b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1c4c0 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 31 20  TINCT tab1.col1 
1c4d0 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * + col0 FROM ta
1c4e0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a  b1..----..1040..
1c4f0 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  640..78....query
1c500 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1c510 43 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31  CT col2 + + col1
1c520 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1c530 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d  ..109..67..80...
1c540 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c550 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1c560 54 20 2d 20 36 35 20 41 53 20 63 6f 6c 30 20 46  T - 65 AS col0 F
1c570 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1c580 2d 36 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -65....query I r
1c590 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1c5a0 20 32 33 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20   23 + col1 FROM 
1c5b0 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 33 0d 0a  tab0..----..63..
1c5c0 36 38 0d 0a 37 34 0d 0a 0d 0a 71 75 65 72 79 20  68..74....query 
1c5d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c5e0 54 20 2b 20 38 35 20 41 53 20 63 6f 6c 30 20 46  T + 85 AS col0 F
1c5f0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20  ROM tab1, tab2, 
1c600 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1c610 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61  --..27 values ha
1c620 73 68 69 6e 67 20 74 6f 20 65 34 63 66 39 34 63  shing to e4cf94c
1c630 66 30 63 63 36 33 32 61 63 66 66 33 30 61 64 31  f0cc632acff30ad1
1c640 64 61 63 36 31 37 63 62 37 0d 0a 0d 0a 71 75 65  dac617cb7....que
1c650 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 20  ry IIIIIIIIIIII 
1c660 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1c670 41 4c 4c 20 2a 20 46 52 4f 4d 20 74 61 62 31 20  ALL * FROM tab1 
1c680 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f  AS cor0 CROSS JO
1c690 49 4e 20 74 61 62 32 2c 20 74 61 62 30 20 41 53  IN tab2, tab0 AS
1c6a0 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63   cor1, tab2 AS c
1c6b0 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76  or2..----..972 v
1c6c0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1c6d0 20 34 32 65 36 39 65 63 64 61 66 62 33 63 38 31   42e69ecdafb3c81
1c6e0 30 34 36 62 63 35 63 62 34 63 39 38 62 31 36 36  046bc5cb4c98b166
1c6f0 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  6....query I row
1c700 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  sort..SELECT col
1c710 32 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  2 + col0 AS col2
1c720 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
1c730 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34 0d 0a  ..104..117..34..
1c740 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1c750 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1c760 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1c770 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1c780 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35  rowsort label-85
1c790 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  7..SELECT - col1
1c7a0 20 44 49 56 20 28 20 63 6f 6c 32 20 29 20 46 52   DIV ( col2 ) FR
1c7b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1c7c0 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d  .----..-1..-2..-
1c7d0 39 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  97....skipif mys
1c7e0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1c7f0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1c800 73 6f 72 74 20 6c 61 62 65 6c 2d 38 35 37 0d 0a  sort label-857..
1c810 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
1c820 28 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61  ( col2 ) FROM ta
1c830 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1c840 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d 0a 0d  ..-1..-2..-97...
1c850 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c860 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
1c870 6f 6c 31 20 2a 20 2d 20 28 20 2d 20 63 6f 6c 30  ol1 * - ( - col0
1c880 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
1c890 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1c8a0 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d  --..-1343..-217.
1c8b0 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20  .-4602....query 
1c8c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1c8d0 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 2b  T ALL + col2 + +
1c8e0 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20 63   ( - col1 ) AS c
1c8f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol0 FROM tab0 AS
1c900 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 33   cor0..----..-53
1c910 0d 0a 2d 39 0d 0a 2d 39 36 0d 0a 0d 0a 6f 6e 6c  ..-9..-96....onl
1c920 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
1c930 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
1c940 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
1c950 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
1c960 72 74 20 6c 61 62 65 6c 2d 38 36 30 0d 0a 53 45  rt label-860..SE
1c970 4c 45 43 54 20 63 6f 6c 32 20 44 49 56 20 28 20  LECT col2 DIV ( 
1c980 2b 20 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 31  + col0 ) AS col1
1c990 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
1c9a0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
1c9b0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1c9c0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1c9d0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1c9e0 20 6c 61 62 65 6c 2d 38 36 30 0d 0a 53 45 4c 45   label-860..SELE
1c9f0 43 54 20 63 6f 6c 32 20 2f 20 28 20 2b 20 63 6f  CT col2 / ( + co
1ca00 6c 30 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f  l0 ) AS col1 FRO
1ca10 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1ca20 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75  -..0..0..1....qu
1ca30 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ca40 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1ca50 20 35 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74   51 FROM tab1, t
1ca60 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1ca70 2d 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79 20 49  -..51....query I
1ca80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1ca90 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63   col0 * col0 + c
1caa0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
1cab0 2d 2d 2d 0d 0a 31 32 32 36 0d 0a 36 30 39 0d 0a  ---..1226..609..
1cac0 38 30 30 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8003....query I 
1cad0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cae0 44 49 53 54 49 4e 43 54 20 35 35 20 41 53 20 63  DISTINCT 55 AS c
1caf0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol1 FROM tab0, t
1cb00 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1cb10 2d 0d 0a 35 35 0d 0a 0d 0a 71 75 65 72 79 20 49  -..55....query I
1cb20 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1cb30 20 2d 20 38 31 20 2a 20 63 6f 6c 31 20 2b 20 2b   - 81 * col1 + +
1cb40 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41   ( cor0.col2 ) A
1cb50 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
1cb60 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1cb70 2d 36 39 33 33 0d 0a 2d 37 32 38 39 0d 0a 2d 37  -6933..-7289..-7
1cb80 38 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  856....query I r
1cb90 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39  owsort..SELECT 9
1cba0 38 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c  8 - col1 * - col
1cbb0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
1cbc0 2d 0d 0a 31 34 34 31 0d 0a 33 31 35 0d 0a 34 37  -..1441..315..47
1cbd0 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  00....query I ro
1cbe0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1cbf0 53 54 49 4e 43 54 20 2b 20 37 31 20 2b 20 63 6f  STINCT + 71 + co
1cc00 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
1cc10 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d  tab0..----..106.
1cc20 0a 31 36 30 0d 0a 39 35 0d 0a 0d 0a 6f 6e 6c 79  .160..95....only
1cc30 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
1cc40 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
1cc50 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
1cc60 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
1cc70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1cc80 61 62 65 6c 2d 38 36 37 0d 0a 53 45 4c 45 43 54  abel-867..SELECT
1cc90 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54   DISTINCT + CAST
1cca0 28 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44  ( col1 AS SIGNED
1ccb0 20 29 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d   ) + - col0 FROM
1ccc0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1ccd0 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32  ---..-54..-67..2
1cce0 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
1ccf0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1cd00 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1cd10 6f 72 74 20 6c 61 62 65 6c 2d 38 36 37 0d 0a 53  ort label-867..S
1cd20 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
1cd30 20 43 41 53 54 20 28 20 63 6f 6c 31 20 41 53 20   CAST ( col1 AS 
1cd40 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f  INTEGER ) + - co
1cd50 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1cd60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d  cor0..----..-54.
1cd70 0a 2d 36 37 0d 0a 32 33 0d 0a 0d 0a 6f 6e 6c 79  .-67..23....only
1cd80 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1cd90 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1cda0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1cdb0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1cdc0 74 20 6c 61 62 65 6c 2d 38 36 38 0d 0a 53 45 4c  t label-868..SEL
1cdd0 45 43 54 20 41 4c 4c 20 2d 20 36 35 20 2a 20 63  ECT ALL - 65 * c
1cde0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56  ol1 + - col0 DIV
1cdf0 20 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 46 52 4f   col1 - col0 FRO
1ce00 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
1ce10 2d 0d 0a 2d 35 36 31 34 0d 0a 2d 36 30 30 34 0d  -..-5614..-6004.
1ce20 0a 2d 36 33 34 30 0d 0a 0d 0a 73 6b 69 70 69 66  .-6340....skipif
1ce30 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1ce40 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1ce50 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1ce60 36 38 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  68..SELECT ALL -
1ce70 20 36 35 20 2a 20 63 6f 6c 31 20 2b 20 2d 20 63   65 * col1 + - c
1ce80 6f 6c 30 20 2f 20 63 6f 6c 31 20 2d 20 63 6f 6c  ol0 / col1 - col
1ce90 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
1cea0 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 31 34 0d 0a 2d  ..----..-5614..-
1ceb0 36 30 30 34 0d 0a 2d 36 33 34 30 0d 0a 0d 0a 71  6004..-6340....q
1cec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1ced0 53 45 4c 45 43 54 20 2d 20 28 20 35 39 20 29 20  SELECT - ( 59 ) 
1cee0 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  + - col2 FROM ta
1cef0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1cf00 0d 0a 2d 38 35 0d 0a 2d 38 36 0d 0a 2d 39 37 0d  ..-85..-86..-97.
1cf10 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1cf20 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
1cf30 20 2b 20 39 39 20 41 53 20 63 6f 6c 31 20 46 52   + 99 AS col1 FR
1cf40 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1cf50 0a 2d 2d 2d 2d 0d 0a 2d 39 39 0d 0a 2d 39 39 0d  .----..-99..-99.
1cf60 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-99....query I 
1cf70 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1cf80 2b 20 33 33 20 46 52 4f 4d 20 74 61 62 30 0d 0a  + 33 FROM tab0..
1cf90 2d 2d 2d 2d 0d 0a 33 33 0d 0a 33 33 0d 0a 33 33  ----..33..33..33
1cfa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1cfb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1cfc0 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20 63 6f  INCT - col2 * co
1cfd0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20  r0.col2 AS col0 
1cfe0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1cff0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 30  0..----..-1..-10
1d000 38 39 0d 0a 2d 36 37 32 34 0d 0a 0d 0a 71 75 65  89..-6724....que
1d010 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d020 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c  LECT ALL - - col
1d030 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  2 + - col1 AS co
1d040 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1d050 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d  cor0..----..-33.
1d060 0a 2d 34 0d 0a 32 31 0d 0a 0d 0a 71 75 65 72 79  .-4..21....query
1d070 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d080 43 54 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52  CT ( - col2 ) FR
1d090 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
1d0a0 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d 0a  26..-27..-38....
1d0b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d0c0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1d0d0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b   + col2 * col1 +
1d0e0 20 2b 20 37 36 20 41 53 20 63 6f 6c 30 20 46 52   + 76 AS col0 FR
1d0f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d100 0a 2d 2d 2d 2d 0d 0a 31 33 32 34 0d 0a 31 34 38  .----..1324..148
1d110 30 0d 0a 36 34 36 0d 0a 0d 0a 71 75 65 72 79 20  0..646....query 
1d120 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d130 54 20 35 34 20 2a 20 63 6f 6c 31 20 2b 20 34 32  T 54 * col1 + 42
1d140 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1d150 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 36 38 36 0d 0a  r0..----..4686..
1d160 34 39 35 36 0d 0a 35 32 38 30 0d 0a 0d 0a 71 75  4956..5280....qu
1d170 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d180 45 4c 45 43 54 20 39 39 20 41 53 20 63 6f 6c 31  ELECT 99 AS col1
1d190 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
1d1a0 0a 2d 2d 2d 2d 0d 0a 39 39 0d 0a 39 39 0d 0a 39  .----..99..99..9
1d1b0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
1d1c0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
1d1d0 54 49 4e 43 54 20 28 20 63 6f 6c 30 20 29 20 2b  TINCT ( col0 ) +
1d1e0 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20 63   cor0.col2 * + c
1d1f0 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1d200 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1d210 2d 2d 2d 0d 0a 31 36 31 32 0d 0a 37 32 35 0d 0a  ---..1612..725..
1d220 38 34 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  844....skipif po
1d230 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
1d240 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
1d250 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
1d260 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
1d270 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d280 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1d290 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f   - - col1 * + co
1d2a0 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 63 6f 6c 30  l0 + - col2 col0
1d2b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1d2c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a 35 38  r0..----..24..58
1d2d0 33 0d 0a 39 34 34 0d 0a 0d 0a 71 75 65 72 79 20  3..944....query 
1d2e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1d2f0 54 20 41 4c 4c 20 2b 20 2b 20 38 39 20 41 53 20  T ALL + + 89 AS 
1d300 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 41  col0 FROM tab0 A
1d310 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 38 39  S cor0..----..89
1d320 0d 0a 38 39 0d 0a 38 39 0d 0a 0d 0a 71 75 65 72  ..89..89....quer
1d330 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d340 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a  ECT ALL + col2 *
1d350 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   - col0 AS col1 
1d360 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1d370 0a 2d 31 38 39 0d 0a 2d 32 30 32 38 0d 0a 2d 33  .-189..-2028..-3
1d380 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
1d390 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1d3a0 4c 4c 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 30  LL - col1 * col0
1d3b0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1d3c0 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  b1..----..-1040.
1d3d0 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  .-640..-78....qu
1d3e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1d3f0 45 4c 45 43 54 20 35 37 20 2a 20 2d 20 63 6f 6c  ELECT 57 * - col
1d400 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  0 AS col2 FROM t
1d410 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36 38  ab0..----..-1368
1d420 0d 0a 2d 31 39 39 35 0d 0a 2d 35 30 37 33 0d 0a  ..-1995..-5073..
1d430 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d440 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
1d450 43 54 20 2b 20 2d 20 28 20 2d 20 63 6f 72 30 2e  CT + - ( - cor0.
1d460 63 6f 6c 32 20 29 20 2d 20 63 6f 6c 32 20 46 52  col2 ) - col2 FR
1d470 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1d480 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72  .----..0....quer
1d490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1d4a0 45 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2d 20 63  ECT + col1 * - c
1d4b0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 41 53 20  ol1 + - col0 AS 
1d4c0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
1d4d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
1d4e0 36 34 0d 0a 2d 32 34 39 0d 0a 2d 36 37 39 0d 0a  64..-249..-679..
1d4f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1d500 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
1d510 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
1d520 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
1d530 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 38  rowsort label-88
1d540 36 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  6..SELECT ALL + 
1d550 33 37 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f  37 DIV - cor0.co
1d560 6c 30 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l0 + + col0 FROM
1d570 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
1d580 2d 2d 2d 0d 0a 32 0d 0a 37 38 0d 0a 37 39 0d 0a  ---..2..78..79..
1d590 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1d5a0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1d5b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1d5c0 20 6c 61 62 65 6c 2d 38 38 36 0d 0a 53 45 4c 45   label-886..SELE
1d5d0 43 54 20 41 4c 4c 20 2b 20 33 37 20 2f 20 2d 20  CT ALL + 37 / - 
1d5e0 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f  cor0.col0 + + co
1d5f0 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l0 FROM tab2 AS 
1d600 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 37  cor0..----..2..7
1d610 38 0d 0a 37 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  8..79....onlyif 
1d620 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1d630 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1d640 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1d650 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1d660 61 62 65 6c 2d 38 38 37 0d 0a 53 45 4c 45 43 54  abel-887..SELECT
1d670 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30   - col1 + - col0
1d680 20 44 49 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c   DIV col2 AS col
1d690 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
1d6a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a  or0..----..-11..
1d6b0 2d 31 33 0d 0a 2d 32 36 0d 0a 0d 0a 73 6b 69 70  -13..-26....skip
1d6c0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1d6d0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1d6e0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1d6f0 2d 38 38 37 0d 0a 53 45 4c 45 43 54 20 2d 20 63  -887..SELECT - c
1d700 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 63  ol1 + - col0 / c
1d710 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol2 AS col0 FROM
1d720 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1d730 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 33 0d 0a 2d  ---..-11..-13..-
1d740 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  26....query I ro
1d750 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
1d760 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e  - col2 * + cor0.
1d770 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 46 52  col0 + - col2 FR
1d780 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1d790 0a 2d 2d 2d 2d 0d 0a 2d 32 31 36 0d 0a 2d 33 37  .----..-216..-37
1d7a0 30 35 0d 0a 2d 37 37 37 36 0d 0a 0d 0a 71 75 65  05..-7776....que
1d7b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d7c0 4c 45 43 54 20 32 31 20 46 52 4f 4d 20 74 61 62  LECT 21 FROM tab
1d7d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1d7e0 0a 32 31 0d 0a 32 31 0d 0a 32 31 0d 0a 0d 0a 71  .21..21..21....q
1d7f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1d800 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
1d810 2d 20 2b 20 37 37 20 2a 20 2b 20 63 6f 6c 31 20  - + 77 * + col1 
1d820 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1d830 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 36 32 32 0d 0a  0..----..-6622..
1d840 2d 37 30 30 37 0d 0a 2d 37 34 36 39 0d 0a 0d 0a  -7007..-7469....
1d850 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1d860 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
1d870 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63  .col2 + + cor0.c
1d880 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
1d890 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31   cor0..----..121
1d8a0 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65  ..176..57....que
1d8b0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1d8c0 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  LECT col0 + - co
1d8d0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l1 FROM tab2 AS 
1d8e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d  cor0..----..-24.
1d8f0 0a 31 39 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79  .19..62....query
1d900 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1d910 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
1d920 6c 32 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31  l2 - col0 * col1
1d930 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
1d940 0a 2d 2d 2d 2d 0d 0a 2d 31 31 33 36 0d 0a 2d 31  .----..-1136..-1
1d950 33 32 0d 0a 2d 36 39 37 0d 0a 0d 0a 6f 6e 6c 79  32..-697....only
1d960 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
1d970 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
1d980 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
1d990 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1d9a0 74 20 6c 61 62 65 6c 2d 38 39 34 0d 0a 53 45 4c  t label-894..SEL
1d9b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37  ECT DISTINCT - 7
1d9c0 30 20 44 49 56 20 63 6f 6c 30 20 41 53 20 63 6f  0 DIV col0 AS co
1d9d0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
1d9e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a  cor0..----..-1..
1d9f0 2d 32 33 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  -23..0....skipif
1da00 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
1da10 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
1da20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38   rowsort label-8
1da30 39 34 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  94..SELECT DISTI
1da40 4e 43 54 20 2d 20 37 30 20 2f 20 63 6f 6c 30 20  NCT - 70 / col0 
1da50 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
1da60 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1da70 0a 2d 31 0d 0a 2d 32 33 0d 0a 30 0d 0a 0d 0a 71  .-1..-23..0....q
1da80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1da90 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20 2b 20  SELECT col2 + + 
1daa0 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
1dab0 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab2 cor0..---
1dac0 2d 0d 0a 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d  -..55..58..85...
1dad0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
1dae0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
1daf0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
1db00 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
1db10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39 36  owsort label-896
1db20 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1db30 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c  T - col0 * + col
1db40 31 20 2b 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d  1 + - col0 DIV -
1db50 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 44   col1 + + col1 D
1db60 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74  IV - col1 FROM t
1db70 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
1db80 2d 0d 0a 2d 31 33 34 30 0d 0a 2d 32 31 38 0d 0a  -..-1340..-218..
1db90 2d 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  -4602....skipif 
1dba0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
1dbb0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
1dbc0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 38 39  rowsort label-89
1dbd0 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
1dbe0 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT - col0 * + co
1dbf0 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 2d 20  l1 + - col0 / - 
1dc00 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20 2f 20  col1 + + col1 / 
1dc10 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
1dc20 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1dc30 2d 31 33 34 30 0d 0a 2d 32 31 38 0d 0a 2d 34 36  -1340..-218..-46
1dc40 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
1dc50 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
1dc60 53 54 49 4e 43 54 20 2b 20 2d 20 28 20 2b 20 63  STINCT + - ( + c
1dc70 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
1dc80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1dc90 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d  .----..-86..-91.
1dca0 0a 2d 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-97....query I 
1dcb0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1dcc0 2d 20 35 36 20 41 53 20 63 6f 6c 32 20 46 52 4f  - 56 AS col2 FRO
1dcd0 4d 20 74 61 62 30 2c 20 74 61 62 31 20 63 6f 72  M tab0, tab1 cor
1dce0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
1dcf0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 33 64 33  s hashing to 3d3
1dd00 64 61 62 34 30 30 65 65 66 39 33 63 30 39 38 61  dab400eef93c098a
1dd10 63 62 62 62 61 33 66 63 39 62 64 63 36 0d 0a 0d  cbbba3fc9bdc6...
1dd20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dd30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
1dd40 6f 6c 30 20 2a 20 32 32 20 46 52 4f 4d 20 74 61  ol0 * 22 FROM ta
1dd50 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
1dd60 39 35 38 0d 0a 35 32 38 0d 0a 37 37 30 0d 0a 0d  958..528..770...
1dd70 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1dd80 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72  ..SELECT ALL cor
1dd90 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  0.col0 AS col2 F
1dda0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41  ROM tab1, tab0 A
1ddb0 53 20 63 6f 72 30 2c 20 74 61 62 32 20 63 6f 72  S cor0, tab2 cor
1ddc0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
1ddd0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39 66  es hashing to 9f
1dde0 63 31 64 63 64 37 36 66 65 61 66 34 33 65 35 63  c1dcd76feaf43e5c
1ddf0 35 64 63 30 36 30 61 30 32 30 31 34 63 64 0d 0a  5dc060a02014cd..
1de00 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
1de10 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
1de20 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
1de30 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
1de40 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
1de50 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 31 0d 0a  sort label-901..
1de60 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20 38  SELECT - CAST( 8
1de70 36 20 41 53 20 53 49 47 4e 45 44 20 29 20 46 52  6 AS SIGNED ) FR
1de80 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1de90 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a 2d 38 36 0d  .----..-86..-86.
1dea0 0a 2d 38 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-86....skipif m
1deb0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
1dec0 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
1ded0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 31  owsort label-901
1dee0 0d 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 20  ..SELECT - CAST 
1def0 28 20 38 36 20 41 53 20 49 4e 54 45 47 45 52 20  ( 86 AS INTEGER 
1df00 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  ) FROM tab0 AS c
1df10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 38 36 0d 0a  or0..----..-86..
1df20 2d 38 36 0d 0a 2d 38 36 0d 0a 0d 0a 71 75 65 72  -86..-86....quer
1df30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1df40 45 43 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c  ECT ALL cor0.col
1df50 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  1 * cor0.col0 AS
1df60 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
1df70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1df80 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d 0a  040..640..78....
1df90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
1dfa0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
1dfb0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
1dfc0 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
1dfd0 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
1dfe0 72 74 20 6c 61 62 65 6c 2d 39 30 33 0d 0a 53 45  rt label-903..SE
1dff0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
1e000 43 41 53 54 28 20 2d 20 63 6f 6c 31 20 41 53 20  CAST( - col1 AS 
1e010 53 49 47 4e 45 44 20 29 20 2a 20 2d 20 63 6f 6c  SIGNED ) * - col
1e020 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
1e030 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34 0d  or0..----..1534.
1e040 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 73 6b 69  .646..837....ski
1e050 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
1e060 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
1e070 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
1e080 6c 2d 39 30 33 0d 0a 53 45 4c 45 43 54 20 44 49  l-903..SELECT DI
1e090 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20 28 20  STINCT + CAST ( 
1e0a0 2d 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  - col1 AS INTEGE
1e0b0 52 20 29 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f  R ) * - col2 FRO
1e0c0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
1e0d0 2d 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d  ----..1534..646.
1e0e0 0a 38 33 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .837....onlyif m
1e0f0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1e100 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1e110 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1e120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1e130 62 65 6c 2d 39 30 34 0d 0a 53 45 4c 45 43 54 20  bel-904..SELECT 
1e140 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44 49  - col0 + col1 DI
1e150 56 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 31 20  V col0 - - col1 
1e160 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
1e170 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36 37 0d 0a  ----..-54..-67..
1e180 33 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  31....skipif mys
1e190 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1e1a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1e1b0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 30 34 0d 0a  sort label-904..
1e1c0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20  SELECT - col0 + 
1e1d0 63 6f 6c 31 20 2f 20 63 6f 6c 30 20 2d 20 2d 20  col1 / col0 - - 
1e1e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63  col1 FROM tab1 c
1e1f0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a  or0..----..-54..
1e200 2d 36 37 0d 0a 33 31 0d 0a 0d 0a 71 75 65 72 79  -67..31....query
1e210 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e220 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
1e230 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29 20 2b 20  l0 * ( col1 ) + 
1e240 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  col1 + col1 * + 
1e250 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
1e260 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
1e270 39 30 31 0d 0a 31 36 34 37 31 0d 0a 39 35 34 36  901..16471..9546
1e280 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1e290 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 32 20 46  ort..SELECT 92 F
1e2a0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1e2b0 39 32 0d 0a 39 32 0d 0a 39 32 0d 0a 0d 0a 71 75  92..92..92....qu
1e2c0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1e2d0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
1e2e0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 74  ol0 * + col2 * t
1e2f0 61 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  ab1.col0 AS col1
1e300 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1e310 0d 0a 32 33 33 34 37 32 0d 0a 34 38 36 0d 0a 36  ..233472..486..6
1e320 31 34 34 30 30 0d 0a 0d 0a 71 75 65 72 79 20 49  14400....query I
1e330 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1e340 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20 2d 20   DISTINCT + ( - 
1e350 74 61 62 32 2e 63 6f 6c 31 20 29 20 2a 20 63 6f  tab2.col1 ) * co
1e360 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
1e370 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34  tab2..----..-134
1e380 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a  3..-217..-4602..
1e390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1e3a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
1e3b0 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 2d   - col0 + col0 -
1e3c0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52   col1 AS col1 FR
1e3d0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
1e3e0 0a 2d 2d 2d 2d 0d 0a 2d 37 33 30 30 0d 0a 2d 38  .----..-7300..-8
1e3f0 35 34 0d 0a 2d 39 37 0d 0a 0d 0a 6f 6e 6c 79 69  54..-97....onlyi
1e400 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
1e410 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
1e420 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
1e430 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e440 20 6c 61 62 65 6c 2d 39 31 30 0d 0a 53 45 4c 45   label-910..SELE
1e450 43 54 20 2b 20 35 33 20 44 49 56 20 63 6f 72 30  CT + 53 DIV cor0
1e460 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20  .col1 FROM tab1 
1e470 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 34  cor0..----..2..4
1e480 0d 0a 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..5....skipif my
1e490 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
1e4a0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
1e4b0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 31 30 0d  wsort label-910.
1e4c0 0a 53 45 4c 45 43 54 20 2b 20 35 33 20 2f 20 63  .SELECT + 53 / c
1e4d0 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61  or0.col1 FROM ta
1e4e0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  b1 cor0..----..2
1e4f0 0d 0a 34 0d 0a 35 0d 0a 0d 0a 71 75 65 72 79 20  ..4..5....query 
1e500 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1e510 54 20 41 4c 4c 20 2d 20 39 30 20 2b 20 2b 20 74  T ALL - 90 + + t
1e520 61 62 31 2e 63 6f 6c 31 20 2b 20 63 6f 6c 32 20  ab1.col1 + col2 
1e530 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
1e540 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 0d 0a 2d 32  1..----..-10..-2
1e550 33 0d 0a 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  3..19....onlyif 
1e560 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1e570 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1e580 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1e590 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1e5a0 61 62 65 6c 2d 39 31 32 0d 0a 53 45 4c 45 43 54  abel-912..SELECT
1e5b0 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20 63 6f   - col1 DIV - co
1e5c0 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 + + col0 FROM
1e5d0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1e5e0 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
1e5f0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
1e600 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
1e610 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1e620 20 6c 61 62 65 6c 2d 39 31 32 0d 0a 53 45 4c 45   label-912..SELE
1e630 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2d 20 63 6f  CT - col1 / - co
1e640 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l2 + + col0 FROM
1e650 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1e660 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
1e670 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1e680 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1e690 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1e6a0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1e6b0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1e6c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1e6d0 43 54 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 2b  CT cor0.col0 * +
1e6e0 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20   col1 col0 FROM 
1e6f0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
1e700 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39 35 0d 0a  --..2064..3395..
1e710 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8099....query I 
1e720 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1e730 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 30  col0 * cor0.col0
1e740 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
1e750 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
1e760 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 33 34 0d  r0..----..10634.
1e770 0a 31 36 32 30 32 0d 0a 37 39 37 32 0d 0a 0d 0a  .16202..7972....
1e780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1e790 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
1e7a0 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b   col2 * - col2 +
1e7b0 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20   - col2 AS col1 
1e7c0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
1e7d0 0a 2d 31 34 38 32 0d 0a 2d 37 30 32 0d 0a 2d 37  .-1482..-702..-7
1e7e0 35 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  56....query I ro
1e7f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
1e800 6c 31 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f  l1 + col0 + + co
1e810 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
1e820 2d 2d 0d 0a 31 33 33 0d 0a 31 34 33 0d 0a 32 36  --..133..143..26
1e830 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
1e840 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
1e850 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
1e860 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
1e870 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1e880 2d 39 31 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63  -917..SELECT + c
1e890 6f 6c 32 20 2a 20 63 6f 6c 30 20 44 49 56 20 63  ol2 * col0 DIV c
1e8a0 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20  or0.col2 + col1 
1e8b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
1e8c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39  S cor0..----..29
1e8d0 0d 0a 37 34 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70  ..74..93....skip
1e8e0 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1e8f0 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1e900 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1e910 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1e920 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  mns..skipif mysq
1e930 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
1e940 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
1e950 6f 72 74 20 6c 61 62 65 6c 2d 39 31 37 0d 0a 53  ort label-917..S
1e960 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  ELECT + col2 * c
1e970 6f 6c 30 20 2f 20 63 6f 72 30 2e 63 6f 6c 32 20  ol0 / cor0.col2 
1e980 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  + col1 col0 FROM
1e990 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
1e9a0 2d 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d  ---..29..74..93.
1e9b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1e9c0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
1e9d0 6f 6c 32 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 * + cor0.col
1e9e0 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 + + col0 AS co
1e9f0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
1ea00 30 0d 0a 2d 2d 2d 2d 0d 0a 37 30 0d 0a 37 33 38  0..----..70..738
1ea10 37 0d 0a 38 31 36 0d 0a 0d 0a 71 75 65 72 79 20  7..816....query 
1ea20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ea30 54 20 2d 20 35 37 20 41 53 20 63 6f 6c 31 20 46  T - 57 AS col1 F
1ea40 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1ea50 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32   CROSS JOIN tab2
1ea60 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
1ea70 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
1ea80 20 35 32 30 64 63 33 39 33 38 39 36 39 36 39 65   520dc393896969e
1ea90 30 32 61 37 32 61 62 36 63 35 64 39 32 31 32 36  02a72ab6c5d92126
1eaa0 62 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  b....query I row
1eab0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 36  sort..SELECT + 6
1eac0 37 20 2b 20 2b 20 36 39 20 46 52 4f 4d 20 74 61  7 + + 69 FROM ta
1ead0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
1eae0 0d 0a 31 33 36 0d 0a 31 33 36 0d 0a 31 33 36 0d  ..136..136..136.
1eaf0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
1eb00 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
1eb10 4e 43 54 20 2d 20 39 33 20 41 53 20 63 6f 6c 31  NCT - 93 AS col1
1eb20 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
1eb30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 33 0d 0a 0d  r0..----..-93...
1eb40 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1eb50 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
1eb60 31 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20  1 + col0 * col2 
1eb70 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
1eb80 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 37 33 38 39 0d  ----..132..7389.
1eb90 0a 38 37 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .878....query I 
1eba0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1ebb0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
1ebc0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 2b 20  col1 * + col1 + 
1ebd0 2d 20 63 6f 6c 31 20 2a 20 2d 20 37 30 20 41 53  - col1 * - 70 AS
1ebe0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
1ebf0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
1ec00 34 37 39 0d 0a 33 31 33 31 0d 0a 37 36 31 31 0d  479..3131..7611.
1ec10 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
1ec20 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
1ec30 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1ec40 54 20 2a 20 46 52 4f 4d 20 74 61 62 30 20 41 53  T * FROM tab0 AS
1ec50 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
1ec60 20 74 61 62 31 2c 20 74 61 62 32 20 41 53 20 63   tab1, tab2 AS c
1ec70 6f 72 31 2c 20 74 61 62 30 2c 20 74 61 62 32 20  or1, tab0, tab2 
1ec80 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
1ec90 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
1eca0 6e 67 20 74 6f 20 37 37 38 31 65 31 31 64 34 61  ng to 7781e11d4a
1ecb0 39 66 63 38 34 34 62 37 62 39 33 64 33 32 30 37  9fc844b7b93d3207
1ecc0 34 38 66 37 63 31 0d 0a 0d 0a 71 75 65 72 79 20  48f7c1....query 
1ecd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1ece0 54 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d  T cor0.col1 FROM
1ecf0 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52   tab0 AS cor0 CR
1ed00 4f 53 53 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74  OSS JOIN tab1, t
1ed10 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab2 AS cor1..---
1ed20 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73  -..27 values has
1ed30 68 69 6e 67 20 74 6f 20 32 64 36 64 33 30 33 31  hing to 2d6d3031
1ed40 64 66 65 39 30 65 30 63 30 32 64 62 31 33 61 61  dfe90e0c02db13aa
1ed50 36 33 39 39 33 62 66 64 0d 0a 0d 0a 71 75 65 72  63993bfd....quer
1ed60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1ed70 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2b  ECT DISTINCT + +
1ed80 20 34 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   40 AS col1 FROM
1ed90 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
1eda0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
1edb0 0a 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .40....query I r
1edc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
1edd0 20 37 34 20 2a 20 37 36 20 46 52 4f 4d 20 74 61   74 * 76 FROM ta
1ede0 62 31 2c 20 74 61 62 32 2c 20 74 61 62 31 20 41  b1, tab2, tab1 A
1edf0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor0..----..27
1ee00 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
1ee10 74 6f 20 66 38 38 62 31 65 61 66 36 39 32 37 62  to f88b1eaf6927b
1ee20 38 31 31 61 62 34 30 61 62 34 37 66 32 38 65 30  811ab40ab47f28e0
1ee30 64 39 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  d99....query I r
1ee40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
1ee50 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 2b  ISTINCT col0 + +
1ee60 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20   tab1.col2 FROM 
1ee70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d  tab1..----..121.
1ee80 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72  .176..57....quer
1ee90 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1eea0 45 43 54 20 31 34 20 2b 20 28 20 63 6f 6c 30 20  ECT 14 + ( col0 
1eeb0 29 20 2a 20 2b 20 39 36 20 46 52 4f 4d 20 74 61  ) * + 96 FROM ta
1eec0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 31 38 0d 0a  b0..----..2318..
1eed0 33 33 37 34 0d 0a 38 35 35 38 0d 0a 0d 0a 71 75  3374..8558....qu
1eee0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1eef0 45 4c 45 43 54 20 41 4c 4c 20 35 39 20 2b 20 2b  ELECT ALL 59 + +
1ef00 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 63   col0 * col0 + c
1ef10 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
1ef20 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 39   tab2..----..139
1ef30 0d 0a 36 32 30 32 0d 0a 36 33 31 37 0d 0a 0d 0a  ..6202..6317....
1ef40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ef50 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b  .SELECT + col2 +
1ef60 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31   + col1 * + col1
1ef70 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
1ef80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1ef90 0d 0a 33 32 37 0d 0a 33 35 30 37 0d 0a 39 38 38  ..327..3507..988
1efa0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1efb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
1efc0 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2b 20 63 6f  INCT col1 + + co
1efd0 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
1efe0 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32 0d 0a  --..20..26..52..
1eff0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
1f000 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
1f010 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
1f020 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
1f030 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
1f040 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1f050 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
1f060 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l2 col1 FROM tab
1f070 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33  0..----..-1..-33
1f080 0d 0a 2d 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  ..-82....onlyif 
1f090 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
1f0a0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
1f0b0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
1f0c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
1f0d0 61 62 65 6c 2d 39 33 34 0d 0a 53 45 4c 45 43 54  abel-934..SELECT
1f0e0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30   DISTINCT + cor0
1f0f0 2e 63 6f 6c 30 20 44 49 56 20 35 31 20 41 53 20  .col0 DIV 51 AS 
1f100 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20  col1 FROM tab2, 
1f110 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1f120 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70  --..0..1....skip
1f130 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
1f140 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
1f150 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
1f160 2d 39 33 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  -934..SELECT DIS
1f170 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c  TINCT + cor0.col
1f180 30 20 2f 20 35 31 20 41 53 20 63 6f 6c 31 20 46  0 / 51 AS col1 F
1f190 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
1f1a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
1f1b0 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49  .1....query IIII
1f1c0 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
1f1d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1f1e0 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  T * FROM tab1, t
1f1f0 61 62 30 2c 20 74 61 62 31 20 63 6f 72 30 2c 20  ab0, tab1 cor0, 
1f200 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20  tab2..----..972 
1f210 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
1f220 6f 20 66 30 62 39 36 36 35 61 66 61 30 62 38 33  o f0b9665afa0b83
1f230 35 65 34 65 35 30 39 37 61 66 31 37 63 35 31 37  5e4e5097af17c517
1f240 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  66....query I ro
1f250 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
1f260 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 31 20 46 52  col1 - + col1 FR
1f270 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
1f280 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 32 36 0d  .----..-20..-26.
1f290 0a 2d 35 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-52....onlyif m
1f2a0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1f2b0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1f2c0 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1f2d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1f2e0 62 65 6c 2d 39 33 37 0d 0a 53 45 4c 45 43 54 20  bel-937..SELECT 
1f2f0 2d 20 63 6f 6c 31 20 44 49 56 20 28 20 63 6f 6c  - col1 DIV ( col
1f300 31 20 29 20 2b 20 63 6f 6c 31 20 2a 20 43 41 53  1 ) + col1 * CAS
1f310 54 28 20 63 6f 6c 30 20 41 53 20 53 49 47 4e 45  T( col0 AS SIGNE
1f320 44 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c  D ) * - cor0.col
1f330 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
1f340 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 36 30  or0..----..-1060
1f350 39 38 0d 0a 2d 31 35 32 30 0d 0a 2d 33 35 38 39  98..-1520..-3589
1f360 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  57....skipif mys
1f370 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
1f380 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
1f390 73 6f 72 74 20 6c 61 62 65 6c 2d 39 33 37 0d 0a  sort label-937..
1f3a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20  SELECT - col1 / 
1f3b0 28 20 63 6f 6c 31 20 29 20 2b 20 63 6f 6c 31 20  ( col1 ) + col1 
1f3c0 2a 20 43 41 53 54 20 28 20 63 6f 6c 30 20 41 53  * CAST ( col0 AS
1f3d0 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2d 20 63   INTEGER ) * - c
1f3e0 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d 20 74 61  or0.col0 FROM ta
1f3f0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
1f400 0d 0a 2d 31 30 36 30 39 38 0d 0a 2d 31 35 32 30  ..-106098..-1520
1f410 0d 0a 2d 33 35 38 39 35 37 0d 0a 0d 0a 71 75 65  ..-358957....que
1f420 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
1f430 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 36 36  LECT - col1 + 66
1f440 20 2a 20 63 6f 6c 32 20 2d 20 74 61 62 32 2e 63   * col2 - tab2.c
1f450 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
1f460 2d 2d 2d 0d 0a 31 35 39 38 0d 0a 31 37 32 30 0d  ---..1598..1720.
1f470 0a 32 34 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .2474....query I
1f480 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1f490 20 2b 20 2b 20 63 6f 6c 31 20 2d 20 63 6f 6c 32   + + col1 - col2
1f4a0 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   * - col2 * col1
1f4b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
1f4c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 38 32 31  r0..----..119821
1f4d0 0d 0a 33 32 35 30 30 0d 0a 37 35 38 34 32 0d 0a  ..32500..75842..
1f4e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f4f0 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
1f500 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  r0.col1 AS col0 
1f510 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
1f520 30 0d 0a 2d 2d 2d 2d 0d 0a 38 36 0d 0a 39 31 0d  0..----..86..91.
1f530 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .97....query I r
1f540 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1f550 4c 4c 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20  LL - + col1 * + 
1f560 30 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63  0 + - col2 * + c
1f570 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 * col0 FROM 
1f580 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f590 2d 2d 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 31  --..-119652..-51
1f5a0 30 33 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75  034..-5859....qu
1f5b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1f5c0 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2a 20 2d  ELECT - col2 * -
1f5d0 20 34 32 20 2a 20 2b 20 36 31 20 2b 20 2d 20 63   42 * + 61 + - c
1f5e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
1f5f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 30   cor0..----..210
1f600 30 30 32 0d 0a 32 35 36 31 0d 0a 38 34 35 31 33  002..2561..84513
1f610 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
1f620 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
1f630 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52  - + cor0.col1 FR
1f640 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
1f650 0a 2d 2d 2d 2d 0d 0a 2d 31 37 0d 0a 2d 33 31 0d  .----..-17..-31.
1f660 0a 2d 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-59....query I 
1f670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
1f680 41 4c 4c 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ALL + - cor0.col
1f690 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20 46  0 + ( - col0 ) F
1f6a0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
1f6b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 38 0d 0a 2d 34  ..----..-178..-4
1f6c0 38 0d 0a 2d 37 30 0d 0a 0d 0a 71 75 65 72 79 20  8..-70....query 
1f6d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1f6e0 54 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  T + col2 + + col
1f6f0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
1f700 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
1f710 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a  -..171..36..57..
1f720 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f730 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31  t..SELECT + col1
1f740 20 2d 20 2d 20 32 34 20 2a 20 63 6f 6c 30 20 41   - - 24 * col0 A
1f750 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32  S col0 FROM tab2
1f760 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 31   cor0..----..191
1f770 33 0d 0a 31 39 33 31 0d 0a 31 39 39 0d 0a 0d 0a  3..1931..199....
1f780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1f790 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b  .SELECT - col2 +
1f7a0 20 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20   cor0.col1 FROM 
1f7b0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
1f7c0 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a  --..-21..33..4..
1f7d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
1f7e0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61  t..SELECT ALL ta
1f7f0 62 31 2e 63 6f 6c 32 20 2b 20 2b 20 33 32 20 46  b1.col2 + + 32 F
1f800 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
1f810 31 32 38 0d 0a 38 36 0d 0a 38 39 0d 0a 0d 0a 71  128..86..89....q
1f820 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1f830 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
1f840 30 20 2a 20 38 34 20 2a 20 2b 20 28 20 2d 20 63  0 * 84 * + ( - c
1f850 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20 29 20 2b  ol0 * - col1 ) +
1f860 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
1f870 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 35 36 35 0d 0a  .----..-127565..
1f880 2d 33 30 31 35 32 32 34 35 0d 0a 2d 38 39 31 32  -30152245..-8912
1f890 31 33 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  131....query I r
1f8a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
1f8b0 4c 4c 20 63 6f 6c 32 20 2a 20 35 34 20 2b 20 2d  LL col2 * 54 + -
1f8c0 20 63 6f 6c 30 20 2b 20 2d 20 74 61 62 30 2e 63   col0 + - tab0.c
1f8d0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
1f8e0 2d 2d 2d 0d 0a 2d 37 38 0d 0a 31 36 37 32 0d 0a  ---..-78..1672..
1f8f0 34 32 34 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  4248....onlyif m
1f900 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
1f910 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
1f920 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
1f930 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
1f940 62 65 6c 2d 39 35 31 0d 0a 53 45 4c 45 43 54 20  bel-951..SELECT 
1f950 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2b 20 28 20  - tab1.col1 + ( 
1f960 63 6f 6c 32 20 29 20 44 49 56 20 63 6f 6c 32 20  col2 ) DIV col2 
1f970 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  + - col1 FROM ta
1f980 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d  b1..----..-19..-
1f990 32 35 0d 0a 2d 35 31 0d 0a 0d 0a 73 6b 69 70 69  25..-51....skipi
1f9a0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
1f9b0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
1f9c0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
1f9d0 39 35 31 0d 0a 53 45 4c 45 43 54 20 2d 20 74 61  951..SELECT - ta
1f9e0 62 31 2e 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 32  b1.col1 + ( col2
1f9f0 20 29 20 2f 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   ) / col2 + - co
1fa00 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
1fa10 2d 2d 0d 0a 2d 31 39 0d 0a 2d 32 35 0d 0a 2d 35  --..-19..-25..-5
1fa20 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
1fa30 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
1fa40 20 2b 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c 32   + col2 - - col2
1fa50 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
1fa60 0d 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39 32 0d  ..108..114..192.
1fa70 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
1fa80 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
1fa90 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
1faa0 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
1fab0 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
1fac0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
1fad0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
1fae0 6f 6c 31 20 2d 20 63 6f 6c 32 20 63 6f 6c 32 20  ol1 - col2 col2 
1faf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
1fb00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34  0..----..-28..-4
1fb10 37 0d 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20  7..-83....query 
1fb20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
1fb30 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
1fb40 63 6f 6c 32 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col2 * cor0.col2
1fb50 20 2d 20 39 37 20 46 52 4f 4d 20 74 61 62 31 20   - 97 FROM tab1 
1fb60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 31 39  cor0..----..2819
1fb70 0d 0a 33 31 35 32 0d 0a 39 31 31 39 0d 0a 0d 0a  ..3152..9119....
1fb80 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
1fb90 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
1fba0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
1fbb0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
1fbc0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
1fbd0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fbe0 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 63 6f 6c   col0 * col2 col
1fbf0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
1fc00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  or0..----..35..7
1fc10 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 73 6b 69 70  298..792....skip
1fc20 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20  if postgresql # 
1fc30 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69  PostgreSQL requi
1fc40 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61  res AS when rena
1fc50 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75  ming output colu
1fc60 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  mns..query I row
1fc70 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
1fc80 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
1fc90 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
1fca0 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75  .7..78..79....qu
1fcb0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1fcc0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
1fcd0 20 2a 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63   * cor0.col1 + c
1fce0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
1fcf0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35   cor0..----..-15
1fd00 36 0d 0a 2d 36 35 30 0d 0a 2d 39 30 0d 0a 0d 0a  6..-650..-90....
1fd10 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
1fd20 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
1fd30 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
1fd40 32 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 2c  2, tab1 AS cor0,
1fd50 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
1fd60 61 62 31 2c 20 74 61 62 32 20 63 6f 72 32 0d 0a  ab1, tab2 cor2..
1fd70 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75 65  ----..3645 value
1fd80 73 20 68 61 73 68 69 6e 67 20 74 6f 20 62 64 32  s hashing to bd2
1fd90 62 33 31 38 61 64 30 36 34 64 38 39 61 61 31 32  b318ad064d89aa12
1fda0 61 62 34 36 38 32 32 30 33 36 32 62 36 0d 0a 0d  ab468220362b6...
1fdb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
1fdc0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
1fdd0 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d 20  T + cor0.col0 - 
1fde0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  + col1 FROM tab0
1fdf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
1fe00 2d 32 0d 0a 2d 36 32 0d 0a 0d 0a 71 75 65 72 79  -2..-62....query
1fe10 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
1fe20 43 54 20 41 4c 4c 20 28 20 2b 20 63 6f 6c 31 20  CT ALL ( + col1 
1fe30 29 20 2b 20 2d 20 63 6f 6c 31 20 46 52 4f 4d 20  ) + - col1 FROM 
1fe40 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
1fe50 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
1fe60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
1fe70 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 31 20  SELECT + ( col1 
1fe80 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  ) FROM tab2 AS c
1fe90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 0d 0a 33  or0..----..17..3
1fea0 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72 79 20 49  1..59....query I
1feb0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
1fec0 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2a   ALL cor0.col2 *
1fed0 20 63 6f 6c 31 20 2d 20 2d 20 63 6f 72 30 2e 63   col1 - - cor0.c
1fee0 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 * col0 AS co
1fef0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
1ff00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 36 36  cor0..----..1566
1ff10 0d 0a 34 32 31 38 0d 0a 38 39 32 38 0d 0a 0d 0a  ..4218..8928....
1ff20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
1ff30 0a 53 45 4c 45 43 54 20 2b 20 2b 20 35 37 20 2b  .SELECT + + 57 +
1ff40 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   + cor0.col0 FRO
1ff50 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
1ff60 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 33 37 0d 0a  ----..121..137..
1ff70 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
1ff80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
1ff90 4c 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 31 35 20  L - col1 * - 15 
1ffa0 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  + col1 FROM tab2
1ffb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 32   cor0..----..272
1ffc0 0d 0a 34 39 36 0d 0a 39 34 34 0d 0a 0d 0a 71 75  ..496..944....qu
1ffd0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
1ffe0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
1fff0 20 63 6f 6c 32 20 2a 20 2d 20 34 34 20 41 53 20   col2 * - 44 AS 
20000 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
20010 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
20020 34 34 0d 0a 31 31 38 38 0d 0a 31 36 37 32 0d 0a  44..1188..1672..
20030 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
20040 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
20050 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
20060 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
20070 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36  rowsort label-96
20080 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
20090 43 54 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f  CT + col0 DIV co
200a0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
200b0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
200c0 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..1....skipif 
200d0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
200e0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
200f0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 36  rowsort label-96
20100 36 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  6..SELECT DISTIN
20110 43 54 20 2b 20 63 6f 6c 30 20 2f 20 63 6f 6c 30  CT + col0 / col0
20120 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
20130 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
20140 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..1....query I r
20150 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20160 20 31 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 32   1 + col2 - col2
20170 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
20180 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
20190 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71 75 65  ..1..1..1....que
201a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
201b0 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  LECT + col1 + co
201c0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
201d0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
201e0 30 0d 0a 2d 2d 2d 2d 0d 0a 35 35 0d 0a 35 38 0d  0..----..55..58.
201f0 0a 38 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .85....onlyif my
20200 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
20210 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
20220 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
20230 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
20240 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
20250 39 36 39 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41  969..SELECT + CA
20260 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
20270 45 44 20 29 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  ED ) - cor0.col2
20280 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
20290 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
202a0 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
202b0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
202c0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
202d0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
202e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
202f0 6c 2d 39 36 39 0d 0a 53 45 4c 45 43 54 20 2b 20  l-969..SELECT + 
20300 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
20310 4e 54 45 47 45 52 20 29 20 2d 20 63 6f 72 30 2e  NTEGER ) - cor0.
20320 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 41 53 20 63  col2 * col0 AS c
20330 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
20340 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
20350 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
20360 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
20370 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
20380 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
20390 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
203a0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
203b0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
203c0 54 20 41 4c 4c 20 2d 20 31 20 2b 20 35 34 20 2a  T ALL - 1 + 54 *
203d0 20 2d 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   - col1 col1 FRO
203e0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
203f0 2d 2d 2d 2d 0d 0a 2d 31 36 37 35 0d 0a 2d 33 31  ----..-1675..-31
20400 38 37 0d 0a 2d 39 31 39 0d 0a 0d 0a 71 75 65 72  87..-919....quer
20410 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20420 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31 20 2b  ECT ALL - col1 +
20430 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2d   + col0 * col1 -
20440 20 28 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30   ( col2 + - cor0
20450 2e 63 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 6c 31  .col1 ) * - col1
20460 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
20470 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
20480 0d 0a 31 36 38 33 0d 0a 32 35 39 36 0d 0a 36 32  ..1683..2596..62
20490 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
204a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
204b0 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 31 20 2d  INCT tab1.col1 -
204c0 20 33 34 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   34 FROM tab1..-
204d0 2d 2d 2d 0d 0a 2d 32 31 0d 0a 2d 32 34 0d 0a 2d  ---..-21..-24..-
204e0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
204f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
20500 6f 6c 31 20 2a 20 37 39 20 2b 20 2d 20 63 6f 6c  ol1 * 79 + - col
20510 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
20520 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 38 31  ab2..----..-1381
20530 0d 0a 2d 32 34 37 36 0d 0a 2d 34 36 38 37 0d 0a  ..-2476..-4687..
20540 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20550 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28 20  t..SELECT ALL ( 
20560 63 6f 6c 31 20 29 20 2b 20 2d 20 63 6f 72 30 2e  col1 ) + - cor0.
20570 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
20580 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
20590 0a 30 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  .0..0....onlyif 
205a0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
205b0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
205c0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
205d0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
205e0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
205f0 6c 2d 39 37 35 0d 0a 53 45 4c 45 43 54 20 43 41  l-975..SELECT CA
20600 53 54 28 20 2b 20 33 32 20 41 53 20 53 49 47 4e  ST( + 32 AS SIGN
20610 45 44 20 29 20 2a 20 63 6f 6c 32 20 2b 20 63 6f  ED ) * col2 + co
20620 72 30 2e 63 6f 6c 31 20 2a 20 28 20 2d 20 63 6f  r0.col1 * ( - co
20630 6c 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41  l2 ) FROM tab1 A
20640 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  S cor0..----..12
20650 35 34 0d 0a 31 38 32 34 0d 0a 33 32 34 0d 0a 0d  54..1824..324...
20660 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
20670 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
20680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
20690 6c 61 62 65 6c 2d 39 37 35 0d 0a 53 45 4c 45 43  label-975..SELEC
206a0 54 20 43 41 53 54 20 28 20 2b 20 33 32 20 41 53  T CAST ( + 32 AS
206b0 20 49 4e 54 45 47 45 52 20 29 20 2a 20 63 6f 6c   INTEGER ) * col
206c0 32 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20  2 + cor0.col1 * 
206d0 28 20 2d 20 63 6f 6c 32 20 29 20 46 52 4f 4d 20  ( - col2 ) FROM 
206e0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
206f0 2d 2d 0d 0a 31 32 35 34 0d 0a 31 38 32 34 0d 0a  --..1254..1824..
20700 33 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  324....query I r
20710 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
20720 4c 4c 20 2b 20 28 20 2b 20 63 6f 6c 31 20 29 20  LL + ( + col1 ) 
20730 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
20740 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37  2 cor0..----..17
20750 0d 0a 33 31 0d 0a 35 39 0d 0a 0d 0a 71 75 65 72  ..31..59....quer
20760 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20770 45 43 54 20 2d 20 2d 20 63 6f 6c 30 20 2a 20 2d  ECT - - col0 * -
20780 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
20790 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
207a0 0a 2d 2d 2d 2d 0d 0a 2d 34 30 39 36 0d 0a 2d 36  .----..-4096..-6
207b0 34 30 30 0d 0a 2d 39 0d 0a 0d 0a 6f 6e 6c 79 69  400..-9....onlyi
207c0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
207d0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
207e0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
207f0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20800 20 6c 61 62 65 6c 2d 39 37 38 0d 0a 53 45 4c 45   label-978..SELE
20810 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28 20  CT DISTINCT + ( 
20820 63 6f 6c 31 20 29 20 44 49 56 20 2b 20 63 6f 6c  col1 ) DIV + col
20830 31 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c  1 + + ( cor0.col
20840 32 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  2 ) AS col1 FROM
20850 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
20860 2d 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33 39 0d  ---..27..28..39.
20870 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
20880 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
20890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
208a0 74 20 6c 61 62 65 6c 2d 39 37 38 0d 0a 53 45 4c  t label-978..SEL
208b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 28  ECT DISTINCT + (
208c0 20 63 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 31   col1 ) / + col1
208d0 20 2b 20 2b 20 28 20 63 6f 72 30 2e 63 6f 6c 32   + + ( cor0.col2
208e0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
208f0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
20900 2d 2d 0d 0a 32 37 0d 0a 32 38 0d 0a 33 39 0d 0a  --..27..28..39..
20910 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
20920 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
20930 43 54 20 63 6f 6c 31 20 2d 20 32 31 20 46 52 4f  CT col1 - 21 FRO
20940 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 36 35  M tab0..----..65
20950 0d 0a 37 30 0d 0a 37 36 0d 0a 0d 0a 71 75 65 72  ..70..76....quer
20960 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
20970 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63  ECT + - col1 * c
20980 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
20990 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
209a0 2d 2d 2d 0d 0a 2d 37 33 39 36 0d 0a 2d 38 32 38  ---..-7396..-828
209b0 31 0d 0a 2d 39 34 30 39 0d 0a 0d 0a 71 75 65 72  1..-9409....quer
209c0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
209d0 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 34 20  ECT DISTINCT 84 
209e0 2a 20 63 6f 6c 32 20 2b 20 2b 20 35 35 20 41 53  * col2 + + 55 AS
209f0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
20a00 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
20a10 32 33 39 0d 0a 32 33 32 33 0d 0a 33 32 34 37 0d  239..2323..3247.
20a20 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20a30 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
20a40 4e 43 54 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  NCT - col2 AS co
20a50 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
20a60 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 33  0..----..-1..-33
20a70 0d 0a 2d 38 32 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-82....query I
20a80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
20a90 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2b 20 2b 20   ALL - col2 + + 
20aa0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31  cor0.col1 * col1
20ab0 20 2a 20 2d 20 31 39 20 46 52 4f 4d 20 74 61 62   * - 19 FROM tab
20ac0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
20ad0 0a 2d 31 34 30 35 35 37 0d 0a 2d 31 35 37 34 32  .-140557..-15742
20ae0 31 0d 0a 2d 31 37 38 37 37 32 0d 0a 0d 0a 73 6b  1..-178772....sk
20af0 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
20b00 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
20b10 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
20b20 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
20b30 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
20b40 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
20b50 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  LL - col0 * col2
20b60 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
20b70 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
20b80 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d  35..-7298..-792.
20b90 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
20ba0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
20bb0 31 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c  1 + col2 * + col
20bc0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
20bd0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d  or0..----..1261.
20be0 0a 31 34 33 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75  .1430..580....qu
20bf0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
20c00 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 36  ELECT DISTINCT 6
20c10 38 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  8 FROM tab1 AS c
20c20 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 38 0d 0a 0d  or0..----..68...
20c30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20c40 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
20c50 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63  * cor0.col2 AS c
20c60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f  ol1 FROM tab1 co
20c70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a  r0..----..-162..
20c80 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d 0a  -3648..-7680....
20c90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
20ca0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
20cb0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
20cc0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
20cd0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 38 38 0d  wsort label-988.
20ce0 0a 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 32  .SELECT + + col2
20cf0 20 44 49 56 20 2d 20 63 6f 6c 31 20 46 52 4f 4d   DIV - col1 FROM
20d00 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
20d10 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a  ---..0..0..0....
20d20 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
20d30 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
20d40 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
20d50 61 62 65 6c 2d 39 38 38 0d 0a 53 45 4c 45 43 54  abel-988..SELECT
20d60 20 2b 20 2b 20 63 6f 6c 32 20 2f 20 2d 20 63 6f   + + col2 / - co
20d70 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
20d80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
20d90 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ..0....query I r
20da0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
20db0 20 28 20 2d 20 63 6f 6c 30 20 29 20 2a 20 2b 20   ( - col0 ) * + 
20dc0 32 39 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  29 AS col1 FROM 
20dd0 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab1 cor0..----.
20de0 0a 2d 31 38 35 36 0d 0a 2d 32 33 32 30 0d 0a 2d  .-1856..-2320..-
20df0 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  87....query I ro
20e00 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61  wsort..SELECT ta
20e10 62 32 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20  b2.col1 AS col0 
20e20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
20e30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  AS cor0..----..9
20e40 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
20e50 74 6f 20 63 36 31 64 32 37 61 30 30 32 32 65 36  to c61d27a0022e6
20e60 64 30 32 32 33 37 31 64 63 35 38 38 31 39 61 62  d022371dc58819ab
20e70 32 37 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  272....query I r
20e80 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
20e90 20 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41   + col0 + col2 A
20ea0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
20eb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d   cor0..----..-7.
20ec0 0a 31 36 0d 0a 35 31 0d 0a 0d 0a 71 75 65 72 79  .16..51....query
20ed0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
20ee0 43 54 20 44 49 53 54 49 4e 43 54 20 32 36 20 2b  CT DISTINCT 26 +
20ef0 20 63 6f 6c 32 20 2a 20 28 20 2d 20 63 6f 6c 30   col2 * ( - col0
20f00 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63   ) * + col0 AS c
20f10 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol1 FROM tab2 AS
20f20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
20f30 39 37 0d 0a 2d 31 35 38 31 35 38 0d 0a 2d 32 33  97..-158158..-23
20f40 37 31 33 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  7132....skipif p
20f50 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
20f60 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
20f70 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
20f80 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
20f90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
20fa0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
20fb0 54 20 2b 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c  T + + col1 * col
20fc0 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  0 col0 FROM tab1
20fd0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
20fe0 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
20ff0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21000 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
21010 54 20 2b 20 28 20 2b 20 63 6f 6c 32 20 29 20 41  T + ( + col2 ) A
21020 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
21030 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
21040 31 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65  1..33..82....que
21050 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21060 4c 45 43 54 20 2b 20 33 38 20 46 52 4f 4d 20 74  LECT + 38 FROM t
21070 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
21080 2d 0d 0a 33 38 0d 0a 33 38 0d 0a 33 38 0d 0a 0d  -..38..38..38...
21090 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
210a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
210b0 54 20 2b 20 32 32 20 46 52 4f 4d 20 74 61 62 31  T + 22 FROM tab1
210c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
210d0 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  22....query I ro
210e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 30  wsort..SELECT 60
210f0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
21100 62 32 0d 0a 2d 2d 2d 2d 0d 0a 36 30 0d 0a 36 30  b2..----..60..60
21110 0d 0a 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..60....query I 
21120 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21130 32 33 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  23 AS col2 FROM 
21140 74 61 62 30 20 41 53 20 63 6f 72 30 20 43 52 4f  tab0 AS cor0 CRO
21150 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53 20  SS JOIN tab0 AS 
21160 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor1..----..9 va
21170 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
21180 64 39 34 66 61 64 63 63 31 63 38 63 63 34 66 63  d94fadcc1c8cc4fc
21190 35 31 62 37 38 62 38 33 65 30 34 37 39 35 66 32  51b78b83e04795f2
211a0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
211b0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
211c0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
211d0 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
211e0 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
211f0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 39  owsort label-999
21200 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28 20 4e  ..SELECT CAST( N
21210 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
21220 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 46   * - cor0.col2 F
21230 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41  ROM tab2, tab2 A
21240 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
21250 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
21260 6f 20 63 64 37 61 37 39 30 31 65 34 37 63 31 35  o cd7a7901e47c15
21270 31 35 35 34 30 34 61 66 66 30 64 32 31 36 66 65  155404aff0d216fe
21280 30 62 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  0b....skipif mys
21290 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
212a0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
212b0 73 6f 72 74 20 6c 61 62 65 6c 2d 39 39 39 0d 0a  sort label-999..
212c0 53 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55  SELECT CAST ( NU
212d0 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 2a 20 2d  LL AS REAL ) * -
212e0 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20   cor0.col2 FROM 
212f0 74 61 62 32 2c 20 74 61 62 32 20 41 53 20 63 6f  tab2, tab2 AS co
21300 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75  r0..----..9 valu
21310 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63 64  es hashing to cd
21320 37 61 37 39 30 31 65 34 37 63 31 35 31 35 35 34  7a7901e47c151554
21330 30 34 61 66 66 30 64 32 31 36 66 65 30 62 0d 0a  04aff0d216fe0b..
21340 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21350 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63 6f  t..SELECT - - co
21360 6c 32 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74  l2 * col1 FROM t
21370 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
21380 2d 0d 0a 31 32 34 38 0d 0a 31 34 30 34 0d 0a 35  -..1248..1404..5
21390 37 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  70....query I ro
213a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
213b0 63 6f 6c 30 20 2a 20 36 32 20 41 53 20 63 6f 6c  col0 * 62 AS col
213c0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
213d0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 38 38 0d  or0..----..1488.
213e0 0a 32 31 37 30 0d 0a 35 35 31 38 0d 0a 0d 0a 71  .2170..5518....q
213f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
21400 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
21410 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2b 20  - cor0.col1 + + 
21420 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
21430 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
21440 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
21450 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
21460 4e 43 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 2b  NCT + + col0 * +
21470 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 28 20 63   cor0.col1 + ( c
21480 6f 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52  ol1 ) AS col0 FR
21490 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
214a0 2d 2d 0d 0a 32 31 35 30 0d 0a 33 34 39 32 0d 0a  --..2150..3492..
214b0 38 31 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8190....query I 
214c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
214d0 2d 20 32 30 20 2a 20 63 6f 6c 31 20 41 53 20 63  - 20 * col1 AS c
214e0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
214f0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   cor0..----..-20
21500 30 0d 0a 2d 32 36 30 0d 0a 2d 35 32 30 0d 0a 0d  0..-260..-520...
21510 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
21520 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20  ..SELECT + col2 
21530 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  * col1 AS col1 F
21540 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
21550 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34  ..----..2838..74
21560 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72 79 20  62..97....query 
21570 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
21580 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 63  T ALL + col2 + c
21590 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 31  or0.col1 AS col1
215a0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
215b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a 36  r0..----..109..6
215c0 37 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  7..80....skipif 
215d0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
215e0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
215f0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
21600 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
21610 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
21620 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b  t..SELECT col0 +
21630 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f 6c 30 20   cor0.col2 col0 
21640 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
21650 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a 33 36  0..----..171..36
21660 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..57....query I 
21670 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21680 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 36 36 20  DISTINCT + + 66 
21690 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
216a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
216b0 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .66....query I r
216c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
216d0 49 53 54 49 4e 43 54 20 2b 20 35 35 20 2b 20 63  ISTINCT + 55 + c
216e0 6f 6c 31 20 2a 20 2d 20 28 20 2b 20 63 6f 72 30  ol1 * - ( + cor0
216f0 2e 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62  .col0 ) FROM tab
21700 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
21710 0a 2d 32 30 30 39 0d 0a 2d 33 33 34 30 0d 0a 2d  .-2009..-3340..-
21720 38 30 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8044....query I 
21730 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
21740 41 4c 4c 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ALL + col2 * + c
21750 6f 6c 32 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c  ol2 + col1 + col
21760 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
21770 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 39 0d 0a 31 33  ..----..1199..13
21780 33 0d 0a 36 39 30 34 0d 0a 0d 0a 71 75 65 72 79  3..6904....query
21790 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
217a0 43 54 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 30  CT - col0 + col0
217b0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
217c0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
217d0 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75  .7..78..79....qu
217e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
217f0 45 4c 45 43 54 20 2b 20 2b 20 28 20 63 6f 6c 30  ELECT + + ( col0
21800 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20   ) AS col0 FROM 
21810 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
21820 0a 37 0d 0a 37 38 0d 0a 37 39 0d 0a 0d 0a 71 75  .7..78..79....qu
21830 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21840 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
21850 20 2d 20 39 37 20 2a 20 2b 20 63 6f 6c 32 20 46   - 97 * + col2 F
21860 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21870 0d 0a 2d 2d 2d 2d 0d 0a 35 32 33 38 0d 0a 35 35  ..----..5238..55
21880 32 39 0d 0a 39 33 31 32 0d 0a 0d 0a 71 75 65 72  29..9312....quer
21890 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
218a0 45 43 54 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63  ECT - ( - cor0.c
218b0 6f 6c 31 20 29 20 2a 20 2d 20 63 6f 72 30 2e 63  ol1 ) * - cor0.c
218c0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2b 20 2d  ol0 + + col2 + -
218d0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
218e0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
218f0 0a 2d 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33  .----..-2064..-3
21900 33 39 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75  395..-8099....qu
21910 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
21920 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 31  ELECT ALL - col1
21930 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30   + col0 * - cor0
21940 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52  .col0 AS col2 FR
21950 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
21960 0a 2d 2d 2d 2d 0d 0a 2d 36 31 34 33 0d 0a 2d 36  .----..-6143..-6
21970 32 35 38 0d 0a 2d 38 30 0d 0a 0d 0a 71 75 65 72  258..-80....quer
21980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21990 45 43 54 20 2b 20 37 36 20 2a 20 63 6f 6c 31 20  ECT + 76 * col1 
219a0 2a 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  * - col1 AS col2
219b0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
219c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 36 32 30 39  r0..----..-56209
219d0 36 0d 0a 2d 36 32 39 33 35 36 0d 0a 2d 37 31 35  6..-629356..-715
219e0 30 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  084....query I r
219f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
21a00 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63   + col1 + cor0.c
21a10 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  ol1 + col1 * + c
21a20 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32  or0.col0 AS col2
21a30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
21a40 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a  r0..----..1040..
21a50 36 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  640..78....query
21a60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
21a70 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30  CT DISTINCT col0
21a80 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
21a90 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
21aa0 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33  0..----..2064..3
21ab0 33 39 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65  395..8099....que
21ac0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
21ad0 4c 45 43 54 20 41 4c 4c 20 2d 20 2d 20 31 20 46  LECT ALL - - 1 F
21ae0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
21af0 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d  ..----..1..1..1.
21b00 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
21b10 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
21b20 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
21b30 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
21b40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
21b50 30 32 30 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  020..SELECT cor0
21b60 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2a  .col1 * + col0 *
21b70 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20 63 6f   + ( col2 ) + co
21b80 6c 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20 2b 20  l0 + ( - col0 + 
21b90 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 44 49  + cor0.col1 ) DI
21ba0 56 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  V col2 AS col1 F
21bb0 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
21bc0 2d 2d 2d 0d 0a 33 34 39 32 0d 0a 36 36 34 32 30  ---..3492..66420
21bd0 37 0d 0a 36 38 31 33 37 0d 0a 0d 0a 73 6b 69 70  7..68137....skip
21be0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
21bf0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
21c00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
21c10 2d 31 30 32 30 0d 0a 53 45 4c 45 43 54 20 63 6f  -1020..SELECT co
21c20 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30  r0.col1 * + col0
21c30 20 2a 20 2b 20 28 20 63 6f 6c 32 20 29 20 2b 20   * + ( col2 ) + 
21c40 63 6f 6c 30 20 2b 20 28 20 2d 20 63 6f 6c 30 20  col0 + ( - col0 
21c50 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20  + + cor0.col1 ) 
21c60 2f 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  / col2 AS col1 F
21c70 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d  ROM tab0 cor0..-
21c80 2d 2d 2d 0d 0a 33 34 39 32 0d 0a 36 36 34 32 30  ---..3492..66420
21c90 37 0d 0a 36 38 31 33 37 0d 0a 0d 0a 71 75 65 72  7..68137....quer
21ca0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
21cb0 45 43 54 20 41 4c 4c 20 2d 20 33 37 20 2a 20 63  ECT ALL - 37 * c
21cc0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
21cd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31   cor0..----..-11
21ce0 31 0d 0a 2d 32 33 36 38 0d 0a 2d 32 39 36 30 0d  1..-2368..-2960.
21cf0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
21d00 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
21d10 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
21d20 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
21d30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
21d40 30 32 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  022..SELECT DIST
21d50 49 4e 43 54 20 2b 20 36 32 20 2b 20 63 6f 6c 30  INCT + 62 + col0
21d60 20 44 49 56 20 2d 20 63 6f 72 30 2e 63 6f 6c 30   DIV - cor0.col0
21d70 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
21d80 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31 0d 0a 0d 0a  r0..----..61....
21d90 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
21da0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
21db0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
21dc0 61 62 65 6c 2d 31 30 32 32 0d 0a 53 45 4c 45 43  abel-1022..SELEC
21dd0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 36 32 20  T DISTINCT + 62 
21de0 2b 20 63 6f 6c 30 20 2f 20 2d 20 63 6f 72 30 2e  + col0 / - cor0.
21df0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
21e00 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 36 31  S cor0..----..61
21e10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
21e20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72 30  ort..SELECT cor0
21e30 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a  .col0 + + col1 *
21e40 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   + cor0.col1 * -
21e50 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 46   col0 + + col2 F
21e60 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
21e70 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 33 34 34 0d 0a  ..----..-13344..
21e80 2d 31 39 37 31 0d 0a 2d 36 32 37 39 0d 0a 0d 0a  -1971..-6279....
21e90 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
21ea0 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
21eb0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
21ec0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
21ed0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 34  wsort label-1024
21ee0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62  ..SELECT ALL tab
21ef0 32 2e 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20  2.col1 DIV col0 
21f00 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
21f10 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34  2..----..0..0..4
21f20 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
21f30 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
21f40 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
21f50 72 74 20 6c 61 62 65 6c 2d 31 30 32 34 0d 0a 53  rt label-1024..S
21f60 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e 63  ELECT ALL tab2.c
21f70 6f 6c 31 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 / col0 AS co
21f80 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
21f90 2d 2d 0d 0a 30 0d 0a 30 0d 0a 34 0d 0a 0d 0a 6f  --..0..0..4....o
21fa0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
21fb0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
21fc0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
21fd0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
21fe0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 32 35 0d  sort label-1025.
21ff0 0a 53 45 4c 45 43 54 20 35 20 44 49 56 20 74 61  .SELECT 5 DIV ta
22000 62 31 2e 63 6f 6c 31 20 2b 20 2b 20 34 39 20 2a  b1.col1 + + 49 *
22010 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20   + col1 AS col0 
22020 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
22030 0a 31 32 37 34 0d 0a 34 39 30 0d 0a 36 33 37 0d  .1274..490..637.
22040 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
22050 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
22060 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22070 74 20 6c 61 62 65 6c 2d 31 30 32 35 0d 0a 53 45  t label-1025..SE
22080 4c 45 43 54 20 35 20 2f 20 74 61 62 31 2e 63 6f  LECT 5 / tab1.co
22090 6c 31 20 2b 20 2b 20 34 39 20 2a 20 2b 20 63 6f  l1 + + 49 * + co
220a0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
220b0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 32 37 34  tab1..----..1274
220c0 0d 0a 34 39 30 0d 0a 36 33 37 0d 0a 0d 0a 6f 6e  ..490..637....on
220d0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
220e0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
220f0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
22100 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
22110 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22120 20 6c 61 62 65 6c 2d 31 30 32 36 0d 0a 53 45 4c   label-1026..SEL
22130 45 43 54 20 2d 20 2b 20 63 6f 6c 30 20 2a 20 43  ECT - + col0 * C
22140 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
22150 4e 45 44 20 29 20 41 53 20 63 6f 6c 30 20 46 52  NED ) AS col0 FR
22160 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
22170 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
22180 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
22190 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
221a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
221b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
221c0 31 30 32 36 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  1026..SELECT - +
221d0 20 63 6f 6c 30 20 2a 20 43 41 53 54 20 28 20 4e   col0 * CAST ( N
221e0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
221f0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
22200 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
22210 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
22220 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
22230 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
22240 4c 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20  L col1 * + col0 
22250 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  * col0 AS col0 F
22260 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22270 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 30 39 37 0d 0a  ..----..106097..
22280 31 35 31 39 0d 0a 33 35 38 39 35 36 0d 0a 0d 0a  1519..358956....
22290 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
222a0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
222b0 20 2d 20 37 33 20 2a 20 2d 20 63 6f 6c 32 20 2a   - 73 * - col2 *
222c0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
222d0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
222e0 30 37 31 37 34 0d 0a 35 34 34 37 32 36 0d 0a 37  07174..544726..7
222f0 30 38 31 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  081....onlyif my
22300 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
22310 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
22320 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
22330 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
22340 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
22350 31 30 32 39 0d 0a 53 45 4c 45 43 54 20 2d 20 43  1029..SELECT - C
22360 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
22370 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c 31 20 2d  NED ) * + col1 -
22380 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20   + cor0.col1 AS 
22390 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 63  col0 FROM tab2 c
223a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
223b0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
223c0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
223d0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
223e0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
223f0 62 65 6c 2d 31 30 32 39 0d 0a 53 45 4c 45 43 54  bel-1029..SELECT
22400 20 2d 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   - CAST ( NULL A
22410 53 20 49 4e 54 45 47 45 52 20 29 20 2a 20 2b 20  S INTEGER ) * + 
22420 63 6f 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63 6f  col1 - + cor0.co
22430 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
22440 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
22450 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
22460 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  L....query I row
22470 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
22480 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2d 20 63  TINCT col2 * - c
22490 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
224a0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
224b0 2d 2d 2d 0d 0a 2d 31 34 34 34 0d 0a 2d 36 37 36  ---..-1444..-676
224c0 0d 0a 2d 37 32 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  ..-729....onlyif
224d0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
224e0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
224f0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
22500 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
22510 6c 61 62 65 6c 2d 31 30 33 31 0d 0a 53 45 4c 45  label-1031..SELE
22520 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 44 49  CT ALL + col0 DI
22530 56 20 2b 20 33 36 20 41 53 20 63 6f 6c 32 20 46  V + 36 AS col2 F
22540 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
22550 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 32 0d  ..----..0..2..2.
22560 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
22570 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
22580 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22590 74 20 6c 61 62 65 6c 2d 31 30 33 31 0d 0a 53 45  t label-1031..SE
225a0 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20  LECT ALL + col0 
225b0 2f 20 2b 20 33 36 20 41 53 20 63 6f 6c 32 20 46  / + 36 AS col2 F
225c0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
225d0 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 32 0d  ..----..0..2..2.
225e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
225f0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
22600 20 28 20 2d 20 37 37 20 29 20 46 52 4f 4d 20 74   ( - 77 ) FROM t
22610 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
22620 2d 0d 0a 37 37 0d 0a 37 37 0d 0a 37 37 0d 0a 0d  -..77..77..77...
22630 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22640 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
22650 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31  or0.col0 AS col1
22660 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
22670 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d  .----..-24..-35.
22680 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-89....query I 
22690 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
226a0 41 4c 4c 20 2b 20 63 6f 72 31 2e 63 6f 6c 30 20  ALL + cor1.col0 
226b0 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
226c0 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
226d0 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 30 20  JOIN tab1, tab0 
226e0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
226f0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
22700 20 74 6f 20 39 66 63 31 64 63 64 37 36 66 65 61   to 9fc1dcd76fea
22710 66 34 33 65 35 63 35 64 63 30 36 30 61 30 32 30  f43e5c5dc060a020
22720 31 34 63 64 0d 0a 0d 0a 71 75 65 72 79 20 49 49  14cd....query II
22730 49 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f  IIIIIIIIII rowso
22740 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f  rt..SELECT * FRO
22750 4d 20 74 61 62 32 2c 20 74 61 62 30 20 41 53 20  M tab2, tab0 AS 
22760 63 6f 72 30 2c 20 74 61 62 30 2c 20 74 61 62 32  cor0, tab0, tab2
22770 20 41 53 20 63 6f 72 31 20 57 48 45 52 45 20 4e   AS cor1 WHERE N
22780 4f 54 20 4e 55 4c 4c 20 3c 3d 20 28 20 4e 55 4c  OT NULL <= ( NUL
22790 4c 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c  L )..----....onl
227a0 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
227b0 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
227c0 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
227d0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
227e0 72 74 20 6c 61 62 65 6c 2d 31 30 33 36 0d 0a 53  rt label-1036..S
227f0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
22800 6f 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 39  ol0 + col0 * - 9
22810 30 20 2d 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  0 - col2 DIV - c
22820 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol1 AS col2 FROM
22830 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32   tab2..----..-62
22840 33 0d 0a 2d 36 39 34 32 0d 0a 2d 37 30 32 39 0d  3..-6942..-7029.
22850 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
22860 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
22870 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
22880 74 20 6c 61 62 65 6c 2d 31 30 33 36 0d 0a 53 45  t label-1036..SE
22890 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
228a0 6c 30 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 39 30  l0 + col0 * - 90
228b0 20 2d 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31   - col2 / - col1
228c0 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
228d0 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 36 32 33 0d 0a  b2..----..-623..
228e0 2d 36 39 34 32 0d 0a 2d 37 30 32 39 0d 0a 0d 0a  -6942..-7029....
228f0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22900 0a 53 45 4c 45 43 54 20 2b 20 38 34 20 46 52 4f  .SELECT + 84 FRO
22910 4d 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  M tab1, tab0 AS 
22920 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
22930 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
22940 63 61 64 64 38 37 36 63 32 36 33 33 38 66 63 35  cadd876c26338fc5
22950 38 62 39 32 39 37 65 37 34 66 63 33 32 34 64 38  8b9297e74fc324d8
22960 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
22970 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  ort..SELECT + ta
22980 62 31 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31  b1.col1 * - col1
22990 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   * col2 AS col0 
229a0 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
229b0 0a 2d 31 36 32 32 34 0d 0a 2d 33 36 35 30 34 0d  .-16224..-36504.
229c0 0a 2d 35 37 30 30 0d 0a 0d 0a 71 75 65 72 79 20  .-5700....query 
229d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
229e0 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20 2b 20 63  T ALL col1 * + c
229f0 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 + col2 FROM 
22a00 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37  tab0..----..2097
22a10 0d 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a  ..3396..8181....
22a20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
22a30 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33 34  .SELECT ALL + 34
22a40 20 2a 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 46   * col0 + col0 F
22a50 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
22a60 31 30 35 0d 0a 32 32 34 30 0d 0a 32 38 30 30 0d  105..2240..2800.
22a70 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22a80 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
22a90 30 20 2a 20 39 32 20 2a 20 2b 20 74 61 62 32 2e  0 * 92 * + tab2.
22aa0 63 6f 6c 31 20 2d 20 2b 20 35 36 20 46 52 4f 4d  col1 - + 56 FROM
22ab0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33   tab2..----..123
22ac0 35 30 30 0d 0a 31 39 39 30 38 0d 0a 34 32 33 33  500..19908..4233
22ad0 32 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  28....skipif pos
22ae0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
22af0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
22b00 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
22b10 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
22b20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22b30 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
22b40 20 36 20 29 20 2b 20 2b 20 63 6f 72 30 2e 63 6f   6 ) + + cor0.co
22b50 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
22b60 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
22b70 0a 32 33 0d 0a 33 37 0d 0a 36 35 0d 0a 0d 0a 71  .23..37..65....q
22b80 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
22b90 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
22ba0 2b 20 2d 20 63 6f 6c 31 20 2a 20 28 20 63 6f 6c  + - col1 * ( col
22bb0 30 20 2b 20 2b 20 63 6f 6c 31 20 29 20 41 53 20  0 + + col1 ) AS 
22bc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
22bd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
22be0 31 37 38 0d 0a 2d 31 36 33 32 0d 0a 2d 38 30 38  178..-1632..-808
22bf0 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  3....query I row
22c00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
22c10 20 2d 20 28 20 33 31 20 29 20 2a 20 63 6f 6c 31   - ( 31 ) * col1
22c20 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
22c30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 36 36 0d  r0..----..-2666.
22c40 0a 2d 32 38 32 31 0d 0a 2d 33 30 30 37 0d 0a 0d  .-2821..-3007...
22c50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
22c60 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
22c70 54 20 2b 20 38 32 20 46 52 4f 4d 20 74 61 62 32  T + 82 FROM tab2
22c80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22c90 38 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  82....onlyif mys
22ca0 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
22cb0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
22cc0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
22cd0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
22ce0 6c 2d 31 30 34 36 0d 0a 53 45 4c 45 43 54 20 2b  l-1046..SELECT +
22cf0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 44 49 56   col0 + col1 DIV
22d00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
22d10 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 33 36 0d 0a 39  .----..25..36..9
22d20 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
22d30 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
22d40 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
22d50 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 36 0d 0a  ort label-1046..
22d60 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 2b 20  SELECT + col0 + 
22d70 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 46 52 4f 4d  col1 / col1 FROM
22d80 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 35 0d   tab0..----..25.
22d90 0a 33 36 0d 0a 39 30 0d 0a 0d 0a 71 75 65 72 79  .36..90....query
22da0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
22db0 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 37 39  CT DISTINCT - 79
22dc0 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   + - col0 + col2
22dd0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
22de0 0d 0a 2d 32 38 0d 0a 2d 36 33 0d 0a 2d 38 36 0d  ..-28..-63..-86.
22df0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22e00 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 33  rt..SELECT ALL 3
22e10 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 * col2 FROM ta
22e20 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
22e30 0d 0a 32 34 36 30 0d 0a 33 30 0d 0a 39 39 30 0d  ..2460..30..990.
22e40 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
22e50 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79  # support for My
22e60 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73  SQL specific sys
22e70 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79  tem types and sy
22e80 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f  ntax..query I ro
22e90 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 34 39  wsort label-1049
22ea0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43  ..SELECT ALL - C
22eb0 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47  AST( NULL AS SIG
22ec0 4e 45 44 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41  NED ) * + col0 A
22ed0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
22ee0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
22ef0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
22f00 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
22f10 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
22f20 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
22f30 72 74 20 6c 61 62 65 6c 2d 31 30 34 39 0d 0a 53  rt label-1049..S
22f40 45 4c 45 43 54 20 41 4c 4c 20 2d 20 43 41 53 54  ELECT ALL - CAST
22f50 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47   ( NULL AS INTEG
22f60 45 52 20 29 20 2a 20 2b 20 63 6f 6c 30 20 41 53  ER ) * + col0 AS
22f70 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
22f80 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
22f90 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
22fa0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
22fb0 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
22fc0 20 63 6f 6c 31 20 2a 20 2d 20 34 39 20 2b 20 2b   col1 * - 49 + +
22fd0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
22fe0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
22ff0 33 30 30 0d 0a 35 30 30 0d 0a 36 35 30 0d 0a 0d  300..500..650...
23000 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
23010 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
23020 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32 2c  ECT * FROM tab2,
23030 20 74 61 62 31 20 63 6f 72 30 20 43 52 4f 53 53   tab1 cor0 CROSS
23040 20 4a 4f 49 4e 20 74 61 62 31 2c 20 74 61 62 32   JOIN tab1, tab2
23050 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
23060 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68 69  972 values hashi
23070 6e 67 20 74 6f 20 30 31 61 35 39 33 31 63 63 63  ng to 01a5931ccc
23080 63 33 64 61 64 38 37 39 32 61 31 62 63 36 64 66  c3dad8792a1bc6df
23090 30 39 63 36 31 34 0d 0a 0d 0a 71 75 65 72 79 20  09c614....query 
230a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
230b0 54 20 41 4c 4c 20 63 6f 72 30 2e 63 6f 6c 32 20  T ALL cor0.col2 
230c0 2a 20 74 61 62 30 2e 63 6f 6c 30 20 41 53 20 63  * tab0.col0 AS c
230d0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol0 FROM tab2, t
230e0 61 62 32 20 63 6f 72 30 20 43 52 4f 53 53 20 4a  ab2 cor0 CROSS J
230f0 4f 49 4e 20 74 61 62 30 2c 20 74 61 62 31 20 41  OIN tab0, tab1 A
23100 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 38 31  S cor1..----..81
23110 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
23120 74 6f 20 64 39 39 35 63 37 38 31 66 36 63 32 32  to d995c781f6c22
23130 34 61 66 39 38 65 32 33 65 37 39 38 65 66 61 38  4af98e23e798efa8
23140 61 65 64 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  aed....query I r
23150 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
23160 20 34 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   42 AS col0 FROM
23170 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
23180 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
23190 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 39  ues hashing to 9
231a0 38 39 34 30 39 33 66 32 39 63 30 64 65 66 61 65  894093f29c0defae
231b0 39 31 33 34 37 39 33 34 66 30 36 30 33 32 39 0d  91347934f060329.
231c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
231d0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 31 20  rt..SELECT + 41 
231e0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
231f0 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 31  2 cor0..----..41
23200 0d 0a 34 31 0d 0a 34 31 0d 0a 0d 0a 71 75 65 72  ..41..41....quer
23210 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23220 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a  ECT ALL - col0 *
23230 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32   + col0 * - col2
23240 20 2b 20 2d 20 31 39 20 41 53 20 63 6f 6c 30 20   + - 19 AS col0 
23250 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
23260 30 0d 0a 2d 2d 2d 2d 0d 0a 32 33 33 34 35 33 0d  0..----..233453.
23270 0a 34 36 37 0d 0a 36 31 34 33 38 31 0d 0a 0d 0a  .467..614381....
23280 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
23290 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
232a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
232b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
232c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 36  wsort label-1056
232d0 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 28 20 2d  ..SELECT - ( ( -
232e0 20 63 6f 6c 31 20 29 20 29 20 2b 20 2d 20 36 39   col1 ) ) + - 69
232f0 20 44 49 56 20 35 33 20 2b 20 63 6f 6c 30 20 41   DIV 53 + col0 A
23300 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
23310 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 37 33 0d 0a  ..----..28..73..
23320 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  92....skipif mys
23330 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
23340 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
23350 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 35 36 0d  sort label-1056.
23360 0a 53 45 4c 45 43 54 20 2d 20 28 20 28 20 2d 20  .SELECT - ( ( - 
23370 63 6f 6c 31 20 29 20 29 20 2b 20 2d 20 36 39 20  col1 ) ) + - 69 
23380 2f 20 35 33 20 2b 20 63 6f 6c 30 20 41 53 20 63  / 53 + col0 AS c
23390 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol2 FROM tab1..-
233a0 2d 2d 2d 0d 0a 32 38 0d 0a 37 33 0d 0a 39 32 0d  ---..28..73..92.
233b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
233c0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
233d0 32 20 2a 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  2 * + col0 AS co
233e0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
233f0 2d 2d 0d 0a 31 38 39 0d 0a 32 30 32 38 0d 0a 33  --..189..2028..3
23400 30 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  002....query I r
23410 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
23420 20 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c   ( col2 ) AS col
23430 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  1 FROM tab2 cor0
23440 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a  ..----..26..27..
23450 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
23460 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
23470 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32  col0 * cor0.col2
23480 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
23490 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
234a0 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a 2d 37  ..-35..-7298..-7
234b0 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
234c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
234d0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
234e0 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f  col1 AS col1 FRO
234f0 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
23500 35 33 34 0d 0a 2d 36 34 36 0d 0a 2d 38 33 37 0d  534..-646..-837.
23510 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
23520 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
23530 20 63 6f 6c 31 20 2a 20 2b 20 34 37 20 46 52 4f   col1 * + 47 FRO
23540 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34  M tab0..----..-4
23550 30 34 32 0d 0a 2d 34 32 37 37 0d 0a 2d 34 35 35  042..-4277..-455
23560 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
23570 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
23580 6f 6c 32 20 2b 20 2d 20 28 20 63 6f 6c 30 20 29  ol2 + - ( col0 )
23590 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
235a0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a  r0..----..-121..
235b0 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65  -176..-57....que
235c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
235d0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
235e0 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 39 20  col0 + col2 * 9 
235f0 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
23600 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
23610 0a 33 32 31 0d 0a 34 34 0d 0a 38 32 37 0d 0a 0d  .321..44..827...
23620 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23630 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
23640 20 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 46 52 4f   col2 + col0 FRO
23650 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
23660 2d 2d 2d 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a  ----..-16..-51..
23670 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
23680 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b  sort..SELECT - +
23690 20 63 6f 6c 31 20 2a 20 2b 20 39 35 20 41 53 20   col1 * + 95 AS 
236a0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41  col1 FROM tab1 A
236b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
236c0 32 33 35 0d 0a 2d 32 34 37 30 0d 0a 2d 39 35 30  235..-2470..-950
236d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
236e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
236f0 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31 20 2d 20  INCT - + col1 - 
23700 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a 20 63  - ( + col2 ) * c
23710 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31  or0.col2 AS col1
23720 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
23730 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 30 0d 0a  r0..----..2890..
23740 33 32 33 39 0d 0a 39 32 30 33 0d 0a 0d 0a 6f 6e  3239..9203....on
23750 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
23760 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
23770 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
23780 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
23790 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
237a0 20 6c 61 62 65 6c 2d 31 30 36 37 0d 0a 53 45 4c   label-1067..SEL
237b0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
237c0 6f 72 30 2e 63 6f 6c 32 20 2b 20 2b 20 43 41 53  or0.col2 + + CAS
237d0 54 28 20 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d  T( NULL AS DECIM
237e0 41 4c 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f  AL ) AS col2 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 4e 55 4c 4c 0d 0a 0d 0a 73 6b  ----..NULL....sk
23810 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
23820 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
23830 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
23840 65 6c 2d 31 30 36 37 0d 0a 53 45 4c 45 43 54 20  el-1067..SELECT 
23850 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
23860 63 6f 6c 32 20 2b 20 2b 20 43 41 53 54 20 28 20  col2 + + CAST ( 
23870 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20 29 20 41  NULL AS REAL ) A
23880 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
23890 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
238a0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
238b0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
238c0 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e 63 6f  DISTINCT cor0.co
238d0 6c 30 20 2a 20 28 20 2d 20 63 6f 72 30 2e 63 6f  l0 * ( - cor0.co
238e0 6c 31 20 29 20 2b 20 63 6f 6c 30 20 46 52 4f 4d  l1 ) + col0 FROM
238f0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
23900 2d 2d 2d 0d 0a 2d 35 37 36 0d 0a 2d 37 35 0d 0a  ---..-576..-75..
23910 2d 39 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -960....query I 
23920 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23930 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 41 53  + col0 + col2 AS
23940 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
23950 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d  cor0..----..121.
23960 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72  .176..57....quer
23970 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
23980 45 43 54 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 32  ECT - + col2 * 2
23990 39 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  9 FROM tab0 AS c
239a0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 33 37 38  or0..----..-2378
239b0 0d 0a 2d 32 39 0d 0a 2d 39 35 37 0d 0a 0d 0a 71  ..-29..-957....q
239c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
239d0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
239e0 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20 46 52  col0 * - col0 FR
239f0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
23a00 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a 2d 35  .----..-1225..-5
23a10 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 6f 6e 6c  76..-7921....onl
23a20 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
23a30 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
23a40 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
23a50 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
23a60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
23a70 6c 61 62 65 6c 2d 31 30 37 32 0d 0a 53 45 4c 45  label-1072..SELE
23a80 43 54 20 2b 20 2d 20 43 41 53 54 28 20 2d 20 38  CT + - CAST( - 8
23a90 38 20 41 53 20 53 49 47 4e 45 44 20 29 20 2d 20  8 AS SIGNED ) - 
23aa0 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 28 20 2d 20  cor0.col0 * ( - 
23ab0 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 30 20 46  col0 ) AS col0 F
23ac0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
23ad0 2d 2d 2d 0d 0a 31 33 37 0d 0a 36 31 37 32 0d 0a  ---..137..6172..
23ae0 36 33 32 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  6329....skipif m
23af0 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
23b00 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
23b10 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 37  owsort label-107
23b20 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 43 41  2..SELECT + - CA
23b30 53 54 20 28 20 2d 20 38 38 20 41 53 20 49 4e 54  ST ( - 88 AS INT
23b40 45 47 45 52 20 29 20 2d 20 63 6f 72 30 2e 63 6f  EGER ) - cor0.co
23b50 6c 30 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29 20  l0 * ( - col0 ) 
23b60 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
23b70 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33  2 cor0..----..13
23b80 37 0d 0a 36 31 37 32 0d 0a 36 33 32 39 0d 0a 0d  7..6172..6329...
23b90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
23ba0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
23bb0 6f 6c 31 20 2a 20 2d 20 36 30 20 2b 20 63 6f 6c  ol1 * - 60 + col
23bc0 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
23bd0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
23be0 2d 0d 0a 2d 31 35 30 36 0d 0a 2d 35 34 33 0d 0a  -..-1506..-543..
23bf0 2d 36 38 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -684....query I 
23c00 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
23c10 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c  DISTINCT - + col
23c20 30 20 2d 20 28 20 2d 20 63 6f 72 30 2e 63 6f 6c  0 - ( - cor0.col
23c30 31 20 29 20 2a 20 2d 20 31 37 20 2a 20 2d 20 63  1 ) * - 17 * - c
23c40 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
23c50 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34   cor0..----..114
23c60 38 39 0d 0a 31 36 33 36 0d 0a 32 37 39 33 0d 0a  89..1636..2793..
23c70 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
23c80 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
23c90 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
23ca0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
23cb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
23cc0 37 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  75..SELECT ALL -
23cd0 20 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 41   col0 DIV col1 A
23ce0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
23cf0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
23d00 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 73 6b 69  -6..-6..0....ski
23d10 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
23d20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
23d30 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23d40 6c 2d 31 30 37 35 0d 0a 53 45 4c 45 43 54 20 41  l-1075..SELECT A
23d50 4c 4c 20 2d 20 63 6f 6c 30 20 2f 20 63 6f 6c 31  LL - col0 / col1
23d60 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
23d70 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
23d80 0d 0a 2d 36 0d 0a 2d 36 0d 0a 30 0d 0a 0d 0a 6f  ..-6..-6..0....o
23d90 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
23da0 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
23db0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
23dc0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
23dd0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23de0 74 20 6c 61 62 65 6c 2d 31 30 37 36 0d 0a 53 45  t label-1076..SE
23df0 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e 55 4c  LECT + CAST( NUL
23e00 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  L AS SIGNED ) AS
23e10 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
23e20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
23e30 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
23e40 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
23e50 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
23e60 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
23e70 74 20 6c 61 62 65 6c 2d 31 30 37 36 0d 0a 53 45  t label-1076..SE
23e80 4c 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55  LECT + CAST ( NU
23e90 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
23ea0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
23eb0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
23ec0 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .NULL..NULL..NUL
23ed0 4c 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  L....onlyif mysq
23ee0 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
23ef0 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
23f00 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
23f10 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
23f20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
23f30 37 37 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  77..SELECT ALL +
23f40 20 2d 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   - CAST( NULL AS
23f50 20 53 49 47 4e 45 44 20 29 20 2f 20 63 6f 6c 30   SIGNED ) / col0
23f60 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20   + col0 AS col0 
23f70 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
23f80 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
23f90 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
23fa0 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
23fb0 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
23fc0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
23fd0 6c 2d 31 30 37 37 0d 0a 53 45 4c 45 43 54 20 41  l-1077..SELECT A
23fe0 4c 4c 20 2b 20 2d 20 43 41 53 54 20 28 20 4e 55  LL + - CAST ( NU
23ff0 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
24000 2f 20 63 6f 6c 30 20 2b 20 63 6f 6c 30 20 41 53  / col0 + col0 AS
24010 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
24020 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  AS cor0..----..N
24030 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
24040 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
24050 72 74 0d 0a 53 45 4c 45 43 54 20 31 33 20 41 53  rt..SELECT 13 AS
24060 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20   col0 FROM tab0 
24070 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24080 33 0d 0a 31 33 0d 0a 31 33 0d 0a 0d 0a 6f 6e 6c  3..13..13....onl
24090 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
240a0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
240b0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
240c0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
240d0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
240e0 6c 61 62 65 6c 2d 31 30 37 39 0d 0a 53 45 4c 45  label-1079..SELE
240f0 43 54 20 2b 20 43 41 53 54 28 20 2b 20 63 6f 6c  CT + CAST( + col
24100 30 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53  0 AS SIGNED ) AS
24110 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
24120 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor0..----..3
24130 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 73 6b 69 70  ..64..80....skip
24140 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
24150 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
24160 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
24170 2d 31 30 37 39 0d 0a 53 45 4c 45 43 54 20 2b 20  -1079..SELECT + 
24180 43 41 53 54 20 28 20 2b 20 63 6f 6c 30 20 41 53  CAST ( + col0 AS
24190 20 49 4e 54 45 47 45 52 20 29 20 41 53 20 63 6f   INTEGER ) AS co
241a0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
241b0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36  cor0..----..3..6
241c0 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  4..80....query I
241d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
241e0 20 2d 20 37 31 20 2a 20 33 34 20 46 52 4f 4d 20   - 71 * 34 FROM 
241f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
24200 2d 2d 0d 0a 2d 32 34 31 34 0d 0a 2d 32 34 31 34  --..-2414..-2414
24210 0d 0a 2d 32 34 31 34 0d 0a 0d 0a 6f 6e 6c 79 69  ..-2414....onlyi
24220 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
24230 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
24240 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
24250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24260 20 6c 61 62 65 6c 2d 31 30 38 31 0d 0a 53 45 4c   label-1081..SEL
24270 45 43 54 20 63 6f 6c 32 20 44 49 56 20 2d 20 63  ECT col2 DIV - c
24280 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c  ol1 - col0 * col
24290 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
242a0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
242b0 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32 34  -49..-6084..-624
242c0 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  3....skipif mysq
242d0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
242e0 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
242f0 6f 72 74 20 6c 61 62 65 6c 2d 31 30 38 31 0d 0a  ort label-1081..
24300 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 2d 20  SELECT col2 / - 
24310 63 6f 6c 31 20 2d 20 63 6f 6c 30 20 2a 20 63 6f  col1 - col0 * co
24320 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
24330 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab2 cor0..----.
24340 0a 2d 34 39 0d 0a 2d 36 30 38 34 0d 0a 2d 36 32  .-49..-6084..-62
24350 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  43....query I ro
24360 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
24370 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 2a 20 63 6f  col2 - col1 * co
24380 6c 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l2 AS col1 FROM 
24390 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
243a0 2d 2d 0d 0a 2d 32 38 37 31 0d 0a 2d 37 35 34 34  --..-2871..-7544
243b0 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-98....query I
243c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
243d0 20 63 6f 6c 30 20 2d 20 63 6f 6c 32 20 2a 20 2d   col0 - col2 * -
243e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
243f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
24400 36 31 32 0d 0a 37 32 35 0d 0a 38 34 34 0d 0a 0d  612..725..844...
24410 0a 71 75 65 72 79 20 49 49 49 49 49 49 20 72 6f  .query IIIIII ro
24420 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
24430 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20  FROM tab2, tab2 
24440 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e 4f  AS cor0 WHERE NO
24450 54 20 4e 55 4c 4c 20 3e 20 4e 55 4c 4c 0d 0a 2d  T NULL > NULL..-
24460 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ---....query I r
24470 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
24480 49 53 54 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c  ISTINCT tab1.col
24490 32 20 2a 20 74 61 62 31 2e 63 6f 6c 31 20 46 52  2 * tab1.col1 FR
244a0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab1..----..1
244b0 32 34 38 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a  248..1404..570..
244c0 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
244d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
244e0 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  INCT * FROM tab1
244f0 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20 4e   AS cor0 WHERE N
24500 4f 54 20 28 20 4e 55 4c 4c 20 29 20 3c 3d 20 4e  OT ( NULL ) <= N
24510 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65  ULL..----....que
24520 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
24530 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
24540 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  * cor0.col0 FROM
24550 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
24560 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
24570 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79  ..-7680....query
24580 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24590 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT + col0 * col2
245a0 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 31   - col2 * + col1
245b0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
245c0 0d 0a 2d 31 36 34 0d 0a 2d 32 30 34 36 0d 0a 2d  ..-164..-2046..-
245d0 36 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  62....query I ro
245e0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
245f0 4c 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 74 61 62  L - col0 - - tab
24600 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  2.col0 AS col1 F
24610 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
24620 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
24630 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
24640 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 74 61  CT DISTINCT + ta
24650 62 31 2e 63 6f 6c 30 20 2d 20 2b 20 63 6f 6c 32  b1.col0 - + col2
24660 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
24670 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d  ..-16..-51..7...
24680 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24690 0d 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f  ..SELECT tab0.co
246a0 6c 31 20 2a 20 74 61 62 30 2e 63 6f 6c 30 20 2d  l1 * tab0.col0 -
246b0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
246c0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
246d0 0a 32 30 33 31 0d 0a 33 33 39 34 0d 0a 38 30 31  .2031..3394..801
246e0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
246f0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
24700 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 41   col1 + + col0 A
24710 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
24720 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a 33 38 0d  ..----..137..38.
24730 0a 39 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .96....onlyif my
24740 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
24750 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
24760 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
24770 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
24780 65 6c 2d 31 30 39 33 0d 0a 53 45 4c 45 43 54 20  el-1093..SELECT 
24790 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 44 49  DISTINCT col2 DI
247a0 56 20 2b 20 74 61 62 31 2e 63 6f 6c 31 20 46 52  V + tab1.col1 FR
247b0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
247c0 0d 0a 35 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66  ..5..7....skipif
247d0 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
247e0 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
247f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24800 30 39 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  093..SELECT DIST
24810 49 4e 43 54 20 63 6f 6c 32 20 2f 20 2b 20 74 61  INCT col2 / + ta
24820 62 31 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b1.col1 FROM tab
24830 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35 0d 0a 37  1..----..2..5..7
24840 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
24850 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
24860 6c 30 20 2b 20 63 6f 6c 31 20 2b 20 63 6f 6c 30  l0 + col1 + col0
24870 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20   * col1 AS col2 
24880 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
24890 0a 31 30 37 0d 0a 31 31 33 33 0d 0a 37 31 34 0d  .107..1133..714.
248a0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
248b0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
248c0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
248d0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
248e0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
248f0 30 39 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  095..SELECT DIST
24900 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f  INCT col2 DIV co
24910 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l0 AS col0 FROM 
24920 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  tab0..----..0..1
24930 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
24940 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
24950 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
24960 72 74 20 6c 61 62 65 6c 2d 31 30 39 35 0d 0a 53  rt label-1095..S
24970 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
24980 6f 6c 32 20 2f 20 63 6f 6c 30 20 41 53 20 63 6f  ol2 / col0 AS co
24990 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
249a0 2d 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 6f 6e 6c 79  --..0..1....only
249b0 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44  if mysql # use D
249c0 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20  IV operator for 
249d0 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e  integer division
249e0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
249f0 74 20 6c 61 62 65 6c 2d 31 30 39 36 0d 0a 53 45  t label-1096..SE
24a00 4c 45 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 31  LECT + tab1.col1
24a10 20 44 49 56 20 74 61 62 31 2e 63 6f 6c 32 20 46   DIV tab1.col2 F
24a20 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
24a30 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
24a40 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
24a50 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
24a60 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24a70 31 30 39 36 0d 0a 53 45 4c 45 43 54 20 2b 20 74  1096..SELECT + t
24a80 61 62 31 2e 63 6f 6c 31 20 2f 20 74 61 62 31 2e  ab1.col1 / tab1.
24a90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
24aa0 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d  ----..0..0..0...
24ab0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
24ac0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
24ad0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
24ae0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
24af0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
24b00 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
24b10 54 20 44 49 53 54 49 4e 43 54 20 2d 20 74 61 62  T DISTINCT - tab
24b20 32 2e 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  2.col0 + + col1 
24b30 2a 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  * col2 + + col1 
24b40 2a 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  * + col1 col2 FR
24b50 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
24b60 37 39 31 0d 0a 34 39 33 37 0d 0a 38 35 36 0d 0a  791..4937..856..
24b70 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
24b80 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
24b90 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
24ba0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
24bb0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30  rowsort label-10
24bc0 39 38 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  98..SELECT DISTI
24bd0 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c  NCT col2 DIV col
24be0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
24bf0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  ab1..----..0..1.
24c00 0a 31 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .18....skipif my
24c10 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
24c20 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
24c30 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 30 39 38  wsort label-1098
24c40 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
24c50 54 20 63 6f 6c 32 20 2f 20 63 6f 6c 30 20 41 53  T col2 / col0 AS
24c60 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
24c70 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38 0d  .----..0..1..18.
24c80 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77  ...query III row
24c90 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
24ca0 20 2a 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45   * FROM tab2 WHE
24cb0 52 45 20 2b 20 63 6f 6c 31 20 42 45 54 57 45 45  RE + col1 BETWEE
24cc0 4e 20 63 6f 6c 32 20 41 4e 44 20 4e 55 4c 4c 0d  N col2 AND NULL.
24cd0 0a 2d 2d 2d 2d 0d 0a 0d 0a 73 6b 69 70 69 66 20  .----....skipif 
24ce0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
24cf0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
24d00 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
24d10 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
24d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
24d30 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30  t..SELECT + tab0
24d40 2e 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c  .col2 * col0 col
24d50 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
24d60 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d 0a 37 39 32  -..35..7298..792
24d70 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24d80 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
24d90 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
24da0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
24db0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24dc0 31 31 30 31 0d 0a 53 45 4c 45 43 54 20 44 49 53  1101..SELECT DIS
24dd0 54 49 4e 43 54 20 63 6f 6c 32 20 44 49 56 20 2b  TINCT col2 DIV +
24de0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52   col1 AS col2 FR
24df0 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
24e00 0d 0a 35 0d 0a 37 0d 0a 0d 0a 73 6b 69 70 69 66  ..5..7....skipif
24e10 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
24e20 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
24e30 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
24e40 31 30 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  101..SELECT DIST
24e50 49 4e 43 54 20 63 6f 6c 32 20 2f 20 2b 20 63 6f  INCT col2 / + co
24e60 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l1 AS col2 FROM 
24e70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 35  tab1..----..2..5
24e80 0d 0a 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..7....onlyif my
24e90 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
24ea0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
24eb0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
24ec0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
24ed0 65 6c 2d 31 31 30 32 0d 0a 53 45 4c 45 43 54 20  el-1102..SELECT 
24ee0 41 4c 4c 20 2d 20 63 6f 6c 30 20 44 49 56 20 2d  ALL - col0 DIV -
24ef0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d   col2 FROM tab1.
24f00 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a  .----..0..0..1..
24f10 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
24f20 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
24f30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
24f40 20 6c 61 62 65 6c 2d 31 31 30 32 0d 0a 53 45 4c   label-1102..SEL
24f50 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2f  ECT ALL - col0 /
24f60 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
24f70 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31  1..----..0..0..1
24f80 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
24f90 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
24fa0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
24fb0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
24fc0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
24fd0 31 31 30 33 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1103..SELECT col
24fe0 32 20 44 49 56 20 63 6f 6c 30 20 46 52 4f 4d 20  2 DIV col0 FROM 
24ff0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  tab2..----..0..0
25000 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..3....skipif my
25010 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
25020 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
25030 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 33  wsort label-1103
25040 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20  ..SELECT col2 / 
25050 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
25060 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 33 0d 0a 0d  ----..0..0..3...
25070 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
25080 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
25090 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
250a0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
250b0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30  owsort label-110
250c0 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  4..SELECT ALL co
250d0 6c 30 20 44 49 56 20 2d 20 74 61 62 30 2e 63 6f  l0 DIV - tab0.co
250e0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
250f0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
25100 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
25110 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
25120 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25130 62 65 6c 2d 31 31 30 34 0d 0a 53 45 4c 45 43 54  bel-1104..SELECT
25140 20 41 4c 4c 20 63 6f 6c 30 20 2f 20 2d 20 74 61   ALL col0 / - ta
25150 62 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  b0.col1 FROM tab
25160 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
25170 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f  ....query III ro
25180 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20  wsort..SELECT * 
25190 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20  FROM tab2 WHERE 
251a0 63 6f 6c 32 20 3d 20 4e 55 4c 4c 20 41 4e 44 20  col2 = NULL AND 
251b0 4e 55 4c 4c 20 3c 3e 20 63 6f 6c 32 20 2a 20 2b  NULL <> col2 * +
251c0 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 0d 0a   col1 + + col1..
251d0 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ----....onlyif m
251e0 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
251f0 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
25200 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
25210 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
25220 62 65 6c 2d 31 31 30 36 0d 0a 53 45 4c 45 43 54  bel-1106..SELECT
25230 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f 6c 30   col1 DIV + col0
25240 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
25250 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  r0..----..0..0..
25260 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
25270 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
25280 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
25290 6f 72 74 20 6c 61 62 65 6c 2d 31 31 30 36 0d 0a  ort label-1106..
252a0 53 45 4c 45 43 54 20 63 6f 6c 31 20 2f 20 2b 20  SELECT col1 / + 
252b0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
252c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
252d0 0a 30 0d 0a 34 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..4....query I
252e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
252f0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 2d   + cor0.col1 + -
25300 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
25310 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
25320 0a 2d 2d 2d 2d 0d 0a 2d 32 31 0d 0a 33 33 0d 0a  .----..-21..33..
25330 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
25340 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63  sort..SELECT + c
25350 6f 6c 32 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63  ol2 + col0 * + c
25360 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
25370 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39   cor0..----..209
25380 37 0d 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d  7..3396..8181...
25390 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
253a0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
253b0 54 20 38 34 20 41 53 20 63 6f 6c 31 20 46 52 4f  T 84 AS col1 FRO
253c0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 34  M tab0..----..84
253d0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
253e0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
253f0 49 4e 43 54 20 2d 20 31 30 20 41 53 20 63 6f 6c  INCT - 10 AS col
25400 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
25410 2d 0d 0a 2d 31 30 0d 0a 0d 0a 71 75 65 72 79 20  -..-10....query 
25420 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
25430 54 20 36 34 20 2b 20 63 6f 6c 30 20 41 53 20 63  T 64 + col0 AS c
25440 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
25450 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 34 34 0d 0a 36  ---..128..144..6
25460 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
25470 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28  sort..SELECT - (
25480 20 63 6f 6c 30 20 29 20 2b 20 63 6f 6c 31 20 41   col0 ) + col1 A
25490 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
254a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 0d 0a 2d 36 32  ..----..-19..-62
254b0 0d 0a 32 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..24....query I 
254c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
254d0 44 49 53 54 49 4e 43 54 20 31 20 41 53 20 63 6f  DISTINCT 1 AS co
254e0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
254f0 2d 2d 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20  --..1....skipif 
25500 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
25510 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
25520 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
25530 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
25540 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25550 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
25560 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f 4d 20   col2 col0 FROM 
25570 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25580 2d 2d 0d 0a 31 30 38 0d 0a 31 31 34 0d 0a 31 39  --..108..114..19
25590 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  2....onlyif mysq
255a0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
255b0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
255c0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
255d0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
255e0 2d 31 31 31 35 0d 0a 53 45 4c 45 43 54 20 41 4c  -1115..SELECT AL
255f0 4c 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 38 30  L cor0.col2 + 80
25600 20 44 49 56 20 2d 20 63 6f 6c 30 20 41 53 20 63   DIV - col0 AS c
25610 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
25620 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 33 30  r0..----..-1..30
25630 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  ..82....skipif m
25640 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
25650 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
25660 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 31  owsort label-111
25670 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  5..SELECT ALL co
25680 72 30 2e 63 6f 6c 32 20 2b 20 38 30 20 2f 20 2d  r0.col2 + 80 / -
25690 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
256a0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
256b0 2d 2d 0d 0a 2d 31 0d 0a 33 30 0d 0a 38 32 0d 0a  --..-1..30..82..
256c0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
256d0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
256e0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
256f0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
25700 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
25710 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
25720 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 31  CT DISTINCT col1
25730 20 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f   + col1 col1 FRO
25740 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
25750 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 36 0d 0a 35 32  ----..20..26..52
25760 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
25770 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  ort..SELECT + co
25780 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a  r0.col1 + col0 *
25790 20 38 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   82 AS col0 FROM
257a0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
257b0 2d 2d 2d 0d 0a 32 30 35 34 0d 0a 32 39 36 37 0d  ---..2054..2967.
257c0 0a 37 33 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  .7389....query I
257d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
257e0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a   DISTINCT col0 *
257f0 20 2b 20 63 6f 6c 32 20 2a 20 39 36 20 2b 20 63   + col2 * 96 + c
25800 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol1 AS col1 FROM
25810 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
25820 2d 2d 2d 0d 0a 31 38 31 37 35 0d 0a 31 39 34 37  ---..18175..1947
25830 34 37 0d 0a 32 38 38 32 30 39 0d 0a 0d 0a 71 75  47..288209....qu
25840 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25850 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32  ELECT ALL - col2
25860 20 2a 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2d   * + cor0.col0 -
25870 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
25880 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32  cor0..----..-132
25890 0d 0a 2d 37 33 38 39 0d 0a 2d 38 37 38 0d 0a 0d  ..-7389..-878...
258a0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
258b0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20  ..SELECT - col0 
258c0 2a 20 33 34 20 2a 20 2d 20 63 6f 6c 30 20 41 53  * 34 * - col0 AS
258d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
258e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
258f0 33 39 32 36 34 0d 0a 32 31 37 36 30 30 0d 0a 33  39264..217600..3
25900 30 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  06....query I ro
25910 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
25920 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  L - col0 * col1 
25930 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20  - + col1 * col2 
25940 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
25950 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 35 35 36 31 0d  0..----..-15561.
25960 0a 2d 33 34 39 32 0d 0a 2d 34 39 30 32 0d 0a 0d  .-3492..-4902...
25970 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
25980 0d 0a 53 45 4c 45 43 54 20 39 38 20 2a 20 74 61  ..SELECT 98 * ta
25990 62 30 2e 63 6f 6c 30 20 2d 20 2d 20 63 6f 72 30  b0.col0 - - cor0
259a0 2e 63 6f 6c 32 20 2a 20 2b 20 37 34 20 46 52 4f  .col2 * + 74 FRO
259b0 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
259c0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
259d0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
259e0 61 66 33 61 63 66 65 35 39 65 61 37 36 65 30 38  af3acfe59ea76e08
259f0 35 38 39 32 61 63 65 30 66 37 38 32 31 39 66 63  5892ace0f78219fc
25a00 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
25a10 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
25a20 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
25a30 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
25a40 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
25a50 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 32  owsort label-112
25a60 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30  3..SELECT - cor0
25a70 2e 63 6f 6c 32 20 2a 20 2b 20 43 41 53 54 28 20  .col2 * + CAST( 
25a80 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
25a90 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
25aa0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
25ab0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b  NULL..NULL....sk
25ac0 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
25ad0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
25ae0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25af0 65 6c 2d 31 31 32 33 0d 0a 53 45 4c 45 43 54 20  el-1123..SELECT 
25b00 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 2b 20  - cor0.col2 * + 
25b10 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49  CAST ( NULL AS I
25b20 4e 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61  NTEGER ) FROM ta
25b30 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
25b40 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
25b50 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
25b60 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
25b70 4c 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 31 20  L col0 * - col1 
25b80 2b 20 28 20 63 6f 6c 31 20 29 20 46 52 4f 4d 20  + ( col1 ) FROM 
25b90 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
25ba0 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32 0d 0a  --..-1027..-52..
25bb0 2d 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -630....query I 
25bc0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
25bd0 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2d 20 63  ALL + col0 + - c
25be0 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
25bf0 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  b1 cor0..----..-
25c00 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75  16..-51..7....qu
25c10 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
25c20 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2d  ELECT - col1 + -
25c30 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
25c40 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
25c50 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 39 0d  cor0..----..-29.
25c60 0a 2d 37 34 0d 0a 2d 39 33 0d 0a 0d 0a 6f 6e 6c  .-74..-93....onl
25c70 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
25c80 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
25c90 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
25ca0 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
25cb0 72 74 20 6c 61 62 65 6c 2d 31 31 32 37 0d 0a 53  rt label-1127..S
25cc0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
25cd0 20 2d 20 63 6f 6c 31 20 44 49 56 20 28 20 2d 20   - col1 DIV ( - 
25ce0 63 6f 6c 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d  col2 ) col1 FROM
25cf0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
25d00 2d 2d 2d 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66  ---..0....skipif
25d10 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
25d20 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
25d30 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
25d40 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
25d50 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  s..skipif mysql 
25d60 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
25d70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
25d80 74 20 6c 61 62 65 6c 2d 31 31 32 37 0d 0a 53 45  t label-1127..SE
25d90 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
25da0 2d 20 63 6f 6c 31 20 2f 20 28 20 2d 20 63 6f 6c  - col1 / ( - col
25db0 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  2 ) col1 FROM ta
25dc0 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
25dd0 0d 0a 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  ..0....onlyif my
25de0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
25df0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
25e00 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
25e10 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25e20 65 6c 2d 31 31 32 38 0d 0a 53 45 4c 45 43 54 20  el-1128..SELECT 
25e30 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
25e40 30 20 2b 20 39 33 20 44 49 56 20 63 6f 6c 32 20  0 + 93 DIV col2 
25e50 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
25e60 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
25e70 0a 34 0d 0a 36 35 0d 0a 38 30 0d 0a 0d 0a 73 6b  .4..65..80....sk
25e80 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
25e90 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
25ea0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
25eb0 65 6c 2d 31 31 32 38 0d 0a 53 45 4c 45 43 54 20  el-1128..SELECT 
25ec0 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 63 6f 6c  DISTINCT + + col
25ed0 30 20 2b 20 39 33 20 2f 20 63 6f 6c 32 20 41 53  0 + 93 / col2 AS
25ee0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20   col1 FROM tab1 
25ef0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34  AS cor0..----..4
25f00 0d 0a 36 35 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79  ..65..80....only
25f10 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
25f20 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
25f30 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
25f40 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
25f50 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
25f60 61 62 65 6c 2d 31 31 32 39 0d 0a 53 45 4c 45 43  abel-1129..SELEC
25f70 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20 2a 20 2d  T ALL - col2 * -
25f80 20 28 20 33 35 20 2a 20 63 6f 6c 31 20 29 20 2b   ( 35 * col1 ) +
25f90 20 43 41 53 54 28 20 63 6f 72 30 2e 63 6f 6c 30   CAST( cor0.col0
25fa0 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2b   AS SIGNED ) * +
25fb0 20 63 6f 6c 30 20 2a 20 28 20 2b 20 63 6f 72 30   col0 * ( + cor0
25fc0 2e 63 6f 6c 32 20 29 20 46 52 4f 4d 20 74 61 62  .col2 ) FROM tab
25fd0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
25fe0 0a 32 31 31 38 37 34 0d 0a 32 35 39 37 36 38 0d  .211874..259768.
25ff0 0a 33 30 36 31 38 0d 0a 0d 0a 73 6b 69 70 69 66  .30618....skipif
26000 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
26010 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
26020 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26030 31 32 39 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  129..SELECT ALL 
26040 2d 20 63 6f 6c 32 20 2a 20 2d 20 28 20 33 35 20  - col2 * - ( 35 
26050 2a 20 63 6f 6c 31 20 29 20 2b 20 43 41 53 54 20  * col1 ) + CAST 
26060 28 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 49  ( cor0.col0 AS I
26070 4e 54 45 47 45 52 20 29 20 2a 20 2b 20 63 6f 6c  NTEGER ) * + col
26080 30 20 2a 20 28 20 2b 20 63 6f 72 30 2e 63 6f 6c  0 * ( + cor0.col
26090 32 20 29 20 46 52 4f 4d 20 74 61 62 32 20 41 53  2 ) FROM tab2 AS
260a0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 31   cor0..----..211
260b0 38 37 34 0d 0a 32 35 39 37 36 38 0d 0a 33 30 36  874..259768..306
260c0 31 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  18....query I ro
260d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
260e0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2a 20 63 6f  STINCT col0 * co
260f0 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 + + col2 FROM
26100 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
26110 2d 2d 2d 0d 0a 31 31 33 36 0d 0a 31 33 32 0d 0a  ---..1136..132..
26120 36 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  697....query I r
26130 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
26140 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2b 20 2b  ISTINCT col1 + +
26150 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63   cor0.col1 * + c
26160 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
26170 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
26180 2d 2d 2d 0d 0a 31 35 39 33 0d 0a 36 36 33 0d 0a  ---..1593..663..
26190 38 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  868....onlyif my
261a0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
261b0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
261c0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
261d0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
261e0 65 6c 2d 31 31 33 32 0d 0a 53 45 4c 45 43 54 20  el-1132..SELECT 
261f0 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 72 30 2e  DISTINCT + cor0.
26200 63 6f 6c 30 20 44 49 56 20 63 6f 6c 31 20 46 52  col0 DIV col1 FR
26210 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
26220 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34 0d 0a  .----..0..1..4..
26230 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
26240 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
26250 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26260 20 6c 61 62 65 6c 2d 31 31 33 32 0d 0a 53 45 4c   label-1132..SEL
26270 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
26280 6f 72 30 2e 63 6f 6c 30 20 2f 20 63 6f 6c 31 20  or0.col0 / col1 
26290 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
262a0 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 34  0..----..0..1..4
262b0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
262c0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
262d0 2d 20 74 61 62 32 2e 63 6f 6c 31 20 2a 20 63 6f  - tab2.col1 * co
262e0 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l1 AS col0 FROM 
262f0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 38 39  tab2..----..-289
26300 0d 0a 2d 33 34 38 31 0d 0a 2d 39 36 31 0d 0a 0d  ..-3481..-961...
26310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26320 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20  ..SELECT col0 + 
26330 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  + col1 * col2 + 
26340 2b 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f 4d  + tab1.col0 FROM
26350 20 74 61 62 31 20 57 48 45 52 45 20 4e 55 4c 4c   tab1 WHERE NULL
26360 20 49 4e 20 28 20 2b 20 74 61 62 31 2e 63 6f 6c   IN ( + tab1.col
26370 31 20 2a 20 2b 20 63 6f 6c 30 20 2b 20 74 61 62  1 * + col0 + tab
26380 31 2e 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  1.col1 )..----..
26390 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
263a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52  ort..SELECT * FR
263b0 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e 4f  OM tab2 WHERE NO
263c0 54 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20  T NULL NOT IN ( 
263d0 63 6f 6c 31 20 2d 20 2d 20 63 6f 6c 32 20 29 0d  col1 - - col2 ).
263e0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
263f0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26400 20 41 4c 4c 20 2b 20 74 61 62 31 2e 63 6f 6c 30   ALL + tab1.col0
26410 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
26420 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 0d  ab1..----..-162.
26430 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d 0a 0d  .-3648..-7680...
26440 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26450 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b 20  ..SELECT col1 + 
26460 2d 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  - col0 + - col1 
26470 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
26480 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d 37 39 0d 0a 0d  .-7..-78..-79...
26490 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
264a0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
264b0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
264c0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
264d0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
264e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
264f0 54 20 41 4c 4c 20 74 61 62 31 2e 63 6f 6c 31 20  T ALL tab1.col1 
26500 2b 20 74 61 62 31 2e 63 6f 6c 32 20 63 6f 6c 31  + tab1.col2 col1
26510 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
26520 0d 0a 31 30 39 0d 0a 36 37 0d 0a 38 30 0d 0a 0d  ..109..67..80...
26530 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26540 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20  ..SELECT + col1 
26550 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61  * - col0 FROM ta
26560 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  b1..----..-1040.
26570 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  .-640..-78....qu
26580 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26590 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 32  ELECT ALL + col2
265a0 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   + - col2 AS col
265b0 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  1 FROM tab2..---
265c0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
265d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
265e0 45 4c 45 43 54 20 74 61 62 31 2e 63 6f 6c 30 20  ELECT tab1.col0 
265f0 2b 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20 74 61  + tab1.col1 * ta
26600 62 31 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20  b1.col0 AS col2 
26610 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
26620 0a 31 31 32 30 0d 0a 37 30 34 0d 0a 38 31 0d 0a  .1120..704..81..
26630 0d 0a 71 75 65 72 79 20 49 49 49 20 72 6f 77 73  ..query III rows
26640 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
26650 49 4e 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30  INCT * FROM tab0
26660 20 57 48 45 52 45 20 4e 4f 54 20 4e 55 4c 4c 20   WHERE NOT NULL 
26670 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  > NULL..----....
26680 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26690 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
266a0 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63   col1 + col1 * c
266b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol1 FROM tab0..-
266c0 2d 2d 2d 0d 0a 31 38 32 0d 0a 35 33 33 32 0d 0a  ---..182..5332..
266d0 36 30 31 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6014....query I 
266e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
266f0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53  + col0 * col2 AS
26700 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
26710 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39 38 0d  .----..35..7298.
26720 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .792....query I 
26730 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
26740 63 6f 6c 31 20 2a 20 2b 20 74 61 62 32 2e 63 6f  col1 * + tab2.co
26750 6c 31 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  l1 + col1 * col2
26760 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
26770 0d 0a 31 37 39 38 0d 0a 35 30 31 35 0d 0a 39 33  ..1798..5015..93
26780 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  5....onlyif mysq
26790 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
267a0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
267b0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
267c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
267d0 2d 31 31 34 36 0d 0a 53 45 4c 45 43 54 20 63 6f  -1146..SELECT co
267e0 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56 20  l0 + - col2 DIV 
267f0 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  + col2 FROM tab1
26800 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 36 33 0d 0a 37  ..----..2..63..7
26810 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  9....skipif mysq
26820 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
26830 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
26840 6f 72 74 20 6c 61 62 65 6c 2d 31 31 34 36 0d 0a  ort label-1146..
26850 53 45 4c 45 43 54 20 63 6f 6c 30 20 2b 20 2d 20  SELECT col0 + - 
26860 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 32 20 46 52  col2 / + col2 FR
26870 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32  OM tab1..----..2
26880 0d 0a 36 33 0d 0a 37 39 0d 0a 0d 0a 71 75 65 72  ..63..79....quer
26890 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
268a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
268b0 32 20 2a 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  2 * col2 * - col
268c0 30 20 2b 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  0 + - col2 AS co
268d0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
268e0 2d 2d 0d 0a 2d 31 31 34 31 31 34 0d 0a 2d 35 31  --..-114114..-51
268f0 33 30 0d 0a 2d 35 32 37 35 34 0d 0a 0d 0a 71 75  30..-52754....qu
26900 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
26910 45 4c 45 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c  ELECT - tab2.col
26920 31 20 2a 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  1 * col0 + + col
26930 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
26940 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 36 34  ab2..----..-1264
26950 0d 0a 2d 32 31 30 0d 0a 2d 34 35 32 34 0d 0a 0d  ..-210..-4524...
26960 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
26970 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
26980 6f 6c 30 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f  ol0 * col2 AS co
26990 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l0 FROM tab0..--
269a0 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37 32 39 38 0d 0a  --..-35..-7298..
269b0 2d 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -792....query I 
269c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
269d0 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20  + col0 * - col2 
269e0 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  * + col1 AS col1
269f0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
26a00 0d 0a 2d 31 31 39 36 35 32 0d 0a 2d 35 31 30 33  ..-119652..-5103
26a10 34 0d 0a 2d 35 38 35 39 0d 0a 0d 0a 71 75 65 72  4..-5859....quer
26a20 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
26a30 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
26a40 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48  ol0 FROM tab1 WH
26a50 45 52 45 20 4e 4f 54 20 63 6f 6c 31 20 4e 4f 54  ERE NOT col1 NOT
26a60 20 42 45 54 57 45 45 4e 20 4e 55 4c 4c 20 41 4e   BETWEEN NULL AN
26a70 44 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  D NULL..----....
26a80 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
26a90 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
26aa0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
26ab0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
26ac0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
26ad0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
26ae0 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b 20 2b 20   ALL + col0 + + 
26af0 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col1 col0 FROM t
26b00 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 33 37 0d 0a  ab2..----..137..
26b10 33 38 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20  38..96....query 
26b20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
26b30 54 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 30 20  T col2 * + col0 
26b40 2a 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32  * + col2 AS col2
26b50 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
26b60 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 36 31 33 36 0d  r0..----..26136.
26b70 0a 33 35 0d 0a 35 39 38 34 33 36 0d 0a 0d 0a 6f  .35..598436....o
26b80 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75  nlyif mysql # su
26b90 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20  pport for MySQL 
26ba0 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20  specific system 
26bb0 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78  types and syntax
26bc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
26bd0 74 20 6c 61 62 65 6c 2d 31 31 35 34 0d 0a 53 45  t label-1154..SE
26be0 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63  LECT ALL - ( + c
26bf0 6f 6c 32 20 29 20 2a 20 2b 20 43 41 53 54 28 20  ol2 ) * + CAST( 
26c00 4e 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20  NULL AS DECIMAL 
26c10 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  ) FROM tab0 cor0
26c20 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..----..NULL..NU
26c30 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70  LL..NULL....skip
26c40 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
26c50 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
26c60 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
26c70 2d 31 31 35 34 0d 0a 53 45 4c 45 43 54 20 41 4c  -1154..SELECT AL
26c80 4c 20 2d 20 28 20 2b 20 63 6f 6c 32 20 29 20 2a  L - ( + col2 ) *
26c90 20 2b 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   + CAST ( NULL A
26ca0 53 20 52 45 41 4c 20 29 20 46 52 4f 4d 20 74 61  S REAL ) FROM ta
26cb0 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e  b0 cor0..----..N
26cc0 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ULL..NULL..NULL.
26cd0 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
26ce0 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
26cf0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
26d00 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
26d10 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
26d20 31 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  155..SELECT ALL 
26d30 2b 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c  + col2 DIV - col
26d40 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
26d50 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d  or0..----..-2..-
26d60 35 0d 0a 2d 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  5..-7....skipif 
26d70 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
26d80 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
26d90 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31  rowsort label-11
26da0 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  55..SELECT ALL +
26db0 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 46   col2 / - col1 F
26dc0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
26dd0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 0d 0a 2d 35 0d 0a  ..----..-2..-5..
26de0 2d 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  -7....skipif pos
26df0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
26e00 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
26e10 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
26e20 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
26e30 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
26e40 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
26e50 30 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63  0 * - col2 + - c
26e60 6f 6c 32 20 2a 20 63 6f 6c 30 20 63 6f 6c 32 20  ol2 * col0 col2 
26e70 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
26e80 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30  0..----..0..0..0
26e90 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
26ea0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
26eb0 49 4e 43 54 20 2d 20 39 37 20 2d 20 2b 20 63 6f  INCT - 97 - + co
26ec0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
26ed0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 37  cor0..----..-107
26ee0 0d 0a 2d 31 31 30 0d 0a 2d 31 32 33 0d 0a 0d 0a  ..-110..-123....
26ef0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26f00 0a 53 45 4c 45 43 54 20 2d 20 2d 20 34 39 20 2a  .SELECT - - 49 *
26f10 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   + col1 FROM tab
26f20 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
26f30 0a 31 32 37 34 0d 0a 34 39 30 0d 0a 36 33 37 0d  .1274..490..637.
26f40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
26f50 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
26f60 4e 43 54 20 32 38 20 2a 20 2b 20 63 6f 72 30 2e  NCT 28 * + cor0.
26f70 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41  col2 FROM tab2 A
26f80 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
26f90 36 34 0d 0a 37 32 38 0d 0a 37 35 36 0d 0a 0d 0a  64..728..756....
26fa0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
26fb0 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2d  .SELECT col1 * -
26fc0 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52   col1 AS col0 FR
26fd0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
26fe0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d 0a 2d 31 36  .----..-100..-16
26ff0 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 71 75 65 72 79  9..-676....query
27000 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27010 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT + col0 * + co
27020 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 57 48 45  l0 FROM tab1 WHE
27030 52 45 20 28 20 4e 55 4c 4c 20 29 20 3e 20 63 6f  RE ( NULL ) > co
27040 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  l0 + col1 * + co
27050 6c 32 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72  l2..----....quer
27060 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27070 45 43 54 20 63 6f 6c 30 20 2d 20 2d 20 74 61 62  ECT col0 - - tab
27080 30 2e 63 6f 6c 30 20 2a 20 2d 20 74 61 62 30 2e  0.col0 * - tab0.
27090 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
270a0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab0..----..-1
270b0 31 39 30 0d 0a 2d 35 35 32 0d 0a 2d 37 38 33 32  190..-552..-7832
270c0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
270d0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
270e0 49 4e 43 54 20 74 61 62 31 2e 63 6f 6c 32 20 2a  INCT tab1.col2 *
270f0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
27100 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36  1..----..162..36
27110 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72  48..7680....quer
27120 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27130 45 43 54 20 41 4c 4c 20 2b 20 2d 20 35 37 20 2d  ECT ALL + - 57 -
27140 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20   + col0 AS col1 
27150 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
27160 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d  0..----..-121..-
27170 31 33 37 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65 72  137..-60....quer
27180 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
27190 45 43 54 20 35 20 46 52 4f 4d 20 74 61 62 30 20  ECT 5 FROM tab0 
271a0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 0d 0a 35  cor0..----..5..5
271b0 0d 0a 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..5....skipif po
271c0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
271d0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
271e0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
271f0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
27200 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
27210 0a 53 45 4c 45 43 54 20 2d 20 74 61 62 30 2e 63  .SELECT - tab0.c
27220 6f 6c 32 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 63  ol2 + - col0 * c
27230 6f 6c 31 20 2a 20 63 6f 6c 32 20 63 6f 6c 31 20  ol1 * col2 col1 
27240 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
27250 0a 2d 33 33 39 36 0d 0a 2d 36 36 34 32 30 30 0d  .-3396..-664200.
27260 0a 2d 36 38 31 34 35 0d 0a 0d 0a 71 75 65 72 79  .-68145....query
27270 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27280 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 41 53 20  CT tab2.col0 AS 
27290 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
272a0 2d 2d 2d 2d 0d 0a 37 0d 0a 37 38 0d 0a 37 39 0d  ----..7..78..79.
272b0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
272c0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
272d0 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63  NCT - col1 + + c
272e0 6f 6c 30 20 2a 20 2b 20 63 6f 6c 30 20 2a 20 2d  ol0 * + col0 * -
272f0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
27300 0a 2d 2d 2d 2d 0d 0a 2d 31 31 38 39 32 32 0d 0a  .----..-118922..
27310 2d 34 39 36 32 32 0d 0a 2d 37 32 30 39 30 32 0d  -49622..-720902.
27320 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
27330 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
27340 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2b 20 63   col1 * col1 + c
27350 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 2b  ol2 * - col2 * +
27360 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d   col0 FROM tab1.
27370 0a 2d 2d 2d 2d 0d 0a 2d 32 30 38 30 33 36 0d 0a  .----..-208036..
27380 2d 37 33 37 34 34 39 0d 0a 2d 39 34 32 34 0d 0a  -737449..-9424..
27390 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
273a0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f  t..SELECT ALL co
273b0 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63 6f  l0 * col2 + - co
273c0 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
273d0 2d 2d 0d 0a 31 35 38 0d 0a 31 39 36 39 0d 0a 32  --..158..1969..2
273e0 39 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  985....query I r
273f0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
27400 4c 4c 20 2d 20 63 6f 6c 31 20 2b 20 38 36 20 46  LL - col1 + 86 F
27410 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
27420 32 37 0d 0a 35 35 0d 0a 36 39 0d 0a 0d 0a 71 75  27..55..69....qu
27430 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27440 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2a  ELECT ALL col2 *
27450 20 2b 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30   + col2 + + col0
27460 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
27470 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 33 0d 0a  b0..----..1113..
27480 33 36 0d 0a 36 38 31 33 0d 0a 0d 0a 71 75 65 72  36..6813....quer
27490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
274a0 45 43 54 20 35 32 20 46 52 4f 4d 20 74 61 62 31  ECT 52 FROM tab1
274b0 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  , tab1 AS cor0..
274c0 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68  ----..9 values h
274d0 61 73 68 69 6e 67 20 74 6f 20 37 66 34 61 65 33  ashing to 7f4ae3
274e0 30 38 39 33 61 62 33 33 30 37 38 34 38 32 39 37  0893ab3307848297
274f0 31 31 30 33 32 61 65 35 39 39 0d 0a 0d 0a 71 75  11032ae599....qu
27500 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27510 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  ELECT + - cor0.c
27520 6f 6c 30 20 2a 20 36 31 20 2d 20 2d 20 63 6f 72  ol0 * 61 - - cor
27530 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  0.col1 FROM tab2
27540 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
27550 2d 33 39 36 0d 0a 2d 34 36 39 39 0d 0a 2d 34 38  -396..-4699..-48
27560 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
27570 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
27580 4c 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 31 20  L + col2 * col1 
27590 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 2d 20  * cor0.col2 - - 
275a0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
275b0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
275c0 2d 2d 2d 2d 0d 0a 31 31 39 39 30 34 0d 0a 33 32  ----..119904..32
275d0 35 34 37 0d 0a 37 35 38 37 30 0d 0a 0d 0a 6f 6e  547..75870....on
275e0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
275f0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
27600 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
27610 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
27620 6f 72 74 20 6c 61 62 65 6c 2d 31 31 37 36 0d 0a  ort label-1176..
27630 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 44 49  SELECT - col1 DI
27640 56 20 2d 20 39 37 20 41 53 20 63 6f 6c 30 20 46  V - 97 AS col0 F
27650 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
27660 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69  0..0..0....skipi
27670 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
27680 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
27690 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
276a0 31 31 37 36 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1176..SELECT - c
276b0 6f 6c 31 20 2f 20 2d 20 39 37 20 41 53 20 63 6f  ol1 / - 97 AS co
276c0 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l0 FROM tab2..--
276d0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
276e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
276f0 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 72 30 2e  SELECT + - cor0.
27700 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
27710 4d 20 74 61 62 31 2c 20 74 61 62 30 2c 20 74 61  M tab1, tab0, ta
27720 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
27730 0d 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68  ..27 values hash
27740 69 6e 67 20 74 6f 20 34 34 66 64 63 64 37 63 64  ing to 44fdcd7cd
27750 36 30 33 33 35 32 64 34 64 31 32 37 38 31 31 64  603352d4d127811d
27760 31 36 34 63 63 31 65 0d 0a 0d 0a 71 75 65 72 79  164cc1e....query
27770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27780 43 54 20 2d 20 31 37 20 2a 20 63 6f 72 30 2e 63  CT - 17 * cor0.c
27790 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
277a0 20 74 61 62 30 2c 20 74 61 62 30 20 41 53 20 63   tab0, tab0 AS c
277b0 6f 72 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72  or0, tab2 AS cor
277c0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
277d0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 66  es hashing to 5f
277e0 37 39 35 35 62 62 64 65 64 63 35 39 32 38 31 39  7955bbdedc592819
277f0 61 36 36 63 65 35 39 62 62 64 35 66 62 63 0d 0a  a66ce59bbd5fbc..
27800 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
27810 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
27820 43 54 20 2d 20 63 6f 6c 32 20 2a 20 36 38 20 2b  CT - col2 * 68 +
27830 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
27840 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
27850 0a 2d 31 37 39 34 0d 0a 2d 31 38 36 33 0d 0a 2d  .-1794..-1863..-
27860 32 36 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2622....query I 
27870 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
27880 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 2b 20 2d  ALL + - col0 + -
27890 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
278a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
278b0 31 30 34 0d 0a 2d 31 31 37 0d 0a 2d 33 34 0d 0a  104..-117..-34..
278c0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
278d0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
278e0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
278f0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
27900 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
27910 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 38 31 0d  sort label-1181.
27920 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72 30 2e 63  .SELECT - cor0.c
27930 6f 6c 30 20 2a 20 43 41 53 54 28 20 4e 55 4c 4c  ol0 * CAST( NULL
27940 20 41 53 20 53 49 47 4e 45 44 20 29 20 2a 20 2d   AS SIGNED ) * -
27950 20 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c   cor0.col2 - col
27960 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
27970 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
27980 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
27990 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
279a0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
279b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
279c0 62 65 6c 2d 31 31 38 31 0d 0a 53 45 4c 45 43 54  bel-1181..SELECT
279d0 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2a 20 43   - cor0.col0 * C
279e0 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e  AST ( NULL AS IN
279f0 54 45 47 45 52 20 29 20 2a 20 2d 20 63 6f 72 30  TEGER ) * - cor0
27a00 2e 63 6f 6c 32 20 2d 20 63 6f 6c 31 20 46 52 4f  .col2 - col1 FRO
27a10 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
27a20 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
27a30 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
27a40 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
27a50 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20  T DISTINCT col2 
27a60 2a 20 2b 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  * + col2 + - col
27a70 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32  1 + col0 AS col2
27a80 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
27a90 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 33 0d 0a  r0..----..2893..
27aa0 33 33 30 33 0d 0a 39 32 38 33 0d 0a 0d 0a 71 75  3303..9283....qu
27ab0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27ac0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b  ELECT DISTINCT +
27ad0 20 63 6f 6c 30 20 2b 20 63 6f 6c 31 20 2a 20 63   col0 + col1 * c
27ae0 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 30  or0.col2 AS col0
27af0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
27b00 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 32 0d 0a 32  r0..----..132..2
27b10 38 36 32 0d 0a 37 35 35 31 0d 0a 0d 0a 6f 6e 6c  862..7551....onl
27b20 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
27b30 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
27b40 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
27b50 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
27b60 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
27b70 6c 61 62 65 6c 2d 31 31 38 34 0d 0a 53 45 4c 45  label-1184..SELE
27b80 43 54 20 2b 20 38 37 20 2b 20 2d 20 28 20 2d 20  CT + 87 + - ( - 
27b90 63 6f 6c 30 20 2b 20 43 41 53 54 28 20 2d 20 63  col0 + CAST( - c
27ba0 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29 20  ol0 AS SIGNED ) 
27bb0 29 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b  ) * col0 * + ( +
27bc0 20 32 37 20 29 20 41 53 20 63 6f 6c 32 20 46 52   27 ) AS col2 FR
27bd0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
27be0 0a 2d 2d 2d 2d 0d 0a 33 31 31 39 31 0d 0a 34 32  .----..31191..42
27bf0 37 38 32 31 0d 0a 36 36 32 33 37 0d 0a 0d 0a 73  7821..66237....s
27c00 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
27c10 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
27c20 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
27c30 62 65 6c 2d 31 31 38 34 0d 0a 53 45 4c 45 43 54  bel-1184..SELECT
27c40 20 2b 20 38 37 20 2b 20 2d 20 28 20 2d 20 63 6f   + 87 + - ( - co
27c50 6c 30 20 2b 20 43 41 53 54 20 28 20 2d 20 63 6f  l0 + CAST ( - co
27c60 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  l0 AS INTEGER ) 
27c70 29 20 2a 20 63 6f 6c 30 20 2a 20 2b 20 28 20 2b  ) * col0 * + ( +
27c80 20 32 37 20 29 20 41 53 20 63 6f 6c 32 20 46 52   27 ) AS col2 FR
27c90 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
27ca0 0a 2d 2d 2d 2d 0d 0a 33 31 31 39 31 0d 0a 34 32  .----..31191..42
27cb0 37 38 32 31 0d 0a 36 36 32 33 37 0d 0a 0d 0a 71  7821..66237....q
27cc0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
27cd0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 31 30 20  SELECT ALL + 10 
27ce0 2b 20 2b 20 36 36 20 41 53 20 63 6f 6c 32 20 46  + + 66 AS col2 F
27cf0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
27d00 0d 0a 2d 2d 2d 2d 0d 0a 37 36 0d 0a 37 36 0d 0a  ..----..76..76..
27d10 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
27d20 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 36 32  wsort..SELECT 62
27d30 20 2a 20 2d 20 33 39 20 2b 20 2d 20 63 6f 6c 30   * - 39 + - col0
27d40 20 2a 20 33 36 20 41 53 20 63 6f 6c 30 20 46 52   * 36 AS col0 FR
27d50 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
27d60 0a 2d 2d 2d 2d 0d 0a 2d 32 36 37 30 0d 0a 2d 35  .----..-2670..-5
27d70 32 32 36 0d 0a 2d 35 32 36 32 0d 0a 0d 0a 71 75  226..-5262....qu
27d80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
27d90 45 4c 45 43 54 20 36 33 20 2a 20 63 6f 6c 30 20  ELECT 63 * col0 
27da0 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32  + + col1 AS col2
27db0 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
27dc0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 37 32 0d 0a 34  r0..----..472..4
27dd0 39 37 33 0d 0a 34 39 39 34 0d 0a 0d 0a 71 75 65  973..4994....que
27de0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
27df0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f  LECT DISTINCT co
27e00 6c 31 20 2a 20 28 20 63 6f 6c 32 20 29 20 2d 20  l1 * ( col2 ) - 
27e10 2b 20 37 30 20 2a 20 2d 20 28 20 2b 20 63 6f 72  + 70 * - ( + cor
27e20 30 2e 63 6f 6c 31 20 29 20 46 52 4f 4d 20 74 61  0.col1 ) FROM ta
27e30 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  b0 cor0..----..1
27e40 33 38 33 32 0d 0a 36 38 38 37 0d 0a 38 38 35 38  3832..6887..8858
27e50 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
27e60 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
27e70 2b 20 63 6f 6c 32 20 2b 20 2b 20 38 34 20 2a 20  + col2 + + 84 * 
27e80 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
27e90 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34  S cor0..----..14
27ea0 36 36 0d 0a 32 36 33 31 0d 0a 34 39 38 32 0d 0a  66..2631..4982..
27eb0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
27ec0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
27ed0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
27ee0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
27ef0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
27f00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
27f10 43 54 20 2d 20 28 20 63 6f 6c 31 20 29 20 2b 20  CT - ( col1 ) + 
27f20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col0 col2 FROM t
27f30 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
27f40 2d 32 0d 0a 2d 36 32 0d 0a 2d 36 32 0d 0a 0d 0a  -2..-62..-62....
27f50 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
27f60 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
27f70 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
27f80 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
27f90 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
27fa0 72 74 20 6c 61 62 65 6c 2d 31 31 39 31 0d 0a 53  rt label-1191..S
27fb0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 43  ELECT DISTINCT C
27fc0 41 53 54 28 20 2d 20 32 34 20 41 53 20 53 49 47  AST( - 24 AS SIG
27fd0 4e 45 44 20 29 20 2b 20 2d 20 63 6f 6c 30 20 2a  NED ) + - col0 *
27fe0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
27ff0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
28000 31 38 36 0d 0a 2d 33 36 37 32 0d 0a 2d 37 37 30  186..-3672..-770
28010 34 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  4....skipif mysq
28020 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
28030 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
28040 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 31 0d 0a  ort label-1191..
28050 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28060 43 41 53 54 20 28 20 2d 20 32 34 20 41 53 20 49  CAST ( - 24 AS I
28070 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f 6c  NTEGER ) + - col
28080 30 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  0 * col2 FROM ta
28090 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
280a0 0d 0a 2d 31 38 36 0d 0a 2d 33 36 37 32 0d 0a 2d  ..-186..-3672..-
280b0 37 37 30 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  7704....query I 
280c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
280d0 44 49 53 54 49 4e 43 54 20 2d 20 35 33 20 41 53  DISTINCT - 53 AS
280e0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
280f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
28100 35 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  53....query I ro
28110 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
28120 53 54 49 4e 43 54 20 2d 20 36 20 2a 20 2b 20 36  STINCT - 6 * + 6
28130 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  2 AS col0 FROM t
28140 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab0 cor0..----..
28150 2d 33 37 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  -372....onlyif m
28160 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
28170 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
28180 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
28190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
281a0 62 65 6c 2d 31 31 39 34 0d 0a 53 45 4c 45 43 54  bel-1194..SELECT
281b0 20 2d 20 63 6f 6c 31 20 44 49 56 20 28 20 2d 20   - col1 DIV ( - 
281c0 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 29 20 2b 20  col0 * col1 ) + 
281d0 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
281e0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
281f0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 36 34 0d  ..----..-3..-64.
28200 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  .-80....skipif m
28210 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
28220 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
28230 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39  owsort label-119
28240 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  4..SELECT - col1
28250 20 2f 20 28 20 2d 20 63 6f 6c 30 20 2a 20 63 6f   / ( - col0 * co
28260 6c 31 20 29 20 2b 20 2d 20 63 6f 6c 30 20 41 53  l1 ) + - col0 AS
28270 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
28280 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
28290 33 0d 0a 2d 36 34 0d 0a 2d 38 30 0d 0a 0d 0a 6f  3..-64..-80....o
282a0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
282b0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
282c0 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
282d0 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
282e0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 31 39 35 0d  sort label-1195.
282f0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2a  .SELECT + col2 *
28300 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 44   col0 + - col2 D
28310 49 56 20 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20  IV col1 AS col2 
28320 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
28330 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
28340 38 0d 0a 37 39 32 0d 0a 0d 0a 73 6b 69 70 69 66  8..792....skipif
28350 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
28360 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
28370 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
28380 31 39 35 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f  195..SELECT + co
28390 6c 32 20 2a 20 63 6f 6c 30 20 2b 20 2d 20 63 6f  l2 * col0 + - co
283a0 6c 32 20 2f 20 63 6f 6c 31 20 41 53 20 63 6f 6c  l2 / col1 AS col
283b0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
283c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37  or0..----..35..7
283d0 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72  298..792....quer
283e0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
283f0 45 43 54 20 63 6f 6c 32 20 2a 20 38 39 20 41 53  ECT col2 * 89 AS
28400 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20   col1 FROM tab2 
28410 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
28420 33 31 34 0d 0a 32 34 30 33 0d 0a 33 33 38 32 0d  314..2403..3382.
28430 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
28440 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 63  rt..SELECT - + c
28450 6f 6c 32 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c  ol2 + col2 + col
28460 32 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30  2 FROM tab2 cor0
28470 0d 0a 2d 2d 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a  ..----..26..27..
28480 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  38....query I ro
28490 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
284a0 2d 20 63 6f 6c 32 20 2b 20 2d 20 31 34 20 41 53  - col2 + - 14 AS
284b0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
284c0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
284d0 31 35 0d 0a 2d 34 37 0d 0a 2d 39 36 0d 0a 0d 0a  15..-47..-96....
284e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
284f0 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 30 20 29  .SELECT ( col0 )
28500 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   + col0 AS col2 
28510 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a  FROM tab2 cor0..
28520 2d 2d 2d 2d 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31  ----..14..156..1
28530 35 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  58....skipif pos
28540 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
28550 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
28560 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
28570 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
28580 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
28590 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20  SELECT ALL col2 
285a0 2b 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52 4f 4d  + col1 col1 FROM
285b0 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
285c0 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
285d0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
285e0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
285f0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   + cor0.col2 * c
28600 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
28610 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33   cor0..----..283
28620 38 0d 0a 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 6f  8..7462..97....o
28630 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
28640 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
28650 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
28660 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
28670 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 30 32 0d  sort label-1202.
28680 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2b 20  .SELECT ALL + + 
28690 36 35 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52  65 DIV - col0 FR
286a0 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
286b0 2d 2d 0d 0a 2d 39 0d 0a 30 0d 0a 30 0d 0a 0d 0a  --..-9..0..0....
286c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
286d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
286e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
286f0 61 62 65 6c 2d 31 32 30 32 0d 0a 53 45 4c 45 43  abel-1202..SELEC
28700 54 20 41 4c 4c 20 2b 20 2b 20 36 35 20 2f 20 2d  T ALL + + 65 / -
28710 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
28720 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 0d 0a  cor0..----..-9..
28730 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..0....query I 
28740 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
28750 44 49 53 54 49 4e 43 54 20 2d 20 39 36 20 46 52  DISTINCT - 96 FR
28760 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
28770 0a 2d 2d 2d 2d 0d 0a 2d 39 36 0d 0a 0d 0a 71 75  .----..-96....qu
28780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28790 45 4c 45 43 54 20 2b 20 36 34 20 2a 20 63 6f 6c  ELECT + 64 * col
287a0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
287b0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
287c0 2d 0d 0a 31 30 38 38 0d 0a 31 39 38 34 0d 0a 33  -..1088..1984..3
287d0 37 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  776....query I r
287e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
287f0 49 53 54 49 4e 43 54 20 38 38 20 46 52 4f 4d 20  ISTINCT 88 FROM 
28800 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 38 38 0d 0a  tab0..----..88..
28810 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28820 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
28830 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30  CT - col0 * cor0
28840 2e 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41 53 20  .col2 + col1 AS 
28850 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
28860 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
28870 35 38 0d 0a 2d 31 39 36 39 0d 0a 2d 32 39 38 35  58..-1969..-2985
28880 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
28890 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
288a0 38 38 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46  88 * cor0.col2 F
288b0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
288c0 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 32 38 38 0d 0a 2d  ..----..-2288..-
288d0 32 33 37 36 0d 0a 2d 33 33 34 34 0d 0a 0d 0a 71  2376..-3344....q
288e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
288f0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
28900 2b 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 46 52  + col0 + col2 FR
28910 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
28920 2d 2d 0d 0a 31 30 34 0d 0a 31 31 37 0d 0a 33 34  --..104..117..34
28930 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
28940 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
28950 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
28960 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
28970 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
28980 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28990 4c 45 43 54 20 2d 20 2d 20 36 20 63 6f 6c 32 20  LECT - - 6 col2 
289a0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
289b0 30 0d 0a 2d 2d 2d 2d 0d 0a 36 0d 0a 36 0d 0a 36  0..----..6..6..6
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 41 4c 4c 20  ort..SELECT ALL 
289e0 31 33 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  13 FROM tab0 AS 
289f0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 0d 0a  cor0..----..13..
28a00 31 33 0d 0a 31 33 0d 0a 0d 0a 6f 6e 6c 79 69 66  13..13....onlyif
28a10 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
28a20 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
28a30 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
28a40 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28a50 6c 61 62 65 6c 2d 31 32 31 31 0d 0a 53 45 4c 45  label-1211..SELE
28a60 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20  CT DISTINCT - + 
28a70 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 44 49  col1 + - col0 DI
28a80 56 20 32 33 20 63 6f 6c 31 20 46 52 4f 4d 20 74  V 23 col1 FROM t
28a90 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
28aa0 2d 0d 0a 2d 31 32 0d 0a 2d 31 36 0d 0a 2d 32 36  -..-12..-16..-26
28ab0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
28ac0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
28ad0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
28ae0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
28af0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b 69  put columns..ski
28b00 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
28b10 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
28b20 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
28b30 6c 2d 31 32 31 31 0d 0a 53 45 4c 45 43 54 20 44  l-1211..SELECT D
28b40 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 31  ISTINCT - + col1
28b50 20 2b 20 2d 20 63 6f 6c 30 20 2f 20 32 33 20 63   + - col0 / 23 c
28b60 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
28b70 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   cor0..----..-12
28b80 0d 0a 2d 31 36 0d 0a 2d 32 36 0d 0a 0d 0a 71 75  ..-16..-26....qu
28b90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28ba0 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
28bb0 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2d   - col0 * col1 -
28bc0 20 2b 20 28 20 28 20 2d 20 63 6f 6c 31 20 29 20   + ( ( - col1 ) 
28bd0 2b 20 28 20 2d 20 63 6f 6c 32 20 29 20 29 20 2a  + ( - col2 ) ) *
28be0 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   - col1 AS col1 
28bf0 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
28c00 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 30 32 0d 0a  0..----..-2002..
28c10 2d 33 30 0d 0a 2d 33 37 37 0d 0a 0d 0a 71 75 65  -30..-377....que
28c20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28c30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
28c40 63 6f 6c 30 20 2d 20 63 6f 6c 31 20 2a 20 31 33  col0 - col1 * 13
28c50 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
28c60 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 30 30 0d 0a  b2..----..-300..
28c70 2d 34 31 30 0d 0a 2d 38 34 35 0d 0a 0d 0a 71 75  -410..-845....qu
28c80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
28c90 45 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 32 20  ELECT cor0.col2 
28ca0 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 30 20  FROM tab1, tab0 
28cb0 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53  AS cor0, tab0 AS
28cc0 20 63 6f 72 31 2c 20 74 61 62 32 20 41 53 20 63   cor1, tab2 AS c
28cd0 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38 31 20 76 61  or2..----..81 va
28ce0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
28cf0 65 39 33 38 37 37 37 65 62 66 66 63 32 65 33 65  e938777ebffc2e3e
28d00 39 63 30 63 64 66 61 61 34 66 37 33 32 63 30 35  9c0cdfaa4f732c05
28d10 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
28d20 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
28d30 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
28d40 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
28d50 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 20 28   col1 * - CAST (
28d60 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   + cor0.col0 AS 
28d70 52 45 41 4c 20 29 20 2d 20 63 6f 6c 31 20 41 53  REAL ) - col1 AS
28d80 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20   col2 FROM tab2 
28d90 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 36  cor0..----..-136
28da0 30 0d 0a 2d 32 34 38 0d 0a 2d 34 36 36 31 0d 0a  0..-248..-4661..
28db0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
28dc0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
28dd0 6c 31 20 2d 20 2b 20 34 39 20 46 52 4f 4d 20 74  l1 - + 49 FROM t
28de0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
28df0 2d 0d 0a 2d 31 30 38 0d 0a 2d 36 36 0d 0a 2d 38  -..-108..-66..-8
28e00 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
28e10 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
28e20 54 49 4e 43 54 20 2b 20 2d 20 36 38 20 41 53 20  TINCT + - 68 AS 
28e30 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 63  col2 FROM tab2 c
28e40 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74  or0 CROSS JOIN t
28e50 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d  ab1 AS cor1..---
28e60 2d 0d 0a 2d 36 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  -..-68....onlyif
28e70 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
28e80 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
28e90 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
28ea0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
28eb0 6c 61 62 65 6c 2d 31 32 31 38 0d 0a 53 45 4c 45  label-1218..SELE
28ec0 43 54 20 2b 20 32 38 20 44 49 56 20 2d 20 63 6f  CT + 28 DIV - co
28ed0 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  l1 + - col0 FROM
28ee0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34   tab0..----..-24
28ef0 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d 0a 73 6b  ..-35..-89....sk
28f00 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
28f10 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
28f20 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
28f30 65 6c 2d 31 32 31 38 0d 0a 53 45 4c 45 43 54 20  el-1218..SELECT 
28f40 2b 20 32 38 20 2f 20 2d 20 63 6f 6c 31 20 2b 20  + 28 / - col1 + 
28f50 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  - col0 FROM tab0
28f60 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35  ..----..-24..-35
28f70 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-89....query I
28f80 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
28f90 20 2b 20 63 6f 6c 32 20 2b 20 31 36 20 2a 20 2b   + col2 + 16 * +
28fa0 20 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20   5 FROM tab2 AS 
28fb0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d  cor0..----..106.
28fc0 0a 31 30 37 0d 0a 31 31 38 0d 0a 0d 0a 71 75 65  .107..118....que
28fd0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
28fe0 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2b 20 2d 20  LECT - col0 + - 
28ff0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
29000 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
29010 2d 2d 2d 2d 0d 0a 2d 32 39 0d 0a 2d 37 34 0d 0a  ----..-29..-74..
29020 2d 39 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  -93....query I r
29030 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
29040 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 32   - col2 * - col2
29050 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
29060 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
29070 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a  ..-2916..-3249..
29080 2d 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -9216....query I
29090 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
290a0 20 63 6f 6c 32 20 2a 20 28 20 63 6f 72 30 2e 63   col2 * ( cor0.c
290b0 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46 52  ol0 ) AS col2 FR
290c0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
290d0 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34 38  .----..162..3648
290e0 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7680....query 
290f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29100 54 20 2d 20 63 6f 72 31 2e 63 6f 6c 32 20 46 52  T - cor1.col2 FR
29110 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 41 53  OM tab2, tab2 AS
29120 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20 63   cor0, tab0 AS c
29130 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
29140 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
29150 36 61 34 33 65 37 66 31 35 31 39 34 61 66 37 33  6a43e7f15194af73
29160 66 65 31 63 38 33 33 38 35 65 36 65 62 65 62 63  fe1c83385e6ebebc
29170 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
29180 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20  ort..SELECT - - 
29190 63 6f 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c  cor0.col2 AS col
291a0 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  1 FROM tab1 AS c
291b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d 0a 35  or0..----..54..5
291c0 37 0d 0a 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49  7..96....query I
291d0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
291e0 20 41 4c 4c 20 38 36 20 46 52 4f 4d 20 74 61 62   ALL 86 FROM tab
291f0 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  2, tab0 AS cor0.
29200 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20  .----..9 values 
29210 68 61 73 68 69 6e 67 20 74 6f 20 32 64 38 63 33  hashing to 2d8c3
29220 61 30 64 31 39 65 61 35 31 34 34 37 66 38 33 63  a0d19ea51447f83c
29230 64 31 38 62 34 39 66 65 65 31 39 0d 0a 0d 0a 73  d18b49fee19....s
29240 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
29250 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
29260 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
29270 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
29280 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
29290 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
292a0 41 4c 4c 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20  ALL col0 * col0 
292b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
292c0 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d  ----..1225..576.
292d0 0a 37 39 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49  .7921....query I
292e0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
292f0 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 31   + col1 * + tab1
29300 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d  .col2 FROM tab1.
29310 0a 2d 2d 2d 2d 0d 0a 31 32 34 38 0d 0a 31 34 30  .----..1248..140
29320 34 0d 0a 35 37 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  4..570....onlyif
29330 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
29340 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
29350 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
29360 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
29370 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
29380 65 6c 2d 31 32 32 38 0d 0a 53 45 4c 45 43 54 20  el-1228..SELECT 
29390 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 41 53 20  + CAST( col0 AS 
293a0 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c 32  SIGNED ) AS col2
293b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
293c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d  r0..----..3..64.
293d0 0a 38 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .80....skipif my
293e0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
293f0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
29400 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 32 38  wsort label-1228
29410 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54 20  ..SELECT + CAST 
29420 28 20 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45  ( col0 AS INTEGE
29430 52 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  R ) AS col2 FROM
29440 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
29450 2d 2d 2d 0d 0a 33 0d 0a 36 34 0d 0a 38 30 0d 0a  ---..3..64..80..
29460 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29470 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
29480 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  cor0.col0 AS col
29490 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61 62  2 FROM tab1, tab
294a0 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 31 20  1 AS cor0, tab1 
294b0 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor1..----..2
294c0 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  7 values hashing
294d0 20 74 6f 20 37 37 38 62 35 30 35 37 35 61 39 62   to 778b50575a9b
294e0 39 31 34 34 38 31 31 39 65 65 30 65 65 31 61 39  91448119ee0ee1a9
294f0 63 34 34 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  c44f....onlyif m
29500 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
29510 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
29520 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
29530 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
29540 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
29550 2d 31 32 33 30 0d 0a 53 45 4c 45 43 54 20 44 49  -1230..SELECT DI
29560 53 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 2b  STINCT - CAST( +
29570 20 63 6f 6c 31 20 41 53 20 53 49 47 4e 45 44 20   col1 AS SIGNED 
29580 29 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ) + col2 FROM ta
29590 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
295a0 0d 0a 32 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a  ..28..47..83....
295b0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
295c0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
295d0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
295e0 61 62 65 6c 2d 31 32 33 30 0d 0a 53 45 4c 45 43  abel-1230..SELEC
295f0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
29600 54 20 28 20 2b 20 63 6f 6c 31 20 41 53 20 49 4e  T ( + col1 AS IN
29610 54 45 47 45 52 20 29 20 2b 20 63 6f 6c 32 20 46  TEGER ) + col2 F
29620 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
29630 0d 0a 2d 2d 2d 2d 0d 0a 32 38 0d 0a 34 37 0d 0a  ..----..28..47..
29640 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  83....query I ro
29650 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
29660 4c 20 2b 20 33 34 20 46 52 4f 4d 20 74 61 62 31  L + 34 FROM tab1
29670 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
29680 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
29690 69 6e 67 20 74 6f 20 31 31 34 36 64 31 35 39 66  ing to 1146d159f
296a0 30 62 39 62 34 33 37 38 61 38 62 37 33 38 62 39  0b9b4378a8b738b9
296b0 36 33 66 37 30 33 39 0d 0a 0d 0a 71 75 65 72 79  63f7039....query
296c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
296d0 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a 20 2b 20  CT ALL col0 * + 
296e0 74 61 62 32 2e 63 6f 6c 30 20 41 53 20 63 6f 6c  tab2.col0 AS col
296f0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
29700 2d 0d 0a 34 39 0d 0a 36 30 38 34 0d 0a 36 32 34  -..49..6084..624
29710 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  1....query I row
29720 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63  sort..SELECT - c
29730 6f 6c 31 20 2a 20 28 20 63 6f 6c 32 20 29 20 46  ol1 * ( col2 ) F
29740 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
29750 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34 30  ---..-1248..-140
29760 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72 79  4..-570....query
29770 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
29780 43 54 20 38 30 20 41 53 20 63 6f 6c 31 20 46 52  CT 80 AS col1 FR
29790 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41 53  OM tab2, tab1 AS
297a0 20 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63   cor0, tab1 AS c
297b0 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61  or1..----..27 va
297c0 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
297d0 36 64 64 35 30 33 38 62 65 37 31 64 66 66 61 38  6dd5038be71dffa8
297e0 32 66 35 63 65 62 61 37 38 37 63 61 61 62 39 31  2f5ceba787caab91
297f0 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49  ....query IIIIII
29800 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
29810 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
29820 62 31 2c 20 74 61 62 30 20 63 6f 72 30 2c 20 74  b1, tab0 cor0, t
29830 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74 61 62  ab2 AS cor1, tab
29840 32 20 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d  2 AS cor2..----.
29850 0a 39 37 32 20 76 61 6c 75 65 73 20 68 61 73 68  .972 values hash
29860 69 6e 67 20 74 6f 20 61 36 39 38 36 39 34 61 37  ing to a698694a7
29870 64 61 63 32 34 35 65 34 32 32 31 32 66 66 30 33  dac245e42212ff03
29880 31 36 62 64 66 34 35 0d 0a 0d 0a 71 75 65 72 79  16bdf45....query
29890 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
298a0 43 54 20 2d 20 34 38 20 2a 20 2d 20 63 6f 6c 30  CT - 48 * - col0
298b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
298c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 0d 0a 33  r0..----..144..3
298d0 30 37 32 0d 0a 33 38 34 30 0d 0a 0d 0a 71 75 65  072..3840....que
298e0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
298f0 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 32 20  LECT ALL - col2 
29900 2a 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20  * + col2 * col2 
29910 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  AS col0 FROM tab
29920 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35  0..----..-1..-35
29930 39 33 37 0d 0a 2d 35 35 31 33 36 38 0d 0a 0d 0a  937..-551368....
29940 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
29950 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 35 30  .SELECT ALL + 50
29960 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
29970 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
29980 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a  , tab2 AS cor1..
29990 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20  ----..27 values 
299a0 68 61 73 68 69 6e 67 20 74 6f 20 33 31 34 61 61  hashing to 314aa
299b0 63 65 34 30 65 37 30 34 63 32 30 61 36 62 65 30  ce40e704c20a6be0
299c0 36 32 30 34 61 33 32 39 66 38 30 0d 0a 0d 0a 73  6204a329f80....s
299d0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
299e0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
299f0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
29a00 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
29a10 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
29a20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29a30 41 4c 4c 20 2d 20 28 20 63 6f 6c 32 20 29 20 2a  ALL - ( col2 ) *
29a40 20 33 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   3 col0 FROM tab
29a50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 36 0d 0a 2d  0..----..-246..-
29a60 33 0d 0a 2d 39 39 0d 0a 0d 0a 71 75 65 72 79 20  3..-99....query 
29a70 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
29a80 54 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  T cor0.col1 AS c
29a90 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74  ol2 FROM tab0, t
29aa0 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61 62  ab2 AS cor0, tab
29ab0 31 20 41 53 20 63 6f 72 31 2c 20 74 61 62 31 20  1 AS cor1, tab1 
29ac0 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 38  AS cor2..----..8
29ad0 31 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  1 values hashing
29ae0 20 74 6f 20 61 35 62 36 61 63 62 34 37 31 39 31   to a5b6acb47191
29af0 30 65 61 34 61 64 37 66 33 31 63 61 65 33 62 38  0ea4ad7f31cae3b8
29b00 31 38 66 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20  18f7....query I 
29b10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29b20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e  DISTINCT - cor0.
29b30 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 2b 20  col1 * - col0 + 
29b40 36 31 20 2a 20 28 20 2d 20 63 6f 72 30 2e 63 6f  61 * ( - cor0.co
29b50 6c 31 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f  l1 ) AS col0 FRO
29b60 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
29b70 2d 2d 2d 2d 0d 0a 2d 31 35 30 38 0d 0a 32 34 37  ----..-1508..247
29b80 0d 0a 33 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..30....query I 
29b90 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29ba0 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  - cor0.col0 FROM
29bb0 20 74 61 62 31 20 41 53 20 63 6f 72 30 20 43 52   tab1 AS cor0 CR
29bc0 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 20 41 53  OSS JOIN tab0 AS
29bd0 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor1..----..9 v
29be0 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
29bf0 20 34 65 63 33 30 34 62 38 63 65 39 33 35 66 32   4ec304b8ce935f2
29c00 32 32 36 65 37 35 34 38 64 37 32 63 32 62 32 66  226e7548d72c2b2f
29c10 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  0....onlyif mysq
29c20 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
29c30 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
29c40 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
29c50 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
29c60 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
29c70 34 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  43..SELECT CAST(
29c80 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
29c90 29 20 2b 20 31 30 20 41 53 20 63 6f 6c 31 20 46  ) + 10 AS col1 F
29ca0 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
29cb0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
29cc0 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
29cd0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
29ce0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
29cf0 72 74 20 6c 61 62 65 6c 2d 31 32 34 33 0d 0a 53  rt label-1243..S
29d00 45 4c 45 43 54 20 43 41 53 54 20 28 20 4e 55 4c  ELECT CAST ( NUL
29d10 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2b  L AS INTEGER ) +
29d20 20 31 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   10 AS col1 FROM
29d30 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   tab2..----..NUL
29d40 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
29d50 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
29d60 0d 0a 53 45 4c 45 43 54 20 36 33 20 46 52 4f 4d  ..SELECT 63 FROM
29d70 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63   tab0, tab1 AS c
29d80 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
29d90 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 63  ues hashing to c
29da0 33 65 65 61 39 32 63 34 36 66 32 63 34 39 37 31  3eea92c46f2c4971
29db0 36 66 33 38 36 61 35 38 62 35 37 35 30 32 35 0d  6f386a58b575025.
29dc0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
29dd0 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20 33  rt..SELECT - + 3
29de0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
29df0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 0d 0a 2d 33  r0..----..-3..-3
29e00 0d 0a 2d 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ..-3....query I 
29e10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
29e20 41 4c 4c 20 2b 20 35 34 20 2b 20 63 6f 6c 30 20  ALL + 54 + col0 
29e30 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29e40 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 38 0d 0a 31 33  0..----..118..13
29e50 34 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49  4..57....query I
29e60 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
29e70 20 38 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46   8 + cor0.col2 F
29e80 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
29e90 0d 0a 2d 2d 2d 2d 0d 0a 33 34 0d 0a 33 35 0d 0a  ..----..34..35..
29ea0 34 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  46....skipif mys
29eb0 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
29ec0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
29ed0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
29ee0 54 49 4e 43 54 20 2d 20 2b 20 43 41 53 54 20 28  TINCT - + CAST (
29ef0 20 63 6f 6c 30 20 41 53 20 52 45 41 4c 20 29 20   col0 AS REAL ) 
29f00 2b 20 2d 20 63 6f 6c 32 20 2d 20 63 6f 6c 30 20  + - col2 - col0 
29f10 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
29f20 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 35 0d 0a 2d  0..----..-185..-
29f30 32 35 36 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65 72  256..-60....quer
29f40 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
29f50 45 43 54 20 2b 20 39 36 20 2b 20 63 6f 6c 32 20  ECT + 96 + col2 
29f60 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
29f70 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
29f80 0a 31 32 32 0d 0a 31 32 33 0d 0a 31 33 34 0d 0a  .122..123..134..
29f90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
29fa0 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  t..SELECT ALL + 
29fb0 63 6f 72 30 2e 63 6f 6c 32 20 2d 20 63 6f 6c 32  cor0.col2 - col2
29fc0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
29fd0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
29fe0 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65  ..0..0..0....que
29ff0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2a000 4c 45 43 54 20 41 4c 4c 20 2b 20 37 20 2a 20 2d  LECT ALL + 7 * -
2a010 20 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c   col1 * cor0.col
2a020 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  0 FROM tab0 cor0
2a030 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34 34 34 38 0d 0a  ..----..-14448..
2a040 2d 32 33 37 36 35 0d 0a 2d 35 36 36 39 33 0d 0a  -23765..-56693..
2a050 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a060 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2a070 43 54 20 2d 20 2d 20 38 32 20 46 52 4f 4d 20 74  CT - - 82 FROM t
2a080 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2a090 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  82....skipif pos
2a0a0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2a0b0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2a0c0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2a0d0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2a0e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a0f0 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20 63 6f  SELECT col0 * co
2a100 6c 30 20 2d 20 2b 20 63 6f 6c 31 20 63 6f 6c 30  l0 - + col1 col0
2a110 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2a120 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 38 0d 0a 36 30  r0..----..18..60
2a130 32 35 0d 0a 36 32 32 34 0d 0a 0d 0a 71 75 65 72  25..6224....quer
2a140 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2a150 45 43 54 20 2d 20 36 37 20 2a 20 2b 20 63 6f 6c  ECT - 67 * + col
2a160 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2a170 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 31 38  or0..----..-3618
2a180 0d 0a 2d 33 38 31 39 0d 0a 2d 36 34 33 32 0d 0a  ..-3819..-6432..
2a190 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2a1a0 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2a1b0 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2a1c0 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2a1d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2a1e0 35 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  55..SELECT ALL -
2a1f0 20 63 6f 72 30 2e 63 6f 6c 32 20 44 49 56 20 2b   cor0.col2 DIV +
2a200 20 63 6f 6c 31 20 2d 20 2b 20 63 6f 72 30 2e 63   col1 - + cor0.c
2a210 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
2a220 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2a230 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35 0d 0a 2d  ---..-24..-35..-
2a240 38 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  89....skipif mys
2a250 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
2a260 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
2a270 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 35 35 0d  sort label-1255.
2a280 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2a290 72 30 2e 63 6f 6c 32 20 2f 20 2b 20 63 6f 6c 31  r0.col2 / + col1
2a2a0 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41   - + cor0.col0 A
2a2b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
2a2c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a2d0 2d 32 34 0d 0a 2d 33 35 0d 0a 2d 38 39 0d 0a 0d  -24..-35..-89...
2a2e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2a2f0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
2a300 54 20 2b 20 34 20 2a 20 2d 20 63 6f 6c 32 20 46  T + 4 * - col2 F
2a310 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2a320 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 33  ..----..-132..-3
2a330 32 38 0d 0a 2d 34 0d 0a 0d 0a 71 75 65 72 79 20  28..-4....query 
2a340 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2a350 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20  T DISTINCT col0 
2a360 2b 20 63 6f 6c 30 20 2a 20 2d 20 31 31 20 46 52  + col0 * - 11 FR
2a370 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
2a380 2d 2d 0d 0a 2d 37 30 0d 0a 2d 37 38 30 0d 0a 2d  --..-70..-780..-
2a390 37 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  790....query I r
2a3a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2a3b0 4c 4c 20 2d 20 2b 20 38 38 20 2b 20 63 6f 6c 31  LL - + 88 + col1
2a3c0 20 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   * col0 FROM tab
2a3d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2a3e0 0a 2d 31 30 0d 0a 35 35 32 0d 0a 39 35 32 0d 0a  .-10..552..952..
2a3f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2a400 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 32 20 46  t..SELECT + 52 F
2a410 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41  ROM tab1, tab2 A
2a420 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
2a430 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2a440 6f 20 37 66 34 61 65 33 30 38 39 33 61 62 33 33  o 7f4ae30893ab33
2a450 30 37 38 34 38 32 39 37 31 31 30 33 32 61 65 35  0784829711032ae5
2a460 39 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  99....skipif pos
2a470 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2a480 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2a490 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2a4a0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2a4b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2a4c0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20 63  SELECT ALL + - c
2a4d0 6f 6c 32 20 2a 20 2b 20 28 20 2b 20 63 6f 6c 31  ol2 * + ( + col1
2a4e0 20 29 20 2a 20 63 6f 6c 31 20 63 6f 6c 32 20 46   ) * col1 col2 F
2a4f0 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2a500 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 39 38 32 0d 0a  ..----..-10982..
2a510 2d 32 35 39 34 37 0d 0a 2d 39 30 35 30 36 0d 0a  -25947..-90506..
2a520 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2a530 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2a540 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2a550 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2a560 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2a570 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2a580 43 54 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 31 37  CT - - col1 * 17
2a590 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2a5a0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2a5b0 37 30 0d 0a 32 32 31 0d 0a 34 34 32 0d 0a 0d 0a  70..221..442....
2a5c0 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
2a5d0 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
2a5e0 45 4c 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d  ELECT ALL * FROM
2a5f0 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63   tab0, tab2 AS c
2a600 6f 72 30 2c 20 74 61 62 32 20 63 6f 72 31 2c 20  or0, tab2 cor1, 
2a610 74 61 62 32 2c 20 74 61 62 30 20 41 53 20 63 6f  tab2, tab0 AS co
2a620 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76  r2..----..3645 v
2a630 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2a640 20 34 30 65 34 61 63 64 36 31 38 36 39 38 64 64   40e4acd618698dd
2a650 32 33 30 35 66 31 66 37 62 38 62 35 34 37 66 37  2305f1f7b8b547f7
2a660 61 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  a....onlyif mysq
2a670 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2a680 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2a690 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2a6a0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2a6b0 2d 31 32 36 33 0d 0a 53 45 4c 45 43 54 20 41 4c  -1263..SELECT AL
2a6c0 4c 20 63 6f 6c 32 20 44 49 56 20 2d 20 63 6f 6c  L col2 DIV - col
2a6d0 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2a6e0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2a6f0 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b  -..0..0..0....sk
2a700 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2a710 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2a720 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2a730 65 6c 2d 31 32 36 33 0d 0a 53 45 4c 45 43 54 20  el-1263..SELECT 
2a740 41 4c 4c 20 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c  ALL col2 / - col
2a750 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  1 AS col1 FROM t
2a760 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2a770 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
2a780 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2a790 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2a 20 2d  ELECT - col1 * -
2a7a0 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52   col2 AS col2 FR
2a7b0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2a7c0 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a 37 34 36  .----..2838..746
2a7d0 32 0d 0a 39 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  2..97....onlyif 
2a7e0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2a7f0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2a800 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2a810 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2a820 61 62 65 6c 2d 31 32 36 35 0d 0a 53 45 4c 45 43  abel-1265..SELEC
2a830 54 20 41 4c 4c 20 2d 20 28 20 2b 20 34 37 20 29  T ALL - ( + 47 )
2a840 20 44 49 56 20 63 6f 6c 31 20 2b 20 2b 20 39 20   DIV col1 + + 9 
2a850 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
2a860 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 38 0d 0a 39  0..----..7..8..9
2a870 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2a880 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2a890 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2a8a0 72 74 20 6c 61 62 65 6c 2d 31 32 36 35 0d 0a 53  rt label-1265..S
2a8b0 45 4c 45 43 54 20 41 4c 4c 20 2d 20 28 20 2b 20  ELECT ALL - ( + 
2a8c0 34 37 20 29 20 2f 20 63 6f 6c 31 20 2b 20 2b 20  47 ) / col1 + + 
2a8d0 39 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  9 FROM tab2 AS c
2a8e0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 0d 0a 38 0d  or0..----..7..8.
2a8f0 0a 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  .9....query I ro
2a900 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2a910 2d 20 28 20 35 33 20 29 20 41 53 20 63 6f 6c 31  - ( 53 ) AS col1
2a920 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2a930 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 33 0d 0a 35 33  r0..----..53..53
2a940 0d 0a 35 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ..53....onlyif m
2a950 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
2a960 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
2a970 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
2a980 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2a990 62 65 6c 2d 31 32 36 37 0d 0a 53 45 4c 45 43 54  bel-1267..SELECT
2a9a0 20 41 4c 4c 20 2d 20 2b 20 34 36 20 2a 20 63 6f   ALL - + 46 * co
2a9b0 6c 31 20 2b 20 2b 20 63 6f 6c 32 20 44 49 56 20  l1 + + col2 DIV 
2a9c0 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  - col1 FROM tab0
2a9d0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2a9e0 2d 33 39 35 36 0d 0a 2d 34 31 38 36 0d 0a 2d 34  -3956..-4186..-4
2a9f0 34 36 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  462....skipif my
2aa00 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
2aa10 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
2aa20 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 36 37  wsort label-1267
2aa30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b  ..SELECT ALL - +
2aa40 20 34 36 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63   46 * col1 + + c
2aa50 6f 6c 32 20 2f 20 2d 20 63 6f 6c 31 20 46 52 4f  ol2 / - col1 FRO
2aa60 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2aa70 2d 2d 2d 2d 0d 0a 2d 33 39 35 36 0d 0a 2d 34 31  ----..-3956..-41
2aa80 38 36 0d 0a 2d 34 34 36 32 0d 0a 0d 0a 73 6b 69  86..-4462....ski
2aa90 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2aaa0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2aab0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2aac0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2aad0 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2aae0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
2aaf0 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2a 20 63 6f  col1 * col1 * co
2ab00 6c 32 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  l2 col2 FROM tab
2ab10 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2ab20 0a 31 30 39 38 32 0d 0a 32 35 39 34 37 0d 0a 39  .10982..25947..9
2ab30 30 35 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  0506....skipif m
2ab40 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
2ab50 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
2ab60 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2ab70 49 53 54 49 4e 43 54 20 2d 20 43 41 53 54 20 28  ISTINCT - CAST (
2ab80 20 33 30 20 41 53 20 52 45 41 4c 20 29 20 2a 20   30 AS REAL ) * 
2ab90 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
2aba0 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
2abb0 2d 2d 2d 0d 0a 2d 31 31 34 30 0d 0a 2d 37 38 30  ---..-1140..-780
2abc0 0d 0a 2d 38 31 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-810....query 
2abd0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2abe0 54 20 41 4c 4c 20 28 20 2d 20 63 6f 6c 32 20 29  T ALL ( - col2 )
2abf0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
2ac00 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32 37 0d  .----..-26..-27.
2ac10 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-38....query I 
2ac20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2ac30 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30 2e 63 6f  - col0 * cor0.co
2ac40 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l2 FROM tab0 cor
2ac50 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 37  0..----..-35..-7
2ac60 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d 0a 71 75 65  298..-792....que
2ac70 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ac80 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
2ac90 2d 20 34 39 20 2a 20 2b 20 63 6f 6c 32 20 46 52  - 49 * + col2 FR
2aca0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2acb0 0a 2d 2d 2d 2d 0d 0a 2d 31 32 37 34 0d 0a 2d 31  .----..-1274..-1
2acc0 33 32 33 0d 0a 2d 31 38 36 32 0d 0a 0d 0a 6f 6e  323..-1862....on
2acd0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2ace0 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2acf0 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2ad00 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2ad10 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ad20 20 6c 61 62 65 6c 2d 31 32 37 33 0d 0a 53 45 4c   label-1273..SEL
2ad30 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63  ECT DISTINCT - c
2ad40 6f 6c 31 20 2b 20 2b 20 43 41 53 54 28 20 2d 20  ol1 + + CAST( - 
2ad50 28 20 74 61 62 30 2e 63 6f 6c 32 20 29 20 41 53  ( tab0.col2 ) AS
2ad60 20 53 49 47 4e 45 44 20 29 20 46 52 4f 4d 20 74   SIGNED ) FROM t
2ad70 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d  ab0..----..-119.
2ad80 0a 2d 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 73 6b  .-173..-98....sk
2ad90 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2ada0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2adb0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2adc0 65 6c 2d 31 32 37 33 0d 0a 53 45 4c 45 43 54 20  el-1273..SELECT 
2add0 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20  DISTINCT - col1 
2ade0 2b 20 2b 20 43 41 53 54 20 28 20 2d 20 28 20 74  + + CAST ( - ( t
2adf0 61 62 30 2e 63 6f 6c 32 20 29 20 41 53 20 49 4e  ab0.col2 ) AS IN
2ae00 54 45 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62  TEGER ) FROM tab
2ae10 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 39 0d 0a 2d  0..----..-119..-
2ae20 31 37 33 0d 0a 2d 39 38 0d 0a 0d 0a 71 75 65 72  173..-98....quer
2ae30 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ae40 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 28  ECT DISTINCT - (
2ae50 20 2d 20 63 6f 6c 31 20 29 20 2a 20 63 6f 6c 31   - col1 ) * col1
2ae60 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2ae70 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39 0d 0a 33  r0..----..289..3
2ae80 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 6f 6e 6c 79  481..961....only
2ae90 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f  if mysql # suppo
2aea0 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65  rt for MySQL spe
2aeb0 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79 70  cific system typ
2aec0 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71  es and syntax..q
2aed0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2aee0 61 62 65 6c 2d 31 32 37 35 0d 0a 53 45 4c 45 43  abel-1275..SELEC
2aef0 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 28  T DISTINCT CAST(
2af00 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
2af10 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52  ) + cor0.col0 FR
2af20 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2af30 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .----..NULL....s
2af40 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2af50 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2af60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2af70 62 65 6c 2d 31 32 37 35 0d 0a 53 45 4c 45 43 54  bel-1275..SELECT
2af80 20 44 49 53 54 49 4e 43 54 20 43 41 53 54 20 28   DISTINCT CAST (
2af90 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2afa0 20 29 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 46   ) + cor0.col0 F
2afb0 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2afc0 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
2afd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2afe0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
2aff0 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 6c 30  cor0.col2 + col0
2b000 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c   * - col2 AS col
2b010 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2b020 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a  or0..----..-36..
2b030 2d 37 33 38 30 0d 0a 2d 38 32 35 0d 0a 0d 0a 71  -7380..-825....q
2b040 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2b050 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
2b060 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  1 + + cor0.col0 
2b070 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  * col1 FROM tab1
2b080 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2b090 31 30 32 37 0d 0a 35 32 0d 0a 36 33 30 0d 0a 0d  1027..52..630...
2b0a0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2b0b0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2b0c0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2b0d0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2b0e0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2b0f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b100 54 20 44 49 53 54 49 4e 43 54 20 2d 20 30 20 63  T DISTINCT - 0 c
2b110 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c 20 74  ol1 FROM tab1, t
2b120 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2b130 2d 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  -..0....query I 
2b140 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b150 44 49 53 54 49 4e 43 54 20 2b 20 2b 20 35 32 20  DISTINCT + + 52 
2b160 2b 20 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  + 2 FROM tab1 AS
2b170 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 34 0d   cor0..----..54.
2b180 0a 0d 0a 71 75 65 72 79 20 49 49 49 49 49 49 49  ...query IIIIIII
2b190 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74  IIIIIIII rowsort
2b1a0 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
2b1b0 74 61 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f  tab0, tab2 AS co
2b1c0 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31  r0, tab1 AS cor1
2b1d0 2c 20 74 61 62 31 2c 20 74 61 62 30 20 41 53 20  , tab1, tab0 AS 
2b1e0 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35  cor2..----..3645
2b1f0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2b200 74 6f 20 33 62 34 35 38 37 61 62 36 63 30 38 64  to 3b4587ab6c08d
2b210 32 31 37 39 63 36 64 66 30 39 34 64 32 66 37 36  2179c6df094d2f76
2b220 61 64 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  ad7....query I r
2b230 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2b240 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 63  ISTINCT col1 * c
2b250 6f 6c 32 20 2b 20 2b 20 28 20 63 6f 6c 32 20 29  ol2 + + ( col2 )
2b260 20 2b 20 2b 20 28 20 63 6f 6c 30 20 29 20 2a 20   + + ( col0 ) * 
2b270 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
2b280 2d 2d 2d 2d 0d 0a 36 39 32 35 0d 0a 37 36 34 34  ----..6925..7644
2b290 0d 0a 39 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49  ..913....query I
2b2a0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2b2b0 20 41 4c 4c 20 35 32 20 46 52 4f 4d 20 74 61 62   ALL 52 FROM tab
2b2c0 30 2c 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d  0, tab1 cor0..--
2b2d0 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
2b2e0 68 69 6e 67 20 74 6f 20 37 66 34 61 65 33 30 38  hing to 7f4ae308
2b2f0 39 33 61 62 33 33 30 37 38 34 38 32 39 37 31 31  93ab330784829711
2b300 30 33 32 61 65 35 39 39 0d 0a 0d 0a 71 75 65 72  032ae599....quer
2b310 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b320 45 43 54 20 2d 20 31 34 20 41 53 20 63 6f 6c 30  ECT - 14 AS col0
2b330 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f   FROM tab2 AS co
2b340 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61  r0 CROSS JOIN ta
2b350 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d  b2 AS cor1..----
2b360 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2b370 6e 67 20 74 6f 20 64 33 32 31 34 36 31 39 39 34  ng to d321461994
2b380 62 61 34 39 63 33 61 37 30 66 61 36 33 37 33 30  ba49c3a70fa63730
2b390 33 32 66 63 39 34 0d 0a 0d 0a 71 75 65 72 79 20  32fc94....query 
2b3a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2b3b0 54 20 2b 20 63 6f 6c 30 20 2a 20 36 30 20 41 53  T + col0 * 60 AS
2b3c0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d   col2 FROM tab0.
2b3d0 0a 2d 2d 2d 2d 0d 0a 31 34 34 30 0d 0a 32 31 30  .----..1440..210
2b3e0 30 0d 0a 35 33 34 30 0d 0a 0d 0a 71 75 65 72 79  0..5340....query
2b3f0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b400 43 54 20 41 4c 4c 20 28 20 39 37 20 29 20 2b 20  CT ALL ( 97 ) + 
2b410 2b 20 63 6f 6c 32 20 2b 20 63 6f 6c 32 20 2a 20  + col2 + col2 * 
2b420 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20 46  + col1 AS col1 F
2b430 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
2b440 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34 31 0d 0a 31 35  ..----..1441..15
2b450 35 35 0d 0a 37 32 34 0d 0a 0d 0a 71 75 65 72 79  55..724....query
2b460 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2b470 43 54 20 2d 20 2b 20 39 38 20 2a 20 2b 20 63 6f  CT - + 98 * + co
2b480 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l0 AS col2 FROM 
2b490 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  tab0 cor0..----.
2b4a0 0a 2d 32 33 35 32 0d 0a 2d 33 34 33 30 0d 0a 2d  .-2352..-3430..-
2b4b0 38 37 32 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  8722....query I 
2b4c0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2b4d0 2b 20 2b 20 28 20 2b 20 74 61 62 32 2e 63 6f 6c  + + ( + tab2.col
2b4e0 32 20 29 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  2 ) AS col0 FROM
2b4f0 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62   tab2, tab1, tab
2b500 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37  2 cor0..----..27
2b510 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
2b520 74 6f 20 34 30 66 64 38 63 63 30 64 65 39 32 65  to 40fd8cc0de92e
2b530 61 36 38 64 37 33 36 33 34 63 32 64 38 66 37 35  a68d73634c2d8f75
2b540 62 66 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  bf5....query I r
2b550 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2b560 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2d 20 2d   col2 * col2 - -
2b570 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d   col2 FROM tab2.
2b580 0a 2d 2d 2d 2d 0d 0a 2d 31 34 30 36 0d 0a 2d 36  .----..-1406..-6
2b590 35 30 0d 0a 2d 37 30 32 0d 0a 0d 0a 71 75 65 72  50..-702....quer
2b5a0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2b5b0 45 43 54 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ECT col0 + + col
2b5c0 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
2b5d0 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37  ab1..----..29..7
2b5e0 34 0d 0a 39 33 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  4..93....onlyif 
2b5f0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
2b600 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
2b610 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
2b620 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2b630 61 62 65 6c 2d 31 32 39 30 0d 0a 53 45 4c 45 43  abel-1290..SELEC
2b640 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 44 49  T - tab2.col0 DI
2b650 56 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62  V + col1 + - tab
2b660 32 2e 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20  2.col0 * ( col1 
2b670 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  ) AS col2 FROM t
2b680 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 37  ab2..----..-1347
2b690 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 33 0d 0a 0d  ..-217..-4603...
2b6a0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
2b6b0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
2b6c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
2b6d0 6c 61 62 65 6c 2d 31 32 39 30 0d 0a 53 45 4c 45  label-1290..SELE
2b6e0 43 54 20 2d 20 74 61 62 32 2e 63 6f 6c 30 20 2f  CT - tab2.col0 /
2b6f0 20 2b 20 63 6f 6c 31 20 2b 20 2d 20 74 61 62 32   + col1 + - tab2
2b700 2e 63 6f 6c 30 20 2a 20 28 20 63 6f 6c 31 20 29  .col0 * ( col1 )
2b710 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2b720 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 37 0d  b2..----..-1347.
2b730 0a 2d 32 31 37 0d 0a 2d 34 36 30 33 0d 0a 0d 0a  .-217..-4603....
2b740 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2b750 0a 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c  .SELECT tab0.col
2b760 30 20 2d 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c  0 - + col2 * col
2b770 32 20 2a 20 39 32 20 46 52 4f 4d 20 74 61 62 30  2 * 92 FROM tab0
2b780 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 31 36 34 0d  ..----..-100164.
2b790 0a 2d 35 37 0d 0a 2d 36 31 38 35 31 39 0d 0a 0d  .-57..-618519...
2b7a0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
2b7b0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
2b7c0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
2b7d0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
2b7e0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39  owsort label-129
2b7f0 32 0d 0a 53 45 4c 45 43 54 20 2b 20 28 20 63 6f  2..SELECT + ( co
2b800 6c 31 20 29 20 2b 20 63 6f 6c 32 20 44 49 56 20  l1 ) + col2 DIV 
2b810 2b 20 43 41 53 54 28 20 63 6f 6c 30 20 2b 20 2d  + CAST( col0 + -
2b820 20 63 6f 6c 31 20 2a 20 32 20 41 53 20 53 49 47   col1 * 2 AS SIG
2b830 4e 45 44 20 29 20 46 52 4f 4d 20 74 61 62 31 0d  NED ) FROM tab1.
2b840 0a 2d 2d 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32  .----..11..14..2
2b850 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  5....skipif mysq
2b860 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
2b870 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
2b880 6f 72 74 20 6c 61 62 65 6c 2d 31 32 39 32 0d 0a  ort label-1292..
2b890 53 45 4c 45 43 54 20 2b 20 28 20 63 6f 6c 31 20  SELECT + ( col1 
2b8a0 29 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 43 41 53  ) + col2 / + CAS
2b8b0 54 20 28 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c  T ( col0 + - col
2b8c0 31 20 2a 20 32 20 41 53 20 49 4e 54 45 47 45 52  1 * 2 AS INTEGER
2b8d0 20 29 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d   ) FROM tab1..--
2b8e0 2d 2d 0d 0a 31 31 0d 0a 31 34 0d 0a 32 35 0d 0a  --..11..14..25..
2b8f0 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2b900 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2b910 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2b920 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2b930 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2b940 39 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  93..SELECT - col
2b950 32 20 44 49 56 20 74 61 62 31 2e 63 6f 6c 32 20  2 DIV tab1.col2 
2b960 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  - col1 FROM tab1
2b970 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 34  ..----..-11..-14
2b980 0d 0a 2d 32 37 0d 0a 0d 0a 73 6b 69 70 69 66 20  ..-27....skipif 
2b990 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2b9a0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2b9b0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 32  rowsort label-12
2b9c0 39 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  93..SELECT - col
2b9d0 32 20 2f 20 74 61 62 31 2e 63 6f 6c 32 20 2d 20  2 / tab1.col2 - 
2b9e0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
2b9f0 2d 2d 2d 2d 0d 0a 2d 31 31 0d 0a 2d 31 34 0d 0a  ----..-11..-14..
2ba00 2d 32 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  -27....onlyif my
2ba10 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2ba20 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2ba30 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2ba40 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2ba50 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2ba60 31 32 39 34 0d 0a 53 45 4c 45 43 54 20 44 49 53  1294..SELECT DIS
2ba70 54 49 4e 43 54 20 2d 20 43 41 53 54 28 20 4e 55  TINCT - CAST( NU
2ba80 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29 20  LL AS DECIMAL ) 
2ba90 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52  * + col2 col0 FR
2baa0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e  OM tab2..----..N
2bab0 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ULL....skipif po
2bac0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2bad0 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2bae0 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2baf0 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2bb00 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2bb10 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2bb20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2bb30 61 62 65 6c 2d 31 32 39 34 0d 0a 53 45 4c 45 43  abel-1294..SELEC
2bb40 54 20 44 49 53 54 49 4e 43 54 20 2d 20 43 41 53  T DISTINCT - CAS
2bb50 54 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c  T ( NULL AS REAL
2bb60 20 29 20 2a 20 2b 20 63 6f 6c 32 20 63 6f 6c 30   ) * + col2 col0
2bb70 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2bb80 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
2bb90 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bba0 54 20 2b 20 36 30 20 2b 20 63 6f 6c 30 20 41 53  T + 60 + col0 AS
2bbb0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
2bbc0 0a 2d 2d 2d 2d 0d 0a 31 33 38 0d 0a 31 33 39 0d  .----..138..139.
2bbd0 0a 36 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .67....query I r
2bbe0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
2bbf0 20 2b 20 37 32 20 2a 20 2d 20 63 6f 6c 31 20 46   + 72 * - col1 F
2bc00 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
2bc10 2d 2d 2d 0d 0a 31 32 32 34 0d 0a 32 32 33 32 0d  ---..1224..2232.
2bc20 0a 34 32 34 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .4248....query I
2bc30 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bc40 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 28 20   DISTINCT - + ( 
2bc50 63 6f 6c 30 20 29 20 41 53 20 63 6f 6c 32 20 46  col0 ) AS col2 F
2bc60 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
2bc70 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 2d 33 35  ..----..-24..-35
2bc80 0d 0a 2d 38 39 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-89....query I
2bc90 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2bca0 20 44 49 53 54 49 4e 43 54 20 34 34 20 2a 20 63   DISTINCT 44 * c
2bcb0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol2 FROM tab0..-
2bcc0 2d 2d 2d 0d 0a 31 34 35 32 0d 0a 33 36 30 38 0d  ---..1452..3608.
2bcd0 0a 34 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .44....query I r
2bce0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2bcf0 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 2d 20 63  ISTINCT col0 - c
2bd00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol1 FROM tab1..-
2bd10 2d 2d 2d 0d 0a 2d 32 33 0d 0a 35 34 0d 0a 36 37  ---..-23..54..67
2bd20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2bd30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31  ort..SELECT col1
2bd40 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 31 32 20 41   + col1 + + 12 A
2bd50 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2bd60 0d 0a 2d 2d 2d 2d 0d 0a 33 32 0d 0a 33 38 0d 0a  ..----..32..38..
2bd70 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  64....query I ro
2bd80 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2bd90 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20 2a 20  STINCT - col2 * 
2bda0 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 2d 20  + cor0.col2 + - 
2bdb0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
2bdc0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2bdd0 2d 0d 0a 2d 31 31 32 32 0d 0a 2d 32 0d 0a 2d 36  -..-1122..-2..-6
2bde0 38 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  806....skipif po
2bdf0 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2be00 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2be10 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2be20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2be30 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2be40 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f  .SELECT ALL + co
2be50 6c 31 20 2b 20 2b 20 63 6f 6c 30 20 2b 20 34 31  l1 + + col0 + 41
2be60 20 2a 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f   * col0 col2 FRO
2be70 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
2be80 2d 2d 2d 2d 0d 0a 31 30 39 34 0d 0a 31 35 36 37  ----..1094..1567
2be90 0d 0a 33 38 32 39 0d 0a 0d 0a 73 6b 69 70 69 66  ..3829....skipif
2bea0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
2beb0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
2bec0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
2bed0 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
2bee0 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
2bef0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2bf00 4e 43 54 20 63 6f 6c 31 20 2a 20 28 20 2b 20 63  NCT col1 * ( + c
2bf10 6f 72 30 2e 63 6f 6c 30 20 29 20 63 6f 6c 31 20  or0.col0 ) col1 
2bf20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2bf30 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 34 30 0d 0a 36  0..----..1040..6
2bf40 34 30 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79 20  40..78....query 
2bf50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2bf60 54 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 2a 20  T - tab1.col1 * 
2bf70 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46  - col0 AS col2 F
2bf80 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
2bf90 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d 0a 0d  1040..640..78...
2bfa0 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
2bfb0 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
2bfc0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46  ECT DISTINCT * F
2bfd0 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20  ROM tab1, tab2, 
2bfe0 74 61 62 32 20 41 53 20 63 6f 72 30 2c 20 74 61  tab2 AS cor0, ta
2bff0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 39 37 32 20 76 61  b0..----..972 va
2c000 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2c010 65 34 63 37 34 38 66 32 36 37 65 38 64 32 61 30  e4c748f267e8d2a0
2c020 65 36 64 35 36 33 32 38 31 65 31 66 62 39 37 35  e6d563281e1fb975
2c030 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2c040 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2c050 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  + col0 + + col1 
2c060 2a 20 74 61 62 30 2e 63 6f 6c 30 20 2d 20 2b 20  * tab0.col0 - + 
2c070 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
2c080 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab0..----..20
2c090 35 35 0d 0a 33 34 32 39 0d 0a 38 31 30 36 0d 0a  55..3429..8106..
2c0a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c0b0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2c0c0 43 54 20 63 6f 6c 30 20 2d 20 2d 20 63 6f 6c 30  CT col0 - - col0
2c0d0 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
2c0e0 0d 0a 31 34 0d 0a 31 35 36 0d 0a 31 35 38 0d 0a  ..14..156..158..
2c0f0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2c100 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b  t..SELECT col2 +
2c110 20 36 33 20 2a 20 28 20 2d 20 63 6f 6c 30 20 29   63 * ( - col0 )
2c120 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d   FROM tab0 cor0.
2c130 0a 2d 2d 2d 2d 0d 0a 2d 31 34 37 39 0d 0a 2d 32  .----..-1479..-2
2c140 32 30 34 0d 0a 2d 35 35 32 35 0d 0a 0d 0a 73 6b  204..-5525....sk
2c150 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20  ipif postgresql 
2c160 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71  # PostgreSQL req
2c170 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65  uires AS when re
2c180 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f  naming output co
2c190 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72  lumns..query I r
2c1a0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
2c1b0 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
2c1c0 32 20 2a 20 63 6f 6c 31 20 63 6f 6c 31 20 46 52  2 * col1 col1 FR
2c1d0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2c1e0 0a 2d 2d 2d 2d 0d 0a 31 32 36 31 0d 0a 31 34 33  .----..1261..143
2c1f0 30 0d 0a 35 38 30 0d 0a 0d 0a 71 75 65 72 79 20  0..580....query 
2c200 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2c210 54 20 74 61 62 30 2e 63 6f 6c 32 20 2b 20 28 20  T tab0.col2 + ( 
2c220 2b 20 28 20 63 6f 6c 30 20 29 20 29 20 2a 20 2d  + ( col0 ) ) * -
2c230 20 38 37 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d   87 AS col2 FROM
2c240 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30   tab0..----..-20
2c250 35 35 0d 0a 2d 33 30 34 34 0d 0a 2d 37 36 36 31  55..-3044..-7661
2c260 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2c270 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2c280 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2c290 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2c2a0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2c2b0 31 33 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63  1311..SELECT - c
2c2c0 6f 6c 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63  ol1 + - col1 * c
2c2d0 6f 6c 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol2 * col1 + + c
2c2e0 6f 6c 30 20 44 49 56 20 2b 20 38 30 20 41 53 20  ol0 DIV + 80 AS 
2c2f0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2c300 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2c310 34 34 31 35 34 0d 0a 2d 36 37 39 31 33 32 0d 0a  44154..-679132..
2c320 2d 39 35 30 36 0d 0a 0d 0a 73 6b 69 70 69 66 20  -9506....skipif 
2c330 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2c340 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2c350 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2c360 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  11..SELECT - col
2c370 31 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c  1 + - col1 * col
2c380 32 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c  2 * col1 + + col
2c390 30 20 2f 20 2b 20 38 30 20 41 53 20 63 6f 6c 32  0 / + 80 AS col2
2c3a0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2c3b0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 34 34 31 35  r0..----..-24415
2c3c0 34 0d 0a 2d 36 37 39 31 33 32 0d 0a 2d 39 35 30  4..-679132..-950
2c3d0 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
2c3e0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2c3f0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2c400 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2c410 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2c420 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c430 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
2c440 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 2d  ol2 * - col0 * -
2c450 20 63 6f 6c 30 20 63 6f 6c 32 20 46 52 4f 4d 20   col0 col2 FROM 
2c460 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2c470 2d 2d 0d 0a 31 33 32 33 0d 0a 31 35 38 31 38 34  --..1323..158184
2c480 0d 0a 32 33 37 31 35 38 0d 0a 0d 0a 71 75 65 72  ..237158....quer
2c490 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2c4a0 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2c4b0 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e  or0.col1 * cor0.
2c4c0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2c4d0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 37 33  S cor0..----..73
2c4e0 39 36 0d 0a 38 32 38 31 0d 0a 39 34 30 39 0d 0a  96..8281..9409..
2c4f0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2c500 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2c510 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2c520 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2c530 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2c540 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2c550 43 54 20 41 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f  CT ALL - cor0.co
2c560 6c 31 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  l1 col1 FROM tab
2c570 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2c580 0a 2d 31 37 0d 0a 2d 33 31 0d 0a 2d 35 39 0d 0a  .-17..-31..-59..
2c590 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2c5a0 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2c5b0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2c5c0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2c5d0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2c5e0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 31 35 0d  sort label-1315.
2c5f0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f  .SELECT ALL - co
2c600 6c 30 20 2a 20 2d 20 43 41 53 54 28 20 4e 55 4c  l0 * - CAST( NUL
2c610 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20  L AS SIGNED ) + 
2c620 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
2c630 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
2c640 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
2c650 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2c660 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2c670 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2c680 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2c690 33 31 35 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  315..SELECT ALL 
2c6a0 2d 20 63 6f 6c 30 20 2a 20 2d 20 43 41 53 54 20  - col0 * - CAST 
2c6b0 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45  ( NULL AS INTEGE
2c6c0 52 20 29 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  R ) + col1 AS co
2c6d0 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
2c6e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2c6f0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2c700 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2c710 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2c720 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2c730 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2c740 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2c750 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2c760 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20 2a   col0 + + col1 *
2c770 20 2b 20 28 20 63 6f 6c 30 20 29 20 2b 20 63 6f   + ( col0 ) + co
2c780 6c 31 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l1 col0 FROM tab
2c790 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2c7a0 0a 32 31 37 34 0d 0a 33 35 32 37 0d 0a 38 32 37  .2174..3527..827
2c7b0 39 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  9....skipif post
2c7c0 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
2c7d0 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
2c7e0 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
2c7f0 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75  tput columns..qu
2c800 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2c810 45 4c 45 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63  ELECT - + cor0.c
2c820 6f 6c 31 20 2a 20 63 6f 72 30 2e 63 6f 6c 30 20  ol1 * cor0.col0 
2c830 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2c840 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  S cor0..----..-2
2c850 30 36 34 0d 0a 2d 33 33 39 35 0d 0a 2d 38 30 39  064..-3395..-809
2c860 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
2c870 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2c880 54 49 4e 43 54 20 2b 20 63 6f 6c 32 20 2a 20 63  TINCT + col2 * c
2c890 6f 6c 32 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  ol2 + + cor0.col
2c8a0 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
2c8b0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2c8c0 2d 0d 0a 32 39 31 39 0d 0a 33 33 31 33 0d 0a 39  -..2919..3313..9
2c8d0 32 39 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  296....query I r
2c8e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2c8f0 49 53 54 49 4e 43 54 20 2b 20 2d 20 63 6f 6c 30  ISTINCT + - col0
2c900 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20   * col0 AS col2 
2c910 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2c920 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35 0d 0a  0..----..-1225..
2c930 2d 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d 0a 71  -576..-7921....q
2c940 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2c950 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2c960 63 6f 6c 32 20 2b 20 34 34 20 2a 20 2b 20 63 6f  col2 + 44 * + co
2c970 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20  l2 AS col0 FROM 
2c980 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2c990 2d 2d 0d 0a 31 34 38 35 0d 0a 33 36 39 30 0d 0a  --..1485..3690..
2c9a0 34 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  45....onlyif mys
2c9b0 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72  ql # support for
2c9c0 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20   MySQL specific 
2c9d0 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64  system types and
2c9e0 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49   syntax..query I
2c9f0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2ca00 33 32 31 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  321..SELECT DIST
2ca10 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b 20 43 41  INCT col1 * + CA
2ca20 53 54 28 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  ST( + cor0.col2 
2ca30 41 53 20 53 49 47 4e 45 44 20 29 20 2b 20 2d 20  AS SIGNED ) + - 
2ca40 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52  col1 * - col1 FR
2ca50 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2ca60 0a 2d 2d 2d 2d 0d 0a 31 30 32 33 34 0d 0a 31 35  .----..10234..15
2ca70 37 34 33 0d 0a 39 35 30 36 0d 0a 0d 0a 73 6b 69  743..9506....ski
2ca80 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2ca90 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2caa0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2cab0 6c 2d 31 33 32 31 0d 0a 53 45 4c 45 43 54 20 44  l-1321..SELECT D
2cac0 49 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2b  ISTINCT col1 * +
2cad0 20 43 41 53 54 20 28 20 2b 20 63 6f 72 30 2e 63   CAST ( + cor0.c
2cae0 6f 6c 32 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol2 AS INTEGER )
2caf0 20 2b 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 63 6f   + - col1 * - co
2cb00 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2cb10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 32 33  cor0..----..1023
2cb20 34 0d 0a 31 35 37 34 33 0d 0a 39 35 30 36 0d 0a  4..15743..9506..
2cb30 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2cb40 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
2cb50 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
2cb60 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
2cb70 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
2cb80 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 32 32 0d  sort label-1322.
2cb90 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b  .SELECT - col1 +
2cba0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
2cbb0 20 53 49 47 4e 45 44 20 29 20 2a 20 32 37 20 2b   SIGNED ) * 27 +
2cbc0 20 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20   + col2 AS col0 
2cbd0 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a  FROM tab1 cor0..
2cbe0 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
2cbf0 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66  ..NULL....skipif
2cc00 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
2cc10 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
2cc20 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
2cc30 33 32 32 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  322..SELECT - co
2cc40 6c 31 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55  l1 + + CAST ( NU
2cc50 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  LL AS INTEGER ) 
2cc60 2a 20 32 37 20 2b 20 2b 20 63 6f 6c 32 20 41 53  * 27 + + col2 AS
2cc70 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
2cc80 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2cc90 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2cca0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ccb0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 2d 20  .SELECT ALL + - 
2ccc0 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f  col1 AS col0 FRO
2ccd0 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab0 cor0..---
2cce0 2d 0d 0a 2d 38 36 0d 0a 2d 39 31 0d 0a 2d 39 37  -..-86..-91..-97
2ccf0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
2cd00 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
2cd10 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
2cd20 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
2cd30 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
2cd40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2cd50 4c 45 43 54 20 63 6f 6c 31 20 2b 20 2d 20 63 6f  LECT col1 + - co
2cd60 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62  l0 col0 FROM tab
2cd70 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2cd80 0a 2d 35 34 0d 0a 2d 36 37 0d 0a 32 33 0d 0a 0d  .-54..-67..23...
2cd90 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2cda0 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20  ..SELECT + col0 
2cdb0 2b 20 28 20 2d 20 63 6f 6c 31 20 29 20 41 53 20  + ( - col1 ) AS 
2cdc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
2cdd0 2d 2d 2d 2d 0d 0a 2d 32 34 0d 0a 31 39 0d 0a 36  ----..-24..19..6
2cde0 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
2cdf0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  sort..SELECT + +
2ce00 20 63 6f 72 30 2e 63 6f 6c 31 20 2d 20 2d 20 63   cor0.col1 - - c
2ce10 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2ce20 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ce30 2d 2d 2d 0d 0a 31 31 39 0d 0a 31 37 33 0d 0a 39  ---..119..173..9
2ce40 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
2ce50 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
2ce60 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
2ce70 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
2ce80 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2ce90 2d 31 33 32 37 0d 0a 53 45 4c 45 43 54 20 2d 20  -1327..SELECT - 
2cea0 36 39 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 2b 20  69 * - col0 - + 
2ceb0 39 39 20 44 49 56 20 2d 20 63 6f 6c 30 20 46 52  99 DIV - col0 FR
2cec0 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
2ced0 0a 2d 2d 2d 2d 0d 0a 31 36 36 30 0d 0a 32 34 31  .----..1660..241
2cee0 37 0d 0a 36 31 34 32 0d 0a 0d 0a 73 6b 69 70 69  7..6142....skipi
2cef0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2cf00 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2cf10 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2cf20 31 33 32 37 0d 0a 53 45 4c 45 43 54 20 2d 20 36  1327..SELECT - 6
2cf30 39 20 2a 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 39  9 * - col0 - + 9
2cf40 39 20 2f 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20  9 / - col0 FROM 
2cf50 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
2cf60 2d 2d 0d 0a 31 36 36 30 0d 0a 32 34 31 37 0d 0a  --..1660..2417..
2cf70 36 31 34 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20  6142....query I 
2cf80 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2cf90 39 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2a  90 + cor0.col0 *
2cfa0 20 28 20 63 6f 72 30 2e 63 6f 6c 32 20 29 20 41   ( cor0.col2 ) A
2cfb0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2cfc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2cfd0 31 32 35 0d 0a 37 33 38 38 0d 0a 38 38 32 0d 0a  125..7388..882..
2cfe0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2cff0 74 0d 0a 53 45 4c 45 43 54 20 2b 20 35 37 20 46  t..SELECT + 57 F
2d000 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41  ROM tab0, tab1 A
2d010 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
2d020 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
2d030 6f 20 36 31 64 61 37 30 63 36 32 34 61 64 36 30  o 61da70c624ad60
2d040 36 30 34 61 36 36 38 66 37 66 38 66 32 39 33 39  604a668f7f8f2939
2d050 32 61 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  2a....query I ro
2d060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2d070 4c 20 2b 20 31 39 20 46 52 4f 4d 20 74 61 62 30  L + 19 FROM tab0
2d080 0d 0a 2d 2d 2d 2d 0d 0a 31 39 0d 0a 31 39 0d 0a  ..----..19..19..
2d090 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  19....query I ro
2d0a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f  wsort..SELECT co
2d0b0 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  l1 + col0 * + co
2d0c0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
2d0d0 2d 2d 0d 0a 32 30 38 37 0d 0a 32 32 30 0d 0a 33  --..2087..220..3
2d0e0 30 31 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  019....onlyif my
2d0f0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2d100 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2d110 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2d120 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2d130 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2d140 31 33 33 32 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  1332..SELECT ALL
2d150 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
2d160 49 47 4e 45 44 20 29 20 2f 20 63 6f 6c 31 20 46  IGNED ) / col1 F
2d170 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
2d180 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
2d190 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2d1a0 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2d1b0 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2d1c0 72 74 20 6c 61 62 65 6c 2d 31 33 33 32 0d 0a 53  rt label-1332..S
2d1d0 45 4c 45 43 54 20 41 4c 4c 20 43 41 53 54 20 28  ELECT ALL CAST (
2d1e0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2d1f0 20 29 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74   ) / col1 FROM t
2d200 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  ab0..----..NULL.
2d210 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71  .NULL..NULL....q
2d220 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2d230 53 45 4c 45 43 54 20 2b 20 35 30 20 46 52 4f 4d  SELECT + 50 FROM
2d240 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2d250 2d 2d 2d 0d 0a 35 30 0d 0a 35 30 0d 0a 35 30 0d  ---..50..50..50.
2d260 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d270 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  rt..SELECT ALL +
2d280 20 63 6f 6c 32 20 2d 20 2b 20 63 6f 6c 31 20 46   col2 - + col1 F
2d290 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
2d2a0 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 0d 0a 2d 34 0d  ..----..-33..-4.
2d2b0 0a 32 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .21....query I r
2d2c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
2d2d0 49 53 54 49 4e 43 54 20 2d 20 2b 20 63 6f 72 30  ISTINCT - + cor0
2d2e0 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 30 20 41  .col1 * - col0 A
2d2f0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
2d300 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2d310 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
2d320 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2d330 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
2d340 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
2d350 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
2d360 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2d370 31 33 33 36 0d 0a 53 45 4c 45 43 54 20 44 49 53  1336..SELECT DIS
2d380 54 49 4e 43 54 20 2b 20 2d 20 63 6f 72 30 2e 63  TINCT + - cor0.c
2d390 6f 6c 32 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c  ol2 DIV cor0.col
2d3a0 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2d3b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 0d 0a  or0..----..0....
2d3c0 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2d3d0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2d3e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2d3f0 61 62 65 6c 2d 31 33 33 36 0d 0a 53 45 4c 45 43  abel-1336..SELEC
2d400 54 20 44 49 53 54 49 4e 43 54 20 2b 20 2d 20 63  T DISTINCT + - c
2d410 6f 72 30 2e 63 6f 6c 32 20 2f 20 63 6f 72 30 2e  or0.col2 / cor0.
2d420 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
2d430 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
2d440 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2d450 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2d460 4e 43 54 20 2b 20 28 20 2b 20 63 6f 6c 30 20 29  NCT + ( + col0 )
2d470 20 2a 20 33 34 20 2a 20 2d 20 39 34 20 2b 20 63   * 34 * - 94 + c
2d480 6f 6c 32 20 2b 20 2d 20 39 30 20 46 52 4f 4d 20  ol2 + - 90 FROM 
2d490 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34  tab1..----..-204
2d4a0 35 37 37 0d 0a 2d 32 35 35 36 37 34 0d 0a 2d 39  577..-255674..-9
2d4b0 36 32 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  624....onlyif my
2d4c0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
2d4d0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
2d4e0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
2d4f0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2d500 65 6c 2d 31 33 33 38 0d 0a 53 45 4c 45 43 54 20  el-1338..SELECT 
2d510 28 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 29 20  ( - tab1.col2 ) 
2d520 44 49 56 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20  DIV - tab1.col0 
2d530 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2d540 0a 30 0d 0a 31 0d 0a 31 38 0d 0a 0d 0a 73 6b 69  .0..1..18....ski
2d550 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2d560 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2d570 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2d580 6c 2d 31 33 33 38 0d 0a 53 45 4c 45 43 54 20 28  l-1338..SELECT (
2d590 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 29 20 2f   - tab1.col2 ) /
2d5a0 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 46 52 4f   - tab1.col0 FRO
2d5b0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
2d5c0 0a 31 0d 0a 31 38 0d 0a 0d 0a 71 75 65 72 79 20  .1..18....query 
2d5d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2d5e0 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c  T ALL col0 + col
2d5f0 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
2d600 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
2d610 2d 0d 0a 31 37 31 0d 0a 33 36 0d 0a 35 37 0d 0a  -..171..36..57..
2d620 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d630 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f  t..SELECT + - co
2d640 6c 32 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20 74  l2 + col2 FROM t
2d650 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2d660 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75 65 72 79  0..0..0....query
2d670 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d680 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  CT + cor0.col2 +
2d690 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f   - cor0.col0 FRO
2d6a0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2d6b0 2d 2d 2d 2d 0d 0a 2d 34 31 0d 0a 2d 35 32 0d 0a  ----..-41..-52..
2d6c0 32 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  20....query I ro
2d6d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2d6e0 53 54 49 4e 43 54 20 2b 20 2b 20 32 35 20 46 52  STINCT + + 25 FR
2d6f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2d700 0a 2d 2d 2d 2d 0d 0a 32 35 0d 0a 0d 0a 6f 6e 6c  .----..25....onl
2d710 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20  yif mysql # use 
2d720 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72  DIV operator for
2d730 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f   integer divisio
2d740 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  n..query I rowso
2d750 72 74 20 6c 61 62 65 6c 2d 31 33 34 33 0d 0a 53  rt label-1343..S
2d760 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49 56  ELECT + col0 DIV
2d770 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   - col2 FROM tab
2d780 30 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  0 cor0..----..-1
2d790 0d 0a 2d 33 35 0d 0a 30 0d 0a 0d 0a 73 6b 69 70  ..-35..0....skip
2d7a0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
2d7b0 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
2d7c0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2d7d0 2d 31 33 34 33 0d 0a 53 45 4c 45 43 54 20 2b 20  -1343..SELECT + 
2d7e0 63 6f 6c 30 20 2f 20 2d 20 63 6f 6c 32 20 46 52  col0 / - col2 FR
2d7f0 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a 2d 2d  OM tab0 cor0..--
2d800 2d 2d 0d 0a 2d 31 0d 0a 2d 33 35 0d 0a 30 0d 0a  --..-1..-35..0..
2d810 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2d820 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2d830 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2d840 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2d850 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2d860 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2d870 43 54 20 41 4c 4c 20 2d 20 2b 20 28 20 2d 20 63  CT ALL - + ( - c
2d880 6f 6c 32 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 ) col1 FROM 
2d890 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2d8a0 2d 2d 0d 0a 32 36 0d 0a 32 37 0d 0a 33 38 0d 0a  --..26..27..38..
2d8b0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2d8c0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2d8d0 43 54 20 2d 20 36 34 20 46 52 4f 4d 20 74 61 62  CT - 64 FROM tab
2d8e0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2d8f0 0a 2d 36 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-64....query I 
2d900 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2d910 2d 20 63 6f 72 31 2e 63 6f 6c 31 20 41 53 20 63  - cor1.col1 AS c
2d920 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
2d930 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
2d940 20 74 61 62 31 20 41 53 20 63 6f 72 31 0d 0a 2d   tab1 AS cor1..-
2d950 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61  ---..9 values ha
2d960 73 68 69 6e 67 20 74 6f 20 62 32 33 34 37 39 38  shing to b234798
2d970 64 34 37 30 36 33 31 34 62 61 31 34 65 61 61 64  d4706314ba14eaad
2d980 35 33 39 64 30 61 61 38 38 0d 0a 0d 0a 71 75 65  539d0aa88....que
2d990 72 79 20 49 49 49 49 49 49 49 49 49 20 72 6f 77  ry IIIIIIIII row
2d9a0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2d9b0 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20   * FROM tab1 AS 
2d9c0 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e 20  cor0 CROSS JOIN 
2d9d0 74 61 62 32 2c 20 74 61 62 30 20 63 6f 72 31 0d  tab2, tab0 cor1.
2d9e0 0a 2d 2d 2d 2d 0d 0a 32 34 33 20 76 61 6c 75 65  .----..243 value
2d9f0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 35 36 36  s hashing to 566
2da00 31 38 30 65 30 31 34 34 33 35 30 61 37 38 62 30  180e0144350a78b0
2da10 65 66 33 33 31 38 65 38 66 34 63 30 30 0d 0a 0d  ef3318e8f4c00...
2da20 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2da30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
2da40 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  or0.col1 * + col
2da50 30 20 2d 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63  0 - - col1 * + c
2da60 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
2da70 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2da80 2d 2d 2d 0d 0a 2d 33 32 39 38 0d 0a 2d 36 33 37  ---..-3298..-637
2da90 0d 0a 37 37 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..774....query I
2daa0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2dab0 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31 20 41   - col2 + col1 A
2dac0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2dad0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2dae0 2d 32 31 0d 0a 33 33 0d 0a 34 0d 0a 0d 0a 6f 6e  -21..33..4....on
2daf0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2db00 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2db10 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2db20 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2db30 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2db40 20 6c 61 62 65 6c 2d 31 33 35 30 0d 0a 53 45 4c   label-1350..SEL
2db50 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 30 20 2b  ECT ALL + col0 +
2db60 20 43 41 53 54 28 20 2b 20 63 6f 6c 31 20 41 53   CAST( + col1 AS
2db70 20 53 49 47 4e 45 44 20 29 20 41 53 20 63 6f 6c   SIGNED ) AS col
2db80 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2db90 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 39 0d 0a 37  or0..----..29..7
2dba0 34 0d 0a 39 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  4..93....skipif 
2dbb0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2dbc0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2dbd0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2dbe0 35 30 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b  50..SELECT ALL +
2dbf0 20 63 6f 6c 30 20 2b 20 43 41 53 54 20 28 20 2b   col0 + CAST ( +
2dc00 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52   col1 AS INTEGER
2dc10 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
2dc20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2dc30 2d 2d 0d 0a 32 39 0d 0a 37 34 0d 0a 39 33 0d 0a  --..29..74..93..
2dc40 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2dc50 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2dc60 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2dc70 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2dc80 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2dc90 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2dca0 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f  CT DISTINCT + co
2dcb0 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 2d 20 2b 20  l2 * - col1 - + 
2dcc0 28 20 63 6f 6c 30 20 29 20 63 6f 6c 30 20 46 52  ( col0 ) col0 FR
2dcd0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2dce0 0a 2d 2d 2d 2d 0d 0a 2d 31 36 31 32 0d 0a 2d 37  .----..-1612..-7
2dcf0 32 35 0d 0a 2d 38 34 34 0d 0a 0d 0a 71 75 65 72  25..-844....quer
2dd00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dd10 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63  ECT DISTINCT + c
2dd20 6f 6c 32 20 2a 20 2b 20 38 34 20 2b 20 35 32 20  ol2 * + 84 + 52 
2dd30 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31  - + col1 AS col1
2dd40 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
2dd50 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 37 33 38 0d 0a  r0..----..2738..
2dd60 33 39 0d 0a 36 38 34 39 0d 0a 0d 0a 71 75 65 72  39..6849....quer
2dd70 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dd80 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f 6c 30  ECT ALL - + col0
2dd90 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
2dda0 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  2 FROM tab1 AS c
2ddb0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 34 30 39 36 0d  or0..----..4096.
2ddc0 0a 36 34 30 30 0d 0a 39 0d 0a 0d 0a 71 75 65 72  .6400..9....quer
2ddd0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2dde0 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63  ECT ALL col0 + c
2ddf0 6f 6c 30 20 2a 20 35 32 20 2b 20 2b 20 63 6f 6c  ol0 * 52 + + col
2de00 30 20 2a 20 39 32 20 41 53 20 63 6f 6c 32 20 46  0 * 92 AS col2 F
2de10 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
2de20 2d 2d 2d 0d 0a 31 31 36 30 30 0d 0a 34 33 35 0d  ---..11600..435.
2de30 0a 39 32 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .9280....query I
2de40 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2de50 20 2d 20 63 6f 6c 32 20 2b 20 28 20 2d 20 37 30   - col2 + ( - 70
2de60 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
2de70 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2de80 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 39 36 0d 0a 2d  --..-108..-96..-
2de90 39 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  97....query I ro
2dea0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2deb0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 31 20 2b 20  STINCT - col1 + 
2dec0 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2b 20  + cor0.col1 * + 
2ded0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
2dee0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
2def0 32 37 0d 0a 35 32 0d 0a 36 33 30 0d 0a 0d 0a 71  27..52..630....q
2df00 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2df10 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2df20 2d 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  - col1 + col1 * 
2df30 2b 20 31 32 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 12 AS col1 FRO
2df40 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2df50 2d 2d 2d 2d 0d 0a 31 38 37 0d 0a 33 34 31 0d 0a  ----..187..341..
2df60 36 34 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  649....query I r
2df70 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2df80 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2b  LL - cor0.col2 +
2df90 20 35 30 20 2d 20 2b 20 63 6f 6c 31 20 46 52 4f   50 - + col1 FRO
2dfa0 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2dfb0 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 35 0d 0a 2d  ----..-35..-5..-
2dfc0 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  8....query I row
2dfd0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
2dfe0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 30 20 2a   col1 + - col0 *
2dff0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
2e000 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
2e010 31 39 37 38 0d 0a 2d 33 32 39 38 0d 0a 2d 38 30  1978..-3298..-80
2e020 30 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  08....skipif pos
2e030 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2e040 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2e050 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2e060 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
2e070 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2e080 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
2e090 33 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  36 col2 FROM tab
2e0a0 30 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  0, tab0 AS cor0.
2e0b0 0a 2d 2d 2d 2d 0d 0a 33 36 0d 0a 0d 0a 73 6b 69  .----..36....ski
2e0c0 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
2e0d0 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
2e0e0 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
2e0f0 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
2e100 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
2e110 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
2e120 4c 20 2d 20 63 6f 6c 32 20 2a 20 2b 20 32 30 20  L - col2 * + 20 
2e130 2d 20 2d 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  - - col1 col2 FR
2e140 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e150 0a 2d 2d 2d 2d 0d 0a 2d 31 30 35 34 0d 0a 2d 31  .----..-1054..-1
2e160 31 33 30 0d 0a 2d 31 39 30 37 0d 0a 0d 0a 6f 6e  130..-1907....on
2e170 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
2e180 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
2e190 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
2e1a0 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
2e1b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2e1c0 20 6c 61 62 65 6c 2d 31 33 36 32 0d 0a 53 45 4c   label-1362..SEL
2e1d0 45 43 54 20 41 4c 4c 20 2d 20 2b 20 43 41 53 54  ECT ALL - + CAST
2e1e0 28 20 2b 20 63 6f 6c 30 20 41 53 20 53 49 47 4e  ( + col0 AS SIGN
2e1f0 45 44 20 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f  ED ) + - cor0.co
2e200 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
2e210 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d  0..----..-110..-
2e220 31 33 32 0d 0a 2d 31 38 30 0d 0a 0d 0a 73 6b 69  132..-180....ski
2e230 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
2e240 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
2e250 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2e260 6c 2d 31 33 36 32 0d 0a 53 45 4c 45 43 54 20 41  l-1362..SELECT A
2e270 4c 4c 20 2d 20 2b 20 43 41 53 54 20 28 20 2b 20  LL - + CAST ( + 
2e280 63 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20  col0 AS INTEGER 
2e290 29 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20  ) + - cor0.col1 
2e2a0 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30 0d 0a  FROM tab0 cor0..
2e2b0 2d 2d 2d 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33 32  ----..-110..-132
2e2c0 0d 0a 2d 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-180....query 
2e2d0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e2e0 54 20 28 20 2d 20 63 6f 6c 32 20 29 20 2b 20 2d  T ( - col2 ) + -
2e2f0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2e300 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
2e310 0a 2d 2d 2d 2d 0d 0a 2d 31 32 31 0d 0a 2d 31 37  .----..-121..-17
2e320 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72 79 20  6..-57....query 
2e330 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e340 54 20 2b 20 2d 20 28 20 2b 20 63 6f 6c 31 20 29  T + - ( + col1 )
2e350 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   * + col1 AS col
2e360 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63  0 FROM tab1 AS c
2e370 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 30 0d  or0..----..-100.
2e380 0a 2d 31 36 39 0d 0a 2d 36 37 36 0d 0a 0d 0a 73  .-169..-676....s
2e390 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2e3a0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2e3b0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2e3c0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
2e3d0 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
2e3e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
2e3f0 44 49 53 54 49 4e 43 54 20 2d 20 35 20 2b 20 2d  DISTINCT - 5 + -
2e400 20 35 36 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   56 col2 FROM ta
2e410 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
2e420 0d 0a 2d 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49  ..-61....query I
2e430 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2e440 20 2b 20 34 33 20 41 53 20 63 6f 6c 32 20 46 52   + 43 AS col2 FR
2e450 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 20 41 53  OM tab1, tab2 AS
2e460 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76   cor0..----..9 v
2e470 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
2e480 20 31 39 39 31 30 35 36 31 39 30 34 39 32 37 31   199105619049271
2e490 31 34 37 39 35 36 64 65 35 32 65 37 66 35 65 64  147956de52e7f5ed
2e4a0 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
2e4b0 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
2e4c0 54 49 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c  TINCT - cor0.col
2e4d0 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  2 AS col2 FROM t
2e4e0 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
2e4f0 2d 32 36 0d 0a 2d 32 37 0d 0a 2d 33 38 0d 0a 0d  -26..-27..-38...
2e500 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
2e510 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
2e520 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
2e530 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
2e540 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
2e550 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2e560 54 20 41 4c 4c 20 2b 20 32 30 20 63 6f 6c 30 20  T ALL + 20 col0 
2e570 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
2e580 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 0d 0a 32 30 0d  0..----..20..20.
2e590 0a 32 30 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .20....onlyif my
2e5a0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
2e5b0 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
2e5c0 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
2e5d0 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
2e5e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2e5f0 31 33 36 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  1369..SELECT DIS
2e600 54 49 4e 43 54 20 2b 20 43 41 53 54 28 20 63 6f  TINCT + CAST( co
2e610 6c 31 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  l1 AS SIGNED ) A
2e620 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31  S col1 FROM tab1
2e630 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2e640 31 30 0d 0a 31 33 0d 0a 32 36 0d 0a 0d 0a 73 6b  10..13..26....sk
2e650 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
2e660 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
2e670 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
2e680 65 6c 2d 31 33 36 39 0d 0a 53 45 4c 45 43 54 20  el-1369..SELECT 
2e690 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54 20  DISTINCT + CAST 
2e6a0 28 20 63 6f 6c 31 20 41 53 20 49 4e 54 45 47 45  ( col1 AS INTEGE
2e6b0 52 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  R ) AS col1 FROM
2e6c0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
2e6d0 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a 32 36 0d  ---..10..13..26.
2e6e0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2e6f0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2e700 4e 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20  NCT - cor0.col0 
2e710 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f  + cor0.col1 * co
2e720 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
2e730 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
2e740 2d 2d 0d 0a 35 37 36 0d 0a 37 35 0d 0a 39 36 30  --..576..75..960
2e750 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2e760 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2e770 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2e780 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2e790 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2e7a0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37  owsort label-137
2e7b0 31 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 43 41  1..SELECT + + CA
2e7c0 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e  ST( NULL AS SIGN
2e7d0 45 44 20 29 20 2a 20 32 32 20 46 52 4f 4d 20 74  ED ) * 22 FROM t
2e7e0 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
2e7f0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  NULL..NULL..NULL
2e800 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
2e810 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
2e820 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
2e830 72 74 20 6c 61 62 65 6c 2d 31 33 37 31 0d 0a 53  rt label-1371..S
2e840 45 4c 45 43 54 20 2b 20 2b 20 43 41 53 54 20 28  ELECT + + CAST (
2e850 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
2e860 20 29 20 2a 20 32 32 20 46 52 4f 4d 20 74 61 62   ) * 22 FROM tab
2e870 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  1 cor0..----..NU
2e880 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
2e890 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2e8a0 74 0d 0a 53 45 4c 45 43 54 20 37 32 20 41 53 20  t..SELECT 72 AS 
2e8b0 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
2e8c0 2d 2d 2d 2d 0d 0a 37 32 0d 0a 37 32 0d 0a 37 32  ----..72..72..72
2e8d0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
2e8e0 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d   # support for M
2e8f0 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73 79  ySQL specific sy
2e900 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73  stem types and s
2e910 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72  yntax..query I r
2e920 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33 37  owsort label-137
2e930 33 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53 54  3..SELECT + CAST
2e940 28 20 63 6f 6c 32 20 41 53 20 53 49 47 4e 45 44  ( col2 AS SIGNED
2e950 20 29 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20   ) FROM tab0 AS 
2e960 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 33  cor0..----..1..3
2e970 33 0d 0a 38 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  3..82....skipif 
2e980 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
2e990 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
2e9a0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2e9b0 37 33 0d 0a 53 45 4c 45 43 54 20 2b 20 43 41 53  73..SELECT + CAS
2e9c0 54 20 28 20 63 6f 6c 32 20 41 53 20 49 4e 54 45  T ( col2 AS INTE
2e9d0 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
2e9e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
2e9f0 0d 0a 33 33 0d 0a 38 32 0d 0a 0d 0a 71 75 65 72  ..33..82....quer
2ea00 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ea10 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2b  ECT + - col1 + +
2ea20 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
2ea30 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32  AS cor0..----..2
2ea40 38 0d 0a 34 37 0d 0a 38 33 0d 0a 0d 0a 71 75 65  8..47..83....que
2ea50 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
2ea60 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20 36 31  LECT - col1 + 61
2ea70 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
2ea80 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2ea90 0d 0a 32 0d 0a 33 30 0d 0a 34 34 0d 0a 0d 0a 71  ..2..30..44....q
2eaa0 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49 49  uery IIIIIIIIIII
2eab0 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  IIII rowsort..SE
2eac0 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 32  LECT * FROM tab2
2ead0 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 20 43  , tab0 AS cor0 C
2eae0 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30 2c 20  ROSS JOIN tab0, 
2eaf0 74 61 62 31 20 63 6f 72 31 2c 20 74 61 62 32 20  tab1 cor1, tab2 
2eb00 41 53 20 63 6f 72 32 0d 0a 2d 2d 2d 2d 0d 0a 33  AS cor2..----..3
2eb10 36 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69  645 values hashi
2eb20 6e 67 20 74 6f 20 38 31 61 32 37 39 35 35 31 34  ng to 81a2795514
2eb30 37 31 33 33 63 34 37 63 39 65 38 65 36 33 64 61  7133c47c9e8e63da
2eb40 63 63 35 63 33 37 0d 0a 0d 0a 71 75 65 72 79 20  cc5c37....query 
2eb50 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2eb60 54 20 44 49 53 54 49 4e 43 54 20 33 35 20 41 53  T DISTINCT 35 AS
2eb70 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
2eb80 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 0d 0a 71 75 65  .----..35....que
2eb90 72 79 20 49 49 49 49 49 49 49 49 49 49 49 49 49  ry IIIIIIIIIIIII
2eba0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
2ebb0 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20 46 52  CT DISTINCT * FR
2ebc0 4f 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53  OM tab0, tab1 AS
2ebd0 20 63 6f 72 30 20 43 52 4f 53 53 20 4a 4f 49 4e   cor0 CROSS JOIN
2ebe0 20 74 61 62 32 2c 20 74 61 62 31 2c 20 74 61 62   tab2, tab1, tab
2ebf0 30 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36  0 cor1..----..36
2ec00 34 35 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  45 values hashin
2ec10 67 20 74 6f 20 39 64 37 34 36 65 31 35 66 64 62  g to 9d746e15fdb
2ec20 35 61 64 63 62 34 33 61 37 35 31 38 63 64 39 37  5adcb43a7518cd97
2ec30 34 33 65 62 33 0d 0a 0d 0a 73 6b 69 70 69 66 20  43eb3....skipif 
2ec40 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
2ec50 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
2ec60 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
2ec70 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
2ec80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ec90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2eca0 43 54 20 28 20 63 6f 6c 30 20 29 20 63 6f 6c 31  CT ( col0 ) col1
2ecb0 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2ecc0 0d 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a  ..24..35..89....
2ecd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2ece0 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
2ecf0 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 72 30 2e 63   col0 + + cor0.c
2ed00 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol1 FROM tab0 AS
2ed10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 31 35   cor0..----..215
2ed20 30 0d 0a 33 34 39 32 0d 0a 38 31 39 30 0d 0a 0d  0..3492..8190...
2ed30 0a 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49  .query IIIIIIIII
2ed40 49 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a  IIIIII rowsort..
2ed50 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61  SELECT * FROM ta
2ed60 62 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 30  b0, tab2 AS cor0
2ed70 2c 20 74 61 62 31 20 41 53 20 63 6f 72 31 2c 20  , tab1 AS cor1, 
2ed80 74 61 62 32 2c 20 74 61 62 32 20 63 6f 72 32 0d  tab2, tab2 cor2.
2ed90 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61 6c 75  .----..3645 valu
2eda0 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 33  es hashing to e3
2edb0 38 32 36 62 63 32 37 39 37 30 64 64 31 61 34 34  826bc27970dd1a44
2edc0 31 61 39 63 64 34 63 31 33 62 30 39 36 64 0d 0a  1a9cd4c13b096d..
2edd0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
2ede0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
2edf0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
2ee00 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
2ee10 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
2ee20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2ee30 43 54 20 41 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20  CT ALL - col0 * 
2ee40 2b 20 63 6f 6c 31 20 63 6f 6c 30 20 46 52 4f 4d  + col1 col0 FROM
2ee50 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
2ee60 2d 2d 2d 0d 0a 2d 32 30 36 34 0d 0a 2d 33 33 39  ---..-2064..-339
2ee70 35 0d 0a 2d 38 30 39 39 0d 0a 0d 0a 71 75 65 72  5..-8099....quer
2ee80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2ee90 45 43 54 20 35 34 20 2a 20 63 6f 6c 32 20 46 52  ECT 54 * col2 FR
2eea0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
2eeb0 34 30 34 0d 0a 31 34 35 38 0d 0a 32 30 35 32 0d  404..1458..2052.
2eec0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2eed0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
2eee0 4e 43 54 20 2b 20 63 6f 6c 31 20 2a 20 31 31 20  NCT + col1 * 11 
2eef0 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2ef00 0a 31 38 37 0d 0a 33 34 31 0d 0a 36 34 39 0d 0a  .187..341..649..
2ef10 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2ef20 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a  t..SELECT col2 *
2ef30 20 31 39 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d   19 FROM tab2..-
2ef40 2d 2d 2d 0d 0a 34 39 34 0d 0a 35 31 33 0d 0a 37  ---..494..513..7
2ef50 32 32 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  22....onlyif mys
2ef60 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
2ef70 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
2ef80 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
2ef90 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2efa0 6c 2d 31 33 38 36 0d 0a 53 45 4c 45 43 54 20 2d  l-1386..SELECT -
2efb0 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   - col2 + cor0.c
2efc0 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20  ol0 + cor0.col1 
2efd0 44 49 56 20 34 35 20 46 52 4f 4d 20 74 61 62 31  DIV 45 FROM tab1
2efe0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2eff0 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d 0a  121..176..57....
2f000 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
2f010 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
2f020 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
2f030 61 62 65 6c 2d 31 33 38 36 0d 0a 53 45 4c 45 43  abel-1386..SELEC
2f040 54 20 2d 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 72  T - - col2 + cor
2f050 30 2e 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f  0.col0 + cor0.co
2f060 6c 31 20 2f 20 34 35 20 46 52 4f 4d 20 74 61 62  l1 / 45 FROM tab
2f070 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
2f080 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
2f090 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f0a0 0d 0a 53 45 4c 45 43 54 20 34 20 41 53 20 63 6f  ..SELECT 4 AS co
2f0b0 6c 32 20 46 52 4f 4d 20 74 61 62 31 2c 20 74 61  l2 FROM tab1, ta
2f0c0 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
2f0d0 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69  ..9 values hashi
2f0e0 6e 67 20 74 6f 20 36 66 65 63 39 36 35 62 36 30  ng to 6fec965b60
2f0f0 62 39 38 38 35 63 34 61 66 37 33 65 38 35 34 32  b9885c4af73e8542
2f100 32 63 66 64 39 62 0d 0a 0d 0a 71 75 65 72 79 20  2cfd9b....query 
2f110 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f120 54 20 41 4c 4c 20 2b 20 36 32 20 46 52 4f 4d 20  T ALL + 62 FROM 
2f130 74 61 62 30 2c 20 74 61 62 30 20 63 6f 72 30 2c  tab0, tab0 cor0,
2f140 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d 0a 2d   tab2 AS cor1..-
2f150 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75 65 73 20 68  ---..27 values h
2f160 61 73 68 69 6e 67 20 74 6f 20 34 39 31 31 62 31  ashing to 4911b1
2f170 34 31 37 61 33 37 39 37 64 32 33 64 64 38 66 33  417a3797d23dd8f3
2f180 38 62 36 65 64 30 35 63 31 62 0d 0a 0d 0a 71 75  8b6ed05c1b....qu
2f190 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
2f1a0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 33 33 20 46  ELECT ALL + 33 F
2f1b0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32 20 63  ROM tab2, tab2 c
2f1c0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c  or0..----..9 val
2f1d0 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 36  ues hashing to 6
2f1e0 32 30 64 33 38 34 32 38 36 65 38 32 64 31 63 36  20d384286e82d1c6
2f1f0 63 38 62 31 62 32 62 31 30 39 61 37 64 61 35 0d  c8b1b2b109a7da5.
2f200 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
2f210 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 63  rt..SELECT - - c
2f220 6f 6c 31 20 2a 20 2b 20 31 34 20 41 53 20 63 6f  ol1 * + 14 AS co
2f230 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2f240 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 30 34  cor0..----..1204
2f250 0d 0a 31 32 37 34 0d 0a 31 33 35 38 0d 0a 0d 0a  ..1274..1358....
2f260 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
2f270 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
2f280 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
2f290 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
2f2a0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
2f2b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
2f2c0 20 41 4c 4c 20 2d 20 31 33 20 63 6f 6c 32 20 46   ALL - 13 col2 F
2f2d0 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 31 20 41  ROM tab2, tab1 A
2f2e0 53 20 63 6f 72 30 2c 20 74 61 62 31 20 63 6f 72  S cor0, tab1 cor
2f2f0 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c 75  1..----..27 valu
2f300 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 63  es hashing to 1c
2f310 36 61 61 61 30 37 62 61 38 64 33 64 63 30 31 65  6aaa07ba8d3dc01e
2f320 65 36 31 36 65 31 36 62 65 66 36 30 66 32 0d 0a  e616e16bef60f2..
2f330 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
2f340 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
2f350 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
2f360 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
2f370 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 33  rowsort label-13
2f380 39 32 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  92..SELECT DISTI
2f390 4e 43 54 20 63 6f 6c 30 20 44 49 56 20 2b 20 35  NCT col0 DIV + 5
2f3a0 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
2f3b0 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69  -..0..1....skipi
2f3c0 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
2f3d0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
2f3e0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
2f3f0 31 33 39 32 0d 0a 53 45 4c 45 43 54 20 44 49 53  1392..SELECT DIS
2f400 54 49 4e 43 54 20 63 6f 6c 30 20 2f 20 2b 20 35  TINCT col0 / + 5
2f410 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  2 FROM tab0..---
2f420 2d 0d 0a 30 0d 0a 31 0d 0a 0d 0a 71 75 65 72 79  -..0..1....query
2f430 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
2f440 43 54 20 41 4c 4c 20 2b 20 63 6f 72 30 2e 63 6f  CT ALL + cor0.co
2f450 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
2f460 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62 31  tab0, tab1, tab1
2f470 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
2f480 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
2f490 67 20 74 6f 20 37 37 38 62 35 30 35 37 35 61 39  g to 778b50575a9
2f4a0 62 39 31 34 34 38 31 31 39 65 65 30 65 65 31 61  b91448119ee0ee1a
2f4b0 39 63 34 34 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9c44f....onlyif 
2f4c0 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20  mysql # support 
2f4d0 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66  for MySQL specif
2f4e0 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20  ic system types 
2f4f0 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72  and syntax..quer
2f500 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
2f510 6c 2d 31 33 39 34 0d 0a 53 45 4c 45 43 54 20 44  l-1394..SELECT D
2f520 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
2f530 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53   CAST( NULL AS S
2f540 49 47 4e 45 44 20 29 20 63 6f 6c 32 20 46 52 4f  IGNED ) col2 FRO
2f550 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  M tab0..----..NU
2f560 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  LL....skipif pos
2f570 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
2f580 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
2f590 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
2f5a0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
2f5b0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2f5c0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2f5d0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2f5e0 62 65 6c 2d 31 33 39 34 0d 0a 53 45 4c 45 43 54  bel-1394..SELECT
2f5f0 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30   DISTINCT + col0
2f600 20 2a 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41   * CAST ( NULL A
2f610 53 20 49 4e 54 45 47 45 52 20 29 20 63 6f 6c 32  S INTEGER ) col2
2f620 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d   FROM tab0..----
2f630 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
2f640 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2f650 54 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 2d 20  T tab1.col0 * - 
2f660 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
2f670 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
2f680 36 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30  62..-3648..-7680
2f690 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2f6a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
2f6b0 6c 32 20 2a 20 39 30 20 41 53 20 63 6f 6c 32 20  l2 * 90 AS col2 
2f6c0 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d  FROM tab0..----.
2f6d0 0a 2d 32 39 37 30 0d 0a 2d 37 33 38 30 0d 0a 2d  .-2970..-7380..-
2f6e0 39 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  90....query I ro
2f6f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
2f700 53 54 49 4e 43 54 20 39 32 20 41 53 20 63 6f 6c  STINCT 92 AS col
2f710 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
2f720 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2f730 0a 39 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  .92....skipif po
2f740 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
2f750 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
2f760 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
2f770 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
2f780 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f790 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2f7a0 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c   + cor0.col0 col
2f7b0 31 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  1 FROM tab0, tab
2f7c0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
2f7d0 0a 32 34 0d 0a 33 35 0d 0a 38 39 0d 0a 0d 0a 71  .24..35..89....q
2f7e0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
2f7f0 53 45 4c 45 43 54 20 2d 20 28 20 63 6f 6c 32 20  SELECT - ( col2 
2f800 2b 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 29 20  + - tab1.col1 ) 
2f810 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
2f820 0a 2d 32 38 0d 0a 2d 34 37 0d 0a 2d 38 33 0d 0a  .-28..-47..-83..
2f830 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2f840 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20 32 32  t..SELECT + + 22
2f850 20 2a 20 2d 20 33 36 20 46 52 4f 4d 20 74 61 62   * - 36 FROM tab
2f860 31 20 41 53 20 63 6f 72 30 20 43 52 4f 53 53 20  1 AS cor0 CROSS 
2f870 4a 4f 49 4e 20 74 61 62 30 20 41 53 20 63 6f 72  JOIN tab0 AS cor
2f880 31 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  1..----..9 value
2f890 73 20 68 61 73 68 69 6e 67 20 74 6f 20 65 66 65  s hashing to efe
2f8a0 38 61 66 34 36 34 62 39 63 39 33 65 65 34 63 34  8af464b9c93ee4c4
2f8b0 61 31 30 63 33 61 36 61 65 33 64 37 64 0d 0a 0d  a10c3a6ae3d7d...
2f8c0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f8d0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
2f8e0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
2f8f0 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32  M tab0..----..12
2f900 32 35 0d 0a 35 37 36 0d 0a 37 39 32 31 0d 0a 0d  25..576..7921...
2f910 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2f920 0d 0a 53 45 4c 45 43 54 20 2d 20 2d 20 33 30 20  ..SELECT - - 30 
2f930 2b 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 38 35 20  + - col0 * + 85 
2f940 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
2f950 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 31 30 0d 0a  0..----..-2010..
2f960 2d 32 39 34 35 0d 0a 2d 37 35 33 35 0d 0a 0d 0a  -2945..-7535....
2f970 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2f980 0a 53 45 4c 45 43 54 20 2b 20 2b 20 32 38 20 2b  .SELECT + + 28 +
2f990 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
2f9a0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
2f9b0 0a 2d 2d 2d 2d 0d 0a 31 30 36 0d 0a 31 30 37 0d  .----..106..107.
2f9c0 0a 33 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .35....query I r
2f9d0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
2f9e0 4c 4c 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  LL + col0 * + co
2f9f0 6c 32 20 2b 20 28 20 2d 20 63 6f 6c 30 20 29 20  l2 + ( - col0 ) 
2fa00 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d  FROM tab2..----.
2fa10 0a 31 38 32 0d 0a 31 39 35 30 0d 0a 32 39 32 33  .182..1950..2923
2fa20 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2fa30 6f 72 74 0d 0a 53 45 4c 45 43 54 20 33 37 20 41  ort..SELECT 37 A
2fa40 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
2fa50 0d 0a 2d 2d 2d 2d 0d 0a 33 37 0d 0a 33 37 0d 0a  ..----..37..37..
2fa60 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  37....query I ro
2fa70 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
2fa80 63 6f 6c 32 20 2d 20 63 6f 6c 30 20 46 52 4f 4d  col2 - col0 FROM
2fa90 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32   tab1..----..-12
2faa0 31 0d 0a 2d 31 37 36 0d 0a 2d 35 37 0d 0a 0d 0a  1..-176..-57....
2fab0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
2fac0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
2fad0 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31   - col1 + + col1
2fae0 20 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62   * col2 FROM tab
2faf0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
2fb00 0a 31 34 37 35 0d 0a 36 32 39 0d 0a 38 30 36 0d  .1475..629..806.
2fb10 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
2fb20 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
2fb30 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
2fb40 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
2fb50 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
2fb60 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
2fb70 45 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c  ECT DISTINCT col
2fb80 30 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 31 20  0 + col0 * col1 
2fb90 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
2fba0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
2fbb0 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a  88..3430..8188..
2fbc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
2fbd0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
2fbe0 43 54 20 2b 20 2b 20 63 6f 6c 31 20 2b 20 63 6f  CT + + col1 + co
2fbf0 6c 30 20 2b 20 2d 20 33 34 20 41 53 20 63 6f 6c  l0 + - 34 AS col
2fc00 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
2fc10 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 36 0d 0a  or0..----..146..
2fc20 37 36 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  76..98....query 
2fc30 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
2fc40 54 20 44 49 53 54 49 4e 43 54 20 63 6f 72 30 2e  T DISTINCT cor0.
2fc50 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 2a 20  col0 + + col2 * 
2fc60 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
2fc70 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
2fc80 2d 2d 2d 2d 0d 0a 31 35 32 33 0d 0a 37 33 36 0d  ----..1523..736.
2fc90 0a 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .754....onlyif m
2fca0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
2fcb0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
2fcc0 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
2fcd0 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
2fce0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
2fcf0 2d 31 34 31 31 0d 0a 53 45 4c 45 43 54 20 2d 20  -1411..SELECT - 
2fd00 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54 28 20 4e  col1 * - CAST( N
2fd10 55 4c 4c 20 41 53 20 44 45 43 49 4d 41 4c 20 29  ULL AS DECIMAL )
2fd20 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   + + col1 AS col
2fd30 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  1 FROM tab0 AS c
2fd40 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d  or0..----..NULL.
2fd50 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73  .NULL..NULL....s
2fd60 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
2fd70 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
2fd80 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
2fd90 62 65 6c 2d 31 34 31 31 0d 0a 53 45 4c 45 43 54  bel-1411..SELECT
2fda0 20 2d 20 63 6f 6c 31 20 2a 20 2d 20 43 41 53 54   - col1 * - CAST
2fdb0 20 28 20 4e 55 4c 4c 20 41 53 20 52 45 41 4c 20   ( NULL AS REAL 
2fdc0 29 20 2b 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  ) + + col1 AS co
2fdd0 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
2fde0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
2fdf0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..NULL..NULL....
2fe00 71 75 65 72 79 20 49 49 49 49 49 49 49 49 49 49  query IIIIIIIIII
2fe10 49 49 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53  IIIII rowsort..S
2fe20 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62  ELECT * FROM tab
2fe30 32 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30 2c  2, tab0 AS cor0,
2fe40 20 74 61 62 32 20 41 53 20 63 6f 72 31 2c 20 74   tab2 AS cor1, t
2fe50 61 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72  ab1, tab0 AS cor
2fe60 32 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 35 20 76 61  2..----..3645 va
2fe70 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
2fe80 62 38 30 33 66 32 64 36 30 32 61 32 38 64 61 35  b803f2d602a28da5
2fe90 63 66 33 35 64 64 63 37 63 37 66 61 32 65 65 62  cf35ddc7c7fa2eeb
2fea0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
2feb0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
2fec0 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  + cor0.col0 AS c
2fed0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74  ol1 FROM tab2, t
2fee0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
2fef0 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
2ff00 69 6e 67 20 74 6f 20 64 64 31 38 62 39 33 32 36  ing to dd18b9326
2ff10 33 61 36 63 64 34 32 35 66 63 37 63 63 38 34 64  3a6cd425fc7cc84d
2ff20 39 31 33 37 38 37 30 0d 0a 0d 0a 6f 6e 6c 79 69  9137870....onlyi
2ff30 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
2ff40 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
2ff50 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
2ff60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
2ff70 20 6c 61 62 65 6c 2d 31 34 31 34 0d 0a 53 45 4c   label-1414..SEL
2ff80 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 44  ECT ALL + col1 D
2ff90 49 56 20 39 36 20 63 6f 6c 30 20 46 52 4f 4d 20  IV 96 col0 FROM 
2ffa0 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
2ffb0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 73  --..0..0..0....s
2ffc0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
2ffd0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
2ffe0 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
2fff0 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
30000 6f 6c 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d  olumns..skipif m
30010 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
30020 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
30030 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 31  owsort label-141
30040 34 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20  4..SELECT ALL + 
30050 63 6f 6c 31 20 2f 20 39 36 20 63 6f 6c 30 20 46  col1 / 96 col0 F
30060 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30  ROM tab2 AS cor0
30070 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d  ..----..0..0..0.
30080 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
30090 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
300a0 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
300b0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
300c0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
300d0 34 31 35 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  415..SELECT DIST
300e0 49 4e 43 54 20 2d 20 28 20 2b 20 63 6f 6c 31 20  INCT - ( + col1 
300f0 29 20 44 49 56 20 2b 20 63 6f 6c 30 20 2b 20 2b  ) DIV + col0 + +
30100 20 43 41 53 54 28 20 63 6f 6c 32 20 41 53 20 53   CAST( col2 AS S
30110 49 47 4e 45 44 20 29 20 2d 20 2b 20 63 6f 6c 30  IGNED ) - + col0
30120 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d   col0 FROM tab0.
30130 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a 2d 38 0d 0a  .----..-36..-8..
30140 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74  6....skipif post
30150 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65  gresql # Postgre
30160 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20  SQL requires AS 
30170 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75  when renaming ou
30180 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73 6b  tput columns..sk
30190 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74  ipif mysql # not
301a0 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65   compatible..que
301b0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
301c0 65 6c 2d 31 34 31 35 0d 0a 53 45 4c 45 43 54 20  el-1415..SELECT 
301d0 44 49 53 54 49 4e 43 54 20 2d 20 28 20 2b 20 63  DISTINCT - ( + c
301e0 6f 6c 31 20 29 20 2f 20 2b 20 63 6f 6c 30 20 2b  ol1 ) / + col0 +
301f0 20 2b 20 43 41 53 54 20 28 20 63 6f 6c 32 20 41   + CAST ( col2 A
30200 53 20 49 4e 54 45 47 45 52 20 29 20 2d 20 2b 20  S INTEGER ) - + 
30210 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20 74  col0 col0 FROM t
30220 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d 0a  ab0..----..-36..
30230 2d 38 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49  -8..6....query I
30240 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30250 20 2d 20 39 30 20 2a 20 2d 20 31 36 20 2d 20 63   - 90 * - 16 - c
30260 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
30270 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30280 0d 0a 31 33 35 38 0d 0a 31 34 30 37 0d 0a 31 34  ..1358..1407..14
30290 33 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  39....query I ro
302a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
302b0 4c 20 28 20 2d 20 63 6f 6c 30 20 29 20 41 53 20  L ( - col0 ) AS 
302c0 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col0 FROM tab2..
302d0 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d 37 38 0d 0a 2d  ----..-7..-78..-
302e0 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
302f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39 37  wsort..SELECT 97
30300 20 2a 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 32   * - col0 * col2
30310 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
30320 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d  r0..----..-3395.
30330 0a 2d 37 30 37 39 30 36 0d 0a 2d 37 36 38 32 34  .-707906..-76824
30340 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30350 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 35 36  ort..SELECT - 56
30360 20 2a 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 72 30   * col0 * - cor0
30370 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52  .col2 AS col1 FR
30380 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
30390 0a 2d 2d 2d 2d 0d 0a 31 30 35 38 34 0d 0a 31 31  .----..10584..11
303a0 33 35 36 38 0d 0a 31 36 38 31 31 32 0d 0a 0d 0a  3568..168112....
303b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
303c0 0a 53 45 4c 45 43 54 20 28 20 63 6f 72 30 2e 63  .SELECT ( cor0.c
303d0 6f 6c 30 20 29 20 2a 20 2b 20 63 6f 6c 32 20 2d  ol0 ) * + col2 -
303e0 20 2b 20 37 35 20 41 53 20 63 6f 6c 32 20 46 52   + 75 AS col2 FR
303f0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
30400 0a 2d 2d 2d 2d 0d 0a 33 35 37 33 0d 0a 37 36 30  .----..3573..760
30410 35 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79 20 49  5..87....query I
30420 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30430 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 32   - col2 + + col2
30440 20 2a 20 63 6f 6c 31 20 41 53 20 63 6f 6c 31 20   * col1 AS col1 
30450 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
30460 30 0d 0a 2d 2d 2d 2d 0d 0a 31 35 30 38 0d 0a 36  0..----..1508..6
30470 30 38 0d 0a 38 31 30 0d 0a 0d 0a 71 75 65 72 79  08..810....query
30480 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
30490 43 54 20 41 4c 4c 20 2d 20 34 36 20 46 52 4f 4d  CT ALL - 46 FROM
304a0 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
304b0 2d 2d 2d 0d 0a 2d 34 36 0d 0a 2d 34 36 0d 0a 2d  ---..-46..-46..-
304c0 34 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  46....query I ro
304d0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
304e0 53 54 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f  STINCT col0 + co
304f0 6c 32 20 2a 20 2d 20 28 20 36 31 20 29 20 41 53  l2 * - ( 61 ) AS
30500 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20   col2 FROM tab1 
30510 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
30520 33 32 39 31 0d 0a 2d 33 34 31 33 0d 0a 2d 35 37  3291..-3413..-57
30530 37 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  76....query I ro
30540 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
30550 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 2a 20 2b 20  col0 * col2 * + 
30560 35 37 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  57 FROM tab1 cor
30570 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 37 39 33 36  0..----..-207936
30580 0d 0a 2d 34 33 37 37 36 30 0d 0a 2d 39 32 33 34  ..-437760..-9234
30590 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
305a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 35 30 20 2b  ort..SELECT 50 +
305b0 20 2d 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32   - col1 * + col2
305c0 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
305d0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 37 38 38 0d  r0..----..-2788.
305e0 0a 2d 34 37 0d 0a 2d 37 34 31 32 0d 0a 0d 0a 71  .-47..-7412....q
305f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
30600 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 39 39 20  SELECT ALL - 99 
30610 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  + - col2 * - col
30620 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  0 AS col0 FROM t
30630 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
30640 31 39 32 39 0d 0a 32 39 30 33 0d 0a 39 30 0d 0a  1929..2903..90..
30650 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30660 74 0d 0a 53 45 4c 45 43 54 20 2b 20 34 20 2b 20  t..SELECT + 4 + 
30670 2d 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  - col1 FROM tab2
30680 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33   cor0..----..-13
30690 0d 0a 2d 32 37 0d 0a 2d 35 35 0d 0a 0d 0a 71 75  ..-27..-55....qu
306a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
306b0 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2a  ELECT + - col2 *
306c0 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   - col0 FROM tab
306d0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
306e0 0a 31 36 32 0d 0a 33 36 34 38 0d 0a 37 36 38 30  .162..3648..7680
306f0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
30700 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 34 35  ort..SELECT - 45
30710 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
30720 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b2 AS cor0..----
30730 0d 0a 2d 34 35 0d 0a 2d 34 35 0d 0a 2d 34 35 0d  ..-45..-45..-45.
30740 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
30750 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
30760 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
30770 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
30780 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
30790 34 33 30 0d 0a 53 45 4c 45 43 54 20 2b 20 2b 20  430..SELECT + + 
307a0 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c 31  cor0.col1 * col1
307b0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 44 49 56   + cor0.col1 DIV
307c0 20 36 35 20 46 52 4f 4d 20 74 61 62 32 20 41 53   65 FROM tab2 AS
307d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 39   cor0..----..289
307e0 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a 0d 0a 73  ..3481..961....s
307f0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
30800 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
30810 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
30820 62 65 6c 2d 31 34 33 30 0d 0a 53 45 4c 45 43 54  bel-1430..SELECT
30830 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a   + + cor0.col1 *
30840 20 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c   col1 + cor0.col
30850 31 20 2f 20 36 35 20 46 52 4f 4d 20 74 61 62 32  1 / 65 FROM tab2
30860 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30870 32 38 39 0d 0a 33 34 38 31 0d 0a 39 36 31 0d 0a  289..3481..961..
30880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30890 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 36 20 2a  t..SELECT - 36 *
308a0 20 74 61 62 32 2e 63 6f 6c 32 20 41 53 20 63 6f   tab2.col2 AS co
308b0 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l2 FROM tab2..--
308c0 2d 2d 0d 0a 2d 31 33 36 38 0d 0a 2d 39 33 36 0d  --..-1368..-936.
308d0 0a 2d 39 37 32 0d 0a 0d 0a 73 6b 69 70 69 66 20  .-972....skipif 
308e0 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
308f0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
30900 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
30910 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
30920 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
30930 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
30940 43 54 20 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c 32  CT - + cor0.col2
30950 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
30960 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
30970 35 34 0d 0a 2d 35 37 0d 0a 2d 39 36 0d 0a 0d 0a  54..-57..-96....
30980 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
30990 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
309a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
309b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
309c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 33  wsort label-1433
309d0 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
309e0 54 20 2d 20 2d 20 33 38 20 44 49 56 20 63 6f 6c  T - - 38 DIV col
309f0 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  2 FROM tab0 AS c
30a00 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d  or0..----..0..1.
30a10 0a 33 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .38....skipif my
30a20 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
30a30 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
30a40 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 33 33  wsort label-1433
30a50 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
30a60 54 20 2d 20 2d 20 33 38 20 2f 20 63 6f 6c 32 20  T - - 38 / col2 
30a70 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
30a80 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33  0..----..0..1..3
30a90 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
30aa0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
30ab0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
30ac0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
30ad0 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
30ae0 2d 31 34 33 34 0d 0a 53 45 4c 45 43 54 20 2b 20  -1434..SELECT + 
30af0 63 6f 6c 31 20 44 49 56 20 63 6f 6c 30 20 63 6f  col1 DIV col0 co
30b00 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
30b10 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
30b20 0d 0a 38 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f  ..8....skipif po
30b30 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67  stgresql # Postg
30b40 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41  reSQL requires A
30b50 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20  S when renaming 
30b60 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a  output columns..
30b70 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
30b80 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
30b90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30ba0 61 62 65 6c 2d 31 34 33 34 0d 0a 53 45 4c 45 43  abel-1434..SELEC
30bb0 54 20 2b 20 63 6f 6c 31 20 2f 20 63 6f 6c 30 20  T + col1 / col0 
30bc0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
30bd0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  S cor0..----..0.
30be0 0a 30 0d 0a 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .0..8....query I
30bf0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
30c00 20 44 49 53 54 49 4e 43 54 20 2d 20 39 38 20 2a   DISTINCT - 98 *
30c10 20 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 41   col1 * - col2 A
30c20 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
30c30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
30c40 31 35 30 33 33 32 0d 0a 36 33 33 30 38 0d 0a 38  150332..63308..8
30c50 32 30 32 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  2026....query I 
30c60 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
30c70 2d 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20  - + col1 * col0 
30c80 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
30c90 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
30ca0 0a 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34  .-1343..-217..-4
30cb0 36 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  602....query I r
30cc0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
30cd0 4c 4c 20 2d 20 63 6f 6c 30 20 2a 20 63 6f 72 30  LL - col0 * cor0
30ce0 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52  .col1 AS col2 FR
30cf0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
30d00 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33 0d 0a 2d 32  .----..-1343..-2
30d10 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d 0a 71 75 65  17..-4602....que
30d20 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
30d30 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
30d40 63 6f 6c 32 20 2a 20 63 6f 6c 30 20 2a 20 2d 20  col2 * col0 * - 
30d50 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f  col0 AS col2 FRO
30d60 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
30d70 2d 2d 2d 2d 0d 0a 31 33 32 33 0d 0a 31 35 38 31  ----..1323..1581
30d80 38 34 0d 0a 32 33 37 31 35 38 0d 0a 0d 0a 71 75  84..237158....qu
30d90 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
30da0 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31  ELECT ALL + col1
30db0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   + col2 * - col1
30dc0 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
30dd0 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b0 AS cor0..----
30de0 0d 0a 2d 32 37 35 32 0d 0a 2d 37 33 37 31 0d 0a  ..-2752..-7371..
30df0 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
30e00 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
30e10 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63 6f   cor0.col0 AS co
30e20 6c 31 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61  l1 FROM tab2, ta
30e30 62 31 20 41 53 20 63 6f 72 30 2c 20 74 61 62 32  b1 AS cor0, tab2
30e40 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
30e50 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
30e60 67 20 74 6f 20 37 37 38 62 35 30 35 37 35 61 39  g to 778b50575a9
30e70 62 39 31 34 34 38 31 31 39 65 65 30 65 65 31 61  b91448119ee0ee1a
30e80 39 63 34 34 66 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  9c44f....onlyif 
30e90 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
30ea0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
30eb0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
30ec0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
30ed0 61 62 65 6c 2d 31 34 34 31 0d 0a 53 45 4c 45 43  abel-1441..SELEC
30ee0 54 20 2b 20 2d 20 63 6f 6c 32 20 2b 20 2b 20 63  T + - col2 + + c
30ef0 6f 6c 32 20 44 49 56 20 2b 20 32 31 20 46 52 4f  ol2 DIV + 21 FRO
30f00 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d  M tab1 cor0..---
30f10 2d 0d 0a 2d 35 32 0d 0a 2d 35 35 0d 0a 2d 39 32  -..-52..-55..-92
30f20 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
30f30 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
30f40 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
30f50 72 74 20 6c 61 62 65 6c 2d 31 34 34 31 0d 0a 53  rt label-1441..S
30f60 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20 2b  ELECT + - col2 +
30f70 20 2b 20 63 6f 6c 32 20 2f 20 2b 20 32 31 20 46   + col2 / + 21 F
30f80 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d  ROM tab1 cor0..-
30f90 2d 2d 2d 0d 0a 2d 35 32 0d 0a 2d 35 35 0d 0a 2d  ---..-52..-55..-
30fa0 39 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  92....query I ro
30fb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
30fc0 4c 20 2d 20 39 31 20 46 52 4f 4d 20 74 61 62 30  L - 91 FROM tab0
30fd0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 39 31   cor0..----..-91
30fe0 0d 0a 2d 39 31 0d 0a 2d 39 31 0d 0a 0d 0a 71 75  ..-91..-91....qu
30ff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
31000 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
31010 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 41   + col1 * col0 A
31020 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
31030 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31040 2d 31 33 34 33 0d 0a 2d 32 31 37 0d 0a 2d 34 36  -1343..-217..-46
31050 30 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  02....query I ro
31060 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20  wsort..SELECT + 
31070 2b 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e  + col0 + - cor0.
31080 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 32 20 46 52  col0 * - col2 FR
31090 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
310a0 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37 31 32  .----..165..3712
310b0 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72 79 20  ..7760....query 
310c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
310d0 54 20 41 4c 4c 20 2b 20 63 6f 6c 32 20 2b 20 36  T ALL + col2 + 6
310e0 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
310f0 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72  l1 FROM tab2 cor
31100 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 34 30 30 0d 0a 2d  0..----..-400..-
31110 34 37 33 32 0d 0a 2d 34 37 38 31 0d 0a 0d 0a 71  4732..-4781....q
31120 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31130 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
31140 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2b 20 2b 20  col0 * col0 + + 
31150 38 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  82 AS col2 FROM 
31160 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 33 30 37  tab0..----..1307
31170 0d 0a 36 35 38 0d 0a 38 30 30 33 0d 0a 0d 0a 71  ..658..8003....q
31180 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
31190 53 45 4c 45 43 54 20 2b 20 2b 20 63 6f 6c 31 20  SELECT + + col1 
311a0 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20 2b 20  * cor0.col0 + + 
311b0 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74  cor0.col2 FROM t
311c0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
311d0 2d 0d 0a 31 33 38 31 0d 0a 32 34 34 0d 0a 34 36  -..1381..244..46
311e0 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  28....query I ro
311f0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
31200 4c 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20 2b 20  L + cor0.col0 + 
31210 28 20 63 6f 6c 32 20 29 20 41 53 20 63 6f 6c 32  ( col2 ) AS col2
31220 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
31230 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31  r0..----..121..1
31240 37 36 0d 0a 35 37 0d 0a 0d 0a 71 75 65 72 79 20  76..57....query 
31250 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31260 54 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 31 20  T col2 + + col1 
31270 2a 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  * col2 FROM tab2
31280 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31290 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d 0a  1560..684..864..
312a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
312b0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
312c0 43 54 20 2b 20 63 6f 6c 30 20 2a 20 2b 20 63 6f  CT + col0 * + co
312d0 72 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20  r0.col2 AS col1 
312e0 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
312f0 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35 0d 0a 37 32 39  0..----..35..729
31300 38 0d 0a 37 39 32 0d 0a 0d 0a 71 75 65 72 79 20  8..792....query 
31310 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31320 54 20 2d 20 74 61 62 31 2e 63 6f 6c 30 20 46 52  T - tab1.col0 FR
31330 4f 4d 20 74 61 62 31 2c 20 74 61 62 32 2c 20 74  OM tab1, tab2, t
31340 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab1 cor0..----..
31350 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  27 values hashin
31360 67 20 74 6f 20 37 32 39 63 31 65 64 64 61 39 33  g to 729c1edda93
31370 33 32 33 39 38 32 39 39 66 33 39 63 64 31 37 34  32398299f39cd174
31380 65 64 38 34 30 0d 0a 0d 0a 71 75 65 72 79 20 49  ed840....query I
31390 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
313a0 20 44 49 53 54 49 4e 43 54 20 2b 20 37 33 20 2b   DISTINCT + 73 +
313b0 20 2d 20 74 61 62 30 2e 63 6f 6c 32 20 2a 20 63   - tab0.col2 * c
313c0 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol0 AS col0 FROM
313d0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31   tab0..----..-71
313e0 39 0d 0a 2d 37 32 32 35 0d 0a 33 38 0d 0a 0d 0a  9..-7225..38....
313f0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
31400 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
31410 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
31420 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
31430 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 35 33  wsort label-1453
31440 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
31450 32 20 44 49 56 20 2d 20 63 6f 6c 30 20 2b 20 2d  2 DIV - col0 + -
31460 20 63 6f 6c 32 20 2b 20 38 32 20 41 53 20 63 6f   col2 + 82 AS co
31470 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
31480 2d 2d 0d 0a 30 0d 0a 34 38 0d 0a 38 31 0d 0a 0d  --..0..48..81...
31490 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
314a0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
314b0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
314c0 6c 61 62 65 6c 2d 31 34 35 33 0d 0a 53 45 4c 45  label-1453..SELE
314d0 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f 20 2d 20  CT ALL col2 / - 
314e0 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 2b 20  col0 + - col2 + 
314f0 38 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  82 AS col2 FROM 
31500 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 34  tab0..----..0..4
31510 38 0d 0a 38 31 0d 0a 0d 0a 71 75 65 72 79 20 49  8..81....query I
31520 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31530 20 41 4c 4c 20 2b 20 28 20 63 6f 6c 31 20 29 20   ALL + ( col1 ) 
31540 2a 20 2d 20 35 37 20 2b 20 74 61 62 31 2e 63 6f  * - 57 + tab1.co
31550 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
31560 2d 2d 0d 0a 2d 31 34 35 36 0d 0a 2d 35 36 30 0d  --..-1456..-560.
31570 0a 2d 37 32 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .-728....query I
31580 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
31590 20 41 4c 4c 20 63 6f 6c 32 20 2b 20 2d 20 63 6f   ALL col2 + - co
315a0 6c 32 20 2a 20 2d 20 63 6f 6c 32 20 2b 20 2b 20  l2 * - col2 + + 
315b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
315c0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
315d0 35 35 0d 0a 33 0d 0a 36 38 38 38 0d 0a 0d 0a 73  55..3..6888....s
315e0 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
315f0 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
31600 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
31610 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
31620 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
31630 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
31640 41 4c 4c 20 63 6f 6c 30 20 2a 20 2d 20 28 20 63  ALL col0 * - ( c
31650 6f 72 30 2e 63 6f 6c 30 20 29 20 2a 20 2b 20 63  or0.col0 ) * + c
31660 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 63 6f 6c  ol2 + + col0 col
31670 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
31680 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 31 36  or0..----..-1316
31690 0d 0a 2d 31 35 38 31 30 36 0d 0a 2d 32 33 37 30  ..-158106..-2370
316a0 37 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  79....query I ro
316b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
316c0 4c 20 2b 20 33 37 20 2a 20 63 6f 6c 32 20 41 53  L + 37 * col2 AS
316d0 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20   col2 FROM tab0 
316e0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31  AS cor0..----..1
316f0 32 32 31 0d 0a 33 30 33 34 0d 0a 33 37 0d 0a 0d  221..3034..37...
31700 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31710 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2b 20  ..SELECT col2 + 
31720 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20  - col2 * - col1 
31730 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
31740 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
31750 0a 31 35 36 30 0d 0a 36 38 34 0d 0a 38 36 34 0d  .1560..684..864.
31760 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
31770 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 28  rt..SELECT ALL (
31780 20 2d 20 63 6f 6c 32 20 29 20 2b 20 63 6f 6c 31   - col2 ) + col1
31790 20 2a 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   * col1 FROM tab
317a0 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  2 AS cor0..----.
317b0 0a 32 35 31 0d 0a 33 34 35 35 0d 0a 39 33 34 0d  .251..3455..934.
317c0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
317d0 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
317e0 4e 43 54 20 2b 20 33 39 20 2b 20 2d 20 28 20 2b  NCT + 39 + - ( +
317f0 20 63 6f 72 30 2e 63 6f 6c 31 20 29 20 46 52 4f   cor0.col1 ) FRO
31800 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
31810 2d 2d 2d 2d 0d 0a 31 33 0d 0a 32 36 0d 0a 32 39  ----..13..26..29
31820 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31830 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  ort..SELECT - co
31840 72 30 2e 63 6f 6c 30 20 2a 20 2d 20 37 38 20 41  r0.col0 * - 78 A
31850 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
31860 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31870 31 38 37 32 0d 0a 32 37 33 30 0d 0a 36 39 34 32  1872..2730..6942
31880 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31890 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
318a0 2b 20 2d 20 63 6f 6c 30 20 2a 20 39 31 20 2b 20  + - col0 * 91 + 
318b0 63 6f 72 30 2e 63 6f 6c 31 20 46 52 4f 4d 20 74  cor0.col1 FROM t
318c0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
318d0 2d 0d 0a 2d 32 30 39 38 0d 0a 2d 33 30 38 38 0d  -..-2098..-3088.
318e0 0a 2d 38 30 30 38 0d 0a 0d 0a 6f 6e 6c 79 69 66  .-8008....onlyif
318f0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
31900 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
31910 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
31920 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
31930 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
31940 65 6c 2d 31 34 36 33 0d 0a 53 45 4c 45 43 54 20  el-1463..SELECT 
31950 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53 54 28  DISTINCT + CAST(
31960 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
31970 29 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72 30  ) FROM tab0 cor0
31980 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 0d 0a  ..----..NULL....
31990 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e  skipif mysql # n
319a0 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71  ot compatible..q
319b0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
319c0 61 62 65 6c 2d 31 34 36 33 0d 0a 53 45 4c 45 43  abel-1463..SELEC
319d0 54 20 44 49 53 54 49 4e 43 54 20 2b 20 43 41 53  T DISTINCT + CAS
319e0 54 20 28 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45  T ( NULL AS INTE
319f0 47 45 52 20 29 20 46 52 4f 4d 20 74 61 62 30 20  GER ) FROM tab0 
31a00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c  cor0..----..NULL
31a10 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
31a20 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
31a30 2d 20 28 20 63 6f 6c 32 20 29 20 2a 20 2b 20 63  - ( col2 ) * + c
31a40 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
31a50 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
31a60 2d 2d 2d 0d 0a 2d 31 36 32 0d 0a 2d 33 36 34 38  ---..-162..-3648
31a70 0d 0a 2d 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79  ..-7680....query
31a80 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
31a90 43 54 20 2b 20 2b 20 28 20 38 20 29 20 2b 20 2d  CT + + ( 8 ) + -
31aa0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20   col1 FROM tab0 
31ab0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
31ac0 37 38 0d 0a 2d 38 33 0d 0a 2d 38 39 0d 0a 0d 0a  78..-83..-89....
31ad0 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73  onlyif mysql # s
31ae0 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c  upport for MySQL
31af0 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65 6d   specific system
31b00 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61   types and synta
31b10 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  x..query I rowso
31b20 72 74 20 6c 61 62 65 6c 2d 31 34 36 36 0d 0a 53  rt label-1466..S
31b30 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 43 41 53  ELECT col2 - CAS
31b40 54 28 20 2d 20 63 6f 6c 32 20 2b 20 63 6f 6c 31  T( - col2 + col1
31b50 20 41 53 20 53 49 47 4e 45 44 20 29 20 41 53 20   AS SIGNED ) AS 
31b60 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col0 FROM tab0..
31b70 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d 39 35 0d 0a  ----..-20..-95..
31b80 37 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  73....skipif mys
31b90 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
31ba0 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
31bb0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 36 0d  sort label-1466.
31bc0 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2d 20 43  .SELECT col2 - C
31bd0 41 53 54 20 28 20 2d 20 63 6f 6c 32 20 2b 20 63  AST ( - col2 + c
31be0 6f 6c 31 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol1 AS INTEGER )
31bf0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
31c00 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 0d 0a 2d  b0..----..-20..-
31c10 39 35 0d 0a 37 33 0d 0a 0d 0a 71 75 65 72 79 20  95..73....query 
31c20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
31c30 54 20 63 6f 6c 30 20 2a 20 39 36 20 2b 20 2d 20  T col0 * 96 + - 
31c40 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46 52 4f  col2 AS col0 FRO
31c50 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 32  M tab0..----..22
31c60 37 31 0d 0a 33 33 35 39 0d 0a 38 34 36 32 0d 0a  71..3359..8462..
31c70 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
31c80 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
31c90 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
31ca0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
31cb0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
31cc0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 36 38 0d  sort label-1468.
31cd0 0a 53 45 4c 45 43 54 20 2d 20 43 41 53 54 28 20  .SELECT - CAST( 
31ce0 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
31cf0 20 2b 20 2d 20 63 6f 6c 31 20 2d 20 2b 20 63 6f   + - col1 - + co
31d00 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l2 FROM tab1 cor
31d10 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e  0..----..NULL..N
31d20 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69  ULL..NULL....ski
31d30 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20  pif mysql # not 
31d40 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72  compatible..quer
31d50 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
31d60 6c 2d 31 34 36 38 0d 0a 53 45 4c 45 43 54 20 2d  l-1468..SELECT -
31d70 20 43 41 53 54 20 28 20 4e 55 4c 4c 20 41 53 20   CAST ( NULL AS 
31d80 49 4e 54 45 47 45 52 20 29 20 2b 20 2d 20 63 6f  INTEGER ) + - co
31d90 6c 31 20 2d 20 2b 20 63 6f 6c 32 20 46 52 4f 4d  l1 - + col2 FROM
31da0 20 74 61 62 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d   tab1 cor0..----
31db0 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
31dc0 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  LL....query I ro
31dd0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 38 39  wsort..SELECT 89
31de0 20 2a 20 28 20 2d 20 63 6f 6c 32 20 29 20 46 52   * ( - col2 ) FR
31df0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
31e00 0a 2d 2d 2d 2d 0d 0a 2d 34 38 30 36 0d 0a 2d 35  .----..-4806..-5
31e10 30 37 33 0d 0a 2d 38 35 34 34 0d 0a 0d 0a 6f 6e  073..-8544....on
31e20 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
31e30 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
31e40 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
31e50 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
31e60 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37 30 0d 0a  ort label-1470..
31e70 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30 20 44 49  SELECT + col0 DI
31e80 56 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 63 6f  V + cor0.col2 co
31e90 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20  l1 FROM tab0 AS 
31ea0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31  cor0..----..0..1
31eb0 0d 0a 33 35 0d 0a 0d 0a 73 6b 69 70 69 66 20 70  ..35....skipif p
31ec0 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74  ostgresql # Post
31ed0 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73 20  greSQL requires 
31ee0 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67  AS when renaming
31ef0 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d   output columns.
31f00 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
31f10 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
31f20 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
31f30 6c 61 62 65 6c 2d 31 34 37 30 0d 0a 53 45 4c 45  label-1470..SELE
31f40 43 54 20 2b 20 63 6f 6c 30 20 2f 20 2b 20 63 6f  CT + col0 / + co
31f50 72 30 2e 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f  r0.col2 col1 FRO
31f60 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a  M tab0 AS cor0..
31f70 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 33 35 0d 0a  ----..0..1..35..
31f80 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
31f90 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
31fa0 43 54 20 2b 20 63 6f 6c 32 20 2a 20 31 33 20 41  CT + col2 * 13 A
31fb0 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  S col0 FROM tab0
31fc0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
31fd0 31 30 36 36 0d 0a 31 33 0d 0a 34 32 39 0d 0a 0d  1066..13..429...
31fe0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
31ff0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
32000 63 6f 6c 32 20 2b 20 2d 20 74 61 62 31 2e 63 6f  col2 + - tab1.co
32010 6c 31 20 2b 20 37 38 20 2a 20 2d 20 39 36 20 46  l1 + 78 * - 96 F
32020 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
32030 2d 33 38 35 30 0d 0a 2d 37 33 35 32 0d 0a 31 37  -3850..-7352..17
32040 39 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  9....onlyif mysq
32050 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f 72 20  l # support for 
32060 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63 20 73  MySQL specific s
32070 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e 64 20  ystem types and 
32080 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20 49 20  syntax..query I 
32090 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
320a0 37 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 28  73..SELECT CAST(
320b0 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
320c0 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d 20  ) * + col2 FROM 
320d0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
320e0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
320f0 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d  NULL....skipif m
32100 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61  ysql # not compa
32110 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72  tible..query I r
32120 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 37  owsort label-147
32130 33 0d 0a 53 45 4c 45 43 54 20 43 41 53 54 20 28  3..SELECT CAST (
32140 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
32150 20 29 20 2a 20 2b 20 63 6f 6c 32 20 46 52 4f 4d   ) * + col2 FROM
32160 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
32170 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
32180 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49  .NULL....query I
32190 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
321a0 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2b   DISTINCT col2 +
321b0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
321c0 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
321d0 0a 31 32 31 0d 0a 31 37 36 0d 0a 35 37 0d 0a 0d  .121..176..57...
321e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
321f0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2d  ..SELECT ALL - -
32200 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31 20 46   col2 * - col1 F
32210 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
32220 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36  ---..-1534..-646
32230 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-837....query 
32240 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
32250 54 20 41 4c 4c 20 2d 20 37 34 20 46 52 4f 4d 20  T ALL - 74 FROM 
32260 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
32270 2d 2d 0d 0a 2d 37 34 0d 0a 2d 37 34 0d 0a 2d 37  --..-74..-74..-7
32280 34 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  4....query I row
32290 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 31  sort..SELECT - 1
322a0 34 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62  4 FROM tab2, tab
322b0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
322c0 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e  .9 values hashin
322d0 67 20 74 6f 20 64 33 32 31 34 36 31 39 39 34 62  g to d321461994b
322e0 61 34 39 63 33 61 37 30 66 61 36 33 37 33 30 33  a49c3a70fa637303
322f0 32 66 63 39 34 0d 0a 0d 0a 71 75 65 72 79 20 49  2fc94....query I
32300 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32310 20 44 49 53 54 49 4e 43 54 20 2b 20 31 39 20 41   DISTINCT + 19 A
32320 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  S col0 FROM tab1
32330 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
32340 2d 0d 0a 31 39 0d 0a 0d 0a 71 75 65 72 79 20 49  -..19....query I
32350 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32360 20 41 4c 4c 20 28 20 2b 20 32 32 20 2a 20 2d 20   ALL ( + 22 * - 
32370 63 6f 6c 30 20 29 20 46 52 4f 4d 20 74 61 62 30  col0 ) FROM tab0
32380 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 39 35 38 0d 0a 2d  ..----..-1958..-
32390 35 32 38 0d 0a 2d 37 37 30 0d 0a 0d 0a 71 75 65  528..-770....que
323a0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
323b0 4c 45 43 54 20 41 4c 4c 20 28 20 2b 20 74 61 62  LECT ALL ( + tab
323c0 32 2e 63 6f 6c 32 20 29 20 2a 20 2b 20 63 6f 6c  2.col2 ) * + col
323d0 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  2 FROM tab2..---
323e0 2d 0d 0a 31 34 34 34 0d 0a 36 37 36 0d 0a 37 32  -..1444..676..72
323f0 39 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  9....query I row
32400 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c  sort..SELECT ALL
32410 20 2d 20 28 20 2b 20 74 61 62 30 2e 63 6f 6c 30   - ( + tab0.col0
32420 20 2b 20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c   + col1 ) AS col
32430 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  1 FROM tab0..---
32440 2d 0d 0a 2d 31 31 30 0d 0a 2d 31 33 32 0d 0a 2d  -..-110..-132..-
32450 31 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  180....query I r
32460 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
32470 49 53 54 49 4e 43 54 20 63 6f 6c 32 20 2a 20 2b  ISTINCT col2 * +
32480 20 33 35 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d   35 FROM tab1..-
32490 2d 2d 2d 0d 0a 31 38 39 30 0d 0a 31 39 39 35 0d  ---..1890..1995.
324a0 0a 33 33 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49  .3360....query I
324b0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
324c0 20 41 4c 4c 20 36 36 20 46 52 4f 4d 20 74 61 62   ALL 66 FROM tab
324d0 31 0d 0a 2d 2d 2d 2d 0d 0a 36 36 0d 0a 36 36 0d  1..----..66..66.
324e0 0a 36 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  .66....onlyif my
324f0 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66 6f  sql # support fo
32500 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69 63  r MySQL specific
32510 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61 6e   system types an
32520 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79 20  d syntax..query 
32530 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
32540 31 34 38 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63  1484..SELECT + c
32550 6f 6c 32 20 2b 20 2b 20 43 41 53 54 28 20 2d 20  ol2 + + CAST( - 
32560 63 6f 6c 30 20 41 53 20 53 49 47 4e 45 44 20 29  col0 AS SIGNED )
32570 20 2b 20 63 6f 6c 30 20 2a 20 35 31 20 46 52 4f   + col0 * 51 FRO
32580 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32590 2d 2d 2d 2d 0d 0a 33 37 37 0d 0a 33 39 32 36 0d  ----..377..3926.
325a0 0a 33 39 38 38 0d 0a 0d 0a 73 6b 69 70 69 66 20  .3988....skipif 
325b0 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
325c0 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
325d0 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34  rowsort label-14
325e0 38 34 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  84..SELECT + col
325f0 32 20 2b 20 2b 20 43 41 53 54 20 28 20 2d 20 63  2 + + CAST ( - c
32600 6f 6c 30 20 41 53 20 49 4e 54 45 47 45 52 20 29  ol0 AS INTEGER )
32610 20 2b 20 63 6f 6c 30 20 2a 20 35 31 20 46 52 4f   + col0 * 51 FRO
32620 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
32630 2d 2d 2d 2d 0d 0a 33 37 37 0d 0a 33 39 32 36 0d  ----..377..3926.
32640 0a 33 39 38 38 0d 0a 0d 0a 71 75 65 72 79 20 49  .3988....query I
32650 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
32660 20 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31   - col0 + + col1
32670 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d   FROM tab2..----
32680 0d 0a 2d 31 39 0d 0a 2d 36 32 0d 0a 32 34 0d 0a  ..-19..-62..24..
32690 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
326a0 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2b  t..SELECT col1 +
326b0 20 2b 20 33 31 20 2a 20 63 6f 6c 32 20 2b 20 63   + 31 * col2 + c
326c0 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d  ol0 AS col1 FROM
326d0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
326e0 2d 2d 2d 0d 0a 31 32 37 34 0d 0a 38 37 35 0d 0a  ---..1274..875..
326f0 39 34 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  943....query I r
32700 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
32710 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63   - cor0.col2 * c
32720 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c 30  or0.col1 AS col0
32730 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
32740 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 38 33 38 0d 0a  r0..----..2838..
32750 37 34 36 32 0d 0a 39 37 0d 0a 0d 0a 71 75 65 72  7462..97....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 2d 20 2b 20 63 6f 72 30 2e 63 6f 6c  ECT - + cor0.col
32780 30 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32 20  0 * - cor0.col2 
32790 2b 20 2d 20 31 33 20 2a 20 2b 20 63 6f 72 30 2e  + - 13 * + cor0.
327a0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
327b0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35  S cor0..----..-5
327c0 34 30 0d 0a 32 39 30 37 0d 0a 36 34 33 32 0d 0a  40..2907..6432..
327d0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
327e0 74 0d 0a 53 45 4c 45 43 54 20 32 38 20 46 52 4f  t..SELECT 28 FRO
327f0 4d 20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20  M tab0, tab1 AS 
32800 63 6f 72 30 2c 20 74 61 62 31 20 41 53 20 63 6f  cor0, tab1 AS co
32810 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76 61 6c  r1..----..27 val
32820 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20 38  ues hashing to 8
32830 61 33 39 35 38 30 35 38 37 66 32 38 33 31 30 37  a39580587f283107
32840 32 65 39 33 63 33 31 39 66 66 39 34 62 62 66 0d  2e93c319ff94bbf.
32850 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
32860 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
32870 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
32880 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
32890 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
328a0 34 39 30 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30  490..SELECT col0
328b0 20 44 49 56 20 2d 20 74 61 62 30 2e 63 6f 6c 31   DIV - tab0.col1
328c0 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
328d0 62 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30 0d 0a  b0..----..0..0..
328e0 30 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  0....skipif mysq
328f0 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
32900 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
32910 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 30 0d 0a  ort label-1490..
32920 53 45 4c 45 43 54 20 63 6f 6c 30 20 2f 20 2d 20  SELECT col0 / - 
32930 74 61 62 30 2e 63 6f 6c 31 20 41 53 20 63 6f 6c  tab0.col1 AS col
32940 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
32950 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71 75  -..0..0..0....qu
32960 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
32970 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
32980 6f 6c 32 20 2b 20 2b 20 74 61 62 30 2e 63 6f 6c  ol2 + + tab0.col
32990 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
329a0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 36 34 0d 0a  ab0..----..164..
329b0 32 0d 0a 36 36 0d 0a 0d 0a 71 75 65 72 79 20 49  2..66....query I
329c0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
329d0 20 41 4c 4c 20 2b 20 2d 20 31 30 20 46 52 4f 4d   ALL + - 10 FROM
329e0 20 74 61 62 30 2c 20 74 61 62 31 2c 20 74 61 62   tab0, tab1, tab
329f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
32a00 0a 32 37 20 76 61 6c 75 65 73 20 68 61 73 68 69  .27 values hashi
32a10 6e 67 20 74 6f 20 62 62 37 66 37 35 34 61 37 61  ng to bb7f754a7a
32a20 30 35 36 65 36 36 35 31 35 35 65 64 35 32 61 36  056e665155ed52a6
32a30 33 66 35 62 63 30 0d 0a 0d 0a 71 75 65 72 79 20  3f5bc0....query 
32a40 49 49 49 49 49 49 49 49 49 20 72 6f 77 73 6f 72  IIIIIIIII rowsor
32a50 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
32a60 20 74 61 62 32 20 41 53 20 63 6f 72 30 20 43 52   tab2 AS cor0 CR
32a70 4f 53 53 20 4a 4f 49 4e 20 74 61 62 32 2c 20 74  OSS JOIN tab2, t
32a80 61 62 32 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor1..----..
32a90 32 34 33 20 76 61 6c 75 65 73 20 68 61 73 68 69  243 values hashi
32aa0 6e 67 20 74 6f 20 35 61 63 32 39 62 64 36 65 33  ng to 5ac29bd6e3
32ab0 61 39 65 36 39 65 64 39 63 37 33 63 61 37 61 33  a9e69ed9c73ca7a3
32ac0 34 31 31 34 66 37 0d 0a 0d 0a 73 6b 69 70 69 66  4114f7....skipif
32ad0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
32ae0 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
32af0 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
32b00 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
32b10 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
32b20 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49  rt..SELECT DISTI
32b30 4e 43 54 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c  NCT + + cor0.col
32b40 30 20 2a 20 39 33 20 2a 20 63 6f 6c 31 20 63 6f  0 * 93 * col1 co
32b50 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
32b60 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 35 39 35 32  cor0..----..5952
32b70 30 0d 0a 37 32 35 34 0d 0a 39 36 37 32 30 0d 0a  0..7254..96720..
32b80 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
32b90 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
32ba0 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
32bb0 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
32bc0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
32bd0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 35 0d  sort label-1495.
32be0 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
32bf0 2e 63 6f 6c 31 20 2f 20 2d 20 43 41 53 54 28 20  .col1 / - CAST( 
32c00 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29  NULL AS SIGNED )
32c10 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
32c20 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
32c30 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55  ..NULL..NULL..NU
32c40 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  LL....skipif mys
32c50 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
32c60 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
32c70 73 6f 72 74 20 6c 61 62 65 6c 2d 31 34 39 35 0d  sort label-1495.
32c80 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 72 30  .SELECT ALL cor0
32c90 2e 63 6f 6c 31 20 2f 20 2d 20 43 41 53 54 20 28  .col1 / - CAST (
32ca0 20 4e 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52   NULL AS INTEGER
32cb0 20 29 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20   ) AS col1 FROM 
32cc0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
32cd0 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  --..NULL..NULL..
32ce0 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20 49 20  NULL....query I 
32cf0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
32d00 2b 20 2d 20 63 6f 6c 30 20 2a 20 28 20 63 6f 6c  + - col0 * ( col
32d10 32 20 29 20 46 52 4f 4d 20 74 61 62 31 20 41 53  2 ) FROM tab1 AS
32d20 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36   cor0..----..-16
32d30 32 0d 0a 2d 33 36 34 38 0d 0a 2d 37 36 38 30 0d  2..-3648..-7680.
32d40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
32d50 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d  rt..SELECT ALL -
32d60 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 41   + col2 * col2 A
32d70 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
32d80 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
32d90 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d 0a 2d 39  -2916..-3249..-9
32da0 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  216....query I r
32db0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
32dc0 4c 4c 20 2d 20 63 6f 72 30 2e 63 6f 6c 31 20 2a  LL - cor0.col1 *
32dd0 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f   + cor0.col2 FRO
32de0 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a  M tab1 AS cor0..
32df0 2d 2d 2d 2d 0d 0a 2d 31 32 34 38 0d 0a 2d 31 34  ----..-1248..-14
32e00 30 34 0d 0a 2d 35 37 30 0d 0a 0d 0a 71 75 65 72  04..-570....quer
32e10 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32e20 45 43 54 20 41 4c 4c 20 2d 20 2d 20 63 6f 6c 32  ECT ALL - - col2
32e30 20 2a 20 2d 20 33 36 20 2b 20 38 33 20 2b 20 2d   * - 36 + 83 + -
32e40 20 63 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 46   col0 * + col1 F
32e50 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
32e60 2d 2d 2d 0d 0a 2d 31 31 30 36 0d 0a 2d 32 36 32  ---..-1106..-262
32e70 38 0d 0a 2d 35 34 35 35 0d 0a 0d 0a 71 75 65 72  8..-5455....quer
32e80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
32e90 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b  ECT ALL + col1 +
32ea0 20 63 6f 6c 30 20 2b 20 63 6f 72 30 2e 63 6f 6c   col0 + cor0.col
32eb0 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74  1 AS col0 FROM t
32ec0 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
32ed0 2d 0d 0a 31 30 36 0d 0a 35 35 0d 0a 38 34 0d 0a  -..106..55..84..
32ee0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
32ef0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
32f00 43 54 20 2d 20 63 6f 6c 31 20 2a 20 63 6f 6c 32  CT - col1 * col2
32f10 20 2a 20 2d 20 63 6f 6c 30 20 2b 20 63 6f 6c 32   * - col0 + col2
32f20 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72 30 0d   FROM tab1 cor0.
32f30 0a 2d 2d 2d 2d 0d 0a 33 36 35 33 37 0d 0a 34 32  .----..36537..42
32f40 36 36 0d 0a 39 39 39 33 36 0d 0a 0d 0a 73 6b 69  66..99936....ski
32f50 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
32f60 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
32f70 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
32f80 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
32f90 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f  umns..query I ro
32fa0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
32fb0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 31 20 63 6f  STINCT + col1 co
32fc0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
32fd0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  cor0..----..10..
32fe0 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20  13..26....query 
32ff0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33000 54 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 30 20  T + col2 * col0 
33010 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
33020 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36  1..----..162..36
33030 34 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72  48..7680....quer
33040 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33050 45 43 54 20 44 49 53 54 49 4e 43 54 20 34 32 20  ECT DISTINCT 42 
33060 2b 20 2d 20 35 38 20 2a 20 63 6f 6c 31 20 46 52  + - 58 * col1 FR
33070 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d  OM tab0 AS cor0.
33080 0a 2d 2d 2d 2d 0d 0a 2d 34 39 34 36 0d 0a 2d 35  .----..-4946..-5
33090 32 33 36 0d 0a 2d 35 35 38 34 0d 0a 0d 0a 6f 6e  236..-5584....on
330a0 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
330b0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
330c0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
330d0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
330e0 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 35 0d 0a  ort label-1505..
330f0 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28 20 2b  SELECT ALL + ( +
33100 20 63 6f 6c 30 20 29 20 44 49 56 20 2b 20 63 6f   col0 ) DIV + co
33110 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l0 + + col2 AS c
33120 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
33130 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d  r0..----..2..34.
33140 0a 38 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  .83....skipif my
33150 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
33160 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
33170 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 30 35  wsort label-1505
33180 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 28  ..SELECT ALL + (
33190 20 2b 20 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f   + col0 ) / + co
331a0 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 41 53 20 63  l0 + + col2 AS c
331b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol2 FROM tab0 co
331c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 33 34 0d  r0..----..2..34.
331d0 0a 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .83....query I r
331e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
331f0 20 2b 20 33 37 20 2a 20 2b 20 63 6f 72 30 2e 63   + 37 * + cor0.c
33200 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
33210 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 37 30   cor0..----..370
33220 0d 0a 34 38 31 0d 0a 39 36 32 0d 0a 0d 0a 6f 6e  ..481..962....on
33230 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70  lyif mysql # sup
33240 70 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73  port for MySQL s
33250 70 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74  pecific system t
33260 79 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d  ypes and syntax.
33270 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33280 20 6c 61 62 65 6c 2d 31 35 30 37 0d 0a 53 45 4c   label-1507..SEL
33290 45 43 54 20 41 4c 4c 20 43 41 53 54 28 20 2d 20  ECT ALL CAST( - 
332a0 33 38 20 41 53 20 53 49 47 4e 45 44 20 29 20 41  38 AS SIGNED ) A
332b0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
332c0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
332d0 2d 33 38 0d 0a 2d 33 38 0d 0a 2d 33 38 0d 0a 0d  -38..-38..-38...
332e0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
332f0 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
33300 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
33310 6c 61 62 65 6c 2d 31 35 30 37 0d 0a 53 45 4c 45  label-1507..SELE
33320 43 54 20 41 4c 4c 20 43 41 53 54 20 28 20 2d 20  CT ALL CAST ( - 
33330 33 38 20 41 53 20 49 4e 54 45 47 45 52 20 29 20  38 AS INTEGER ) 
33340 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  AS col2 FROM tab
33350 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  1 AS cor0..----.
33360 0a 2d 33 38 0d 0a 2d 33 38 0d 0a 2d 33 38 0d 0a  .-38..-38..-38..
33370 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
33380 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
33390 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
333a0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
333b0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
333c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
333d0 43 54 20 63 6f 6c 31 20 2b 20 28 20 63 6f 6c 30  CT col1 + ( col0
333e0 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
333f0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
33400 0a 31 31 30 0d 0a 31 33 32 0d 0a 31 38 30 0d 0a  .110..132..180..
33410 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
33420 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
33430 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
33440 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
33450 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
33460 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33470 43 54 20 63 6f 6c 31 20 2a 20 2b 20 39 34 20 2a  CT col1 * + 94 *
33480 20 2d 20 63 6f 6c 32 20 63 6f 6c 30 20 46 52 4f   - col2 col0 FRO
33490 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32  M tab0..----..-2
334a0 36 36 37 37 32 0d 0a 2d 37 30 31 34 32 38 0d 0a  66772..-701428..
334b0 2d 39 31 31 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20  -9118....onlyif 
334c0 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20  mysql # use DIV 
334d0 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74  operator for int
334e0 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71  eger division..q
334f0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c  uery I rowsort l
33500 61 62 65 6c 2d 31 35 31 30 0d 0a 53 45 4c 45 43  abel-1510..SELEC
33510 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c  T + col1 * + col
33520 32 20 44 49 56 20 28 20 63 6f 6c 32 20 29 20 41  2 DIV ( col2 ) A
33530 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
33540 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a 31 33 0d 0a  ..----..10..13..
33550 32 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  26....skipif mys
33560 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
33570 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
33580 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 31 30 0d  sort label-1510.
33590 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2a  .SELECT + col1 *
335a0 20 2b 20 63 6f 6c 32 20 2f 20 28 20 63 6f 6c 32   + col2 / ( col2
335b0 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
335c0 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 0d 0a  tab1..----..10..
335d0 31 33 0d 0a 32 36 0d 0a 0d 0a 71 75 65 72 79 20  13..26....query 
335e0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
335f0 54 20 2b 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 72  T + + col0 * cor
33600 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
33610 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30  ROM tab1 AS cor0
33620 0d 0a 2d 2d 2d 2d 0d 0a 31 36 32 0d 0a 33 36 34  ..----..162..364
33630 38 0d 0a 37 36 38 30 0d 0a 0d 0a 71 75 65 72 79  8..7680....query
33640 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33650 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 74 61  CT DISTINCT ( ta
33660 62 31 2e 63 6f 6c 31 20 2a 20 63 6f 72 30 2e 63  b1.col1 * cor0.c
33670 6f 6c 32 20 29 20 2b 20 2d 20 28 20 32 38 20 29  ol2 ) + - ( 28 )
33680 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
33690 62 31 2c 20 74 61 62 30 20 41 53 20 63 6f 72 30  b1, tab0 AS cor0
336a0 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
336b0 20 68 61 73 68 69 6e 67 20 74 6f 20 32 39 32 63   hashing to 292c
336c0 66 66 61 39 38 33 38 31 38 33 37 64 35 31 38 30  ffa98381837d5180
336d0 34 61 62 64 64 39 39 34 30 32 62 65 0d 0a 0d 0a  4abdd99402be....
336e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
336f0 0a 53 45 4c 45 43 54 20 2d 20 38 38 20 46 52 4f  .SELECT - 88 FRO
33700 4d 20 74 61 62 30 2c 20 74 61 62 32 20 41 53 20  M tab0, tab2 AS 
33710 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61  cor0..----..9 va
33720 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f 20  lues hashing to 
33730 34 36 37 33 30 31 66 38 38 37 36 31 34 65 62 37  467301f887614eb7
33740 62 65 64 61 32 32 63 35 36 31 62 30 66 61 64 32  beda22c561b0fad2
33750 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
33760 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 33 38  ort..SELECT - 38
33770 20 46 52 4f 4d 20 74 61 62 32 2c 20 74 61 62 32   FROM tab2, tab2
33780 20 41 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41   AS cor0, tab0 A
33790 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37  S cor1..----..27
337a0 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
337b0 74 6f 20 65 38 63 30 36 34 35 34 33 62 66 30 66  to e8c064543bf0f
337c0 32 65 35 37 33 32 39 64 62 31 62 62 30 61 34 31  2e57329db1bb0a41
337d0 31 65 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  1e3....query I r
337e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
337f0 20 36 30 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d   60 AS col0 FROM
33800 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
33810 2d 2d 2d 0d 0a 2d 36 30 0d 0a 2d 36 30 0d 0a 2d  ---..-60..-60..-
33820 36 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  60....query I ro
33830 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
33840 28 20 2d 20 63 6f 6c 31 20 29 20 2b 20 2d 20 63  ( - col1 ) + - c
33850 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol2 AS col2 FROM
33860 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
33870 2d 2d 2d 0d 0a 35 33 0d 0a 39 0d 0a 39 36 0d 0a  ---..53..9..96..
33880 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33890 74 0d 0a 53 45 4c 45 43 54 20 2d 20 28 20 63 6f  t..SELECT - ( co
338a0 6c 32 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52  l2 ) + + col1 FR
338b0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
338c0 0a 2d 2d 2d 2d 0d 0a 2d 32 38 0d 0a 2d 34 37 0d  .----..-28..-47.
338d0 0a 2d 38 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  .-83....query I 
338e0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
338f0 37 34 20 2a 20 2b 20 63 6f 6c 31 20 2b 20 2b 20  74 * + col1 + + 
33900 63 6f 6c 31 20 2b 20 63 6f 72 30 2e 63 6f 6c 31  col1 + cor0.col1
33910 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61   AS col2 FROM ta
33920 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
33930 0d 0a 31 39 37 36 0d 0a 37 36 30 0d 0a 39 38 38  ..1976..760..988
33940 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
33950 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
33960 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
33970 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
33980 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
33990 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
339a0 4c 45 43 54 20 2b 20 2d 20 33 35 20 63 6f 6c 31  LECT + - 35 col1
339b0 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d   FROM tab2 cor0.
339c0 0a 2d 2d 2d 2d 0d 0a 2d 33 35 0d 0a 2d 33 35 0d  .----..-35..-35.
339d0 0a 2d 33 35 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  .-35....onlyif m
339e0 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74 20 66  ysql # support f
339f0 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69 66 69  or MySQL specifi
33a00 63 20 73 79 73 74 65 6d 20 74 79 70 65 73 20 61  c system types a
33a10 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65 72 79  nd syntax..query
33a20 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
33a30 2d 31 35 32 30 0d 0a 53 45 4c 45 43 54 20 2d 20  -1520..SELECT - 
33a40 43 41 53 54 28 20 4e 55 4c 4c 20 41 53 20 53 49  CAST( NULL AS SI
33a50 47 4e 45 44 20 29 20 63 6f 6c 32 20 46 52 4f 4d  GNED ) col2 FROM
33a60 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
33a70 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
33a80 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
33a90 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f 73  postgresql # Pos
33aa0 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65 73  tgreSQL requires
33ab0 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e   AS when renamin
33ac0 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73  g output columns
33ad0 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
33ae0 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
33af0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
33b00 20 6c 61 62 65 6c 2d 31 35 32 30 0d 0a 53 45 4c   label-1520..SEL
33b10 45 43 54 20 2d 20 43 41 53 54 20 28 20 4e 55 4c  ECT - CAST ( NUL
33b20 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 63  L AS INTEGER ) c
33b30 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
33b40 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
33b50 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
33b60 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
33b70 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
33b80 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
33b90 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
33ba0 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
33bb0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
33bc0 54 20 41 4c 4c 20 2d 20 37 35 20 2a 20 63 6f 6c  T ALL - 75 * col
33bd0 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  1 col2 FROM tab0
33be0 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
33bf0 2d 36 34 35 30 0d 0a 2d 36 38 32 35 0d 0a 2d 37  -6450..-6825..-7
33c00 32 37 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  275....query I r
33c10 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
33c20 20 35 36 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f   56 + col1 AS co
33c30 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
33c40 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 35 0d  cor0..----..115.
33c50 0a 37 33 0d 0a 38 37 0d 0a 0d 0a 71 75 65 72 79  .73..87....query
33c60 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33c70 43 54 20 41 4c 4c 20 2d 20 35 30 20 41 53 20 63  CT ALL - 50 AS c
33c80 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d  ol0 FROM tab0..-
33c90 2d 2d 2d 0d 0a 2d 35 30 0d 0a 2d 35 30 0d 0a 2d  ---..-50..-50..-
33ca0 35 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  50....query I ro
33cb0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c  wsort..SELECT AL
33cc0 4c 20 2b 20 31 30 20 41 53 20 63 6f 6c 30 20 46  L + 10 AS col0 F
33cd0 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
33ce0 20 43 52 4f 53 53 20 4a 4f 49 4e 20 74 61 62 30   CROSS JOIN tab0
33cf0 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
33d00 39 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67  9 values hashing
33d10 20 74 6f 20 61 34 37 31 39 34 34 32 39 66 33 65   to a47194429f3e
33d20 30 33 35 38 61 33 61 65 62 66 66 64 35 66 30 35  0358a3aebffd5f05
33d30 30 31 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0113....query I 
33d40 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
33d50 2b 20 38 33 20 2a 20 2d 20 63 6f 72 30 2e 63 6f  + 83 * - cor0.co
33d60 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l1 FROM tab0 cor
33d70 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 31 33 38 0d 0a  0..----..-7138..
33d80 2d 37 35 35 33 0d 0a 2d 38 30 35 31 0d 0a 0d 0a  -7553..-8051....
33d90 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
33da0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
33db0 20 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 2d   + cor0.col1 * -
33dc0 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52   col0 AS col0 FR
33dd0 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
33de0 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d 0a 2d 36  .----..-1040..-6
33df0 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75 65 72 79  40..-78....query
33e00 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
33e10 43 54 20 44 49 53 54 49 4e 43 54 20 28 20 2b 20  CT DISTINCT ( + 
33e20 63 6f 6c 31 20 29 20 41 53 20 63 6f 6c 31 20 46  col1 ) AS col1 F
33e30 52 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d  ROM tab2 cor0..-
33e40 2d 2d 2d 0d 0a 31 37 0d 0a 33 31 0d 0a 35 39 0d  ---..17..31..59.
33e50 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72  ...skipif postgr
33e60 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51  esql # PostgreSQ
33e70 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68  L requires AS wh
33e80 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70  en renaming outp
33e90 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72  ut columns..quer
33ea0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
33eb0 45 43 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ECT col2 + - col
33ec0 32 20 2a 20 28 20 2b 20 63 6f 6c 32 20 29 20 63  2 * ( + col2 ) c
33ed0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
33ee0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 34   cor0..----..-14
33ef0 30 36 0d 0a 2d 36 35 30 0d 0a 2d 37 30 32 0d 0a  06..-650..-702..
33f00 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
33f10 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32  t..SELECT + col2
33f20 20 2a 20 2b 20 63 6f 6c 32 20 2a 20 39 33 20 46   * + col2 * 93 F
33f30 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
33f40 0d 0a 2d 2d 2d 2d 0d 0a 31 30 31 32 37 37 0d 0a  ..----..101277..
33f50 36 32 35 33 33 32 0d 0a 39 33 0d 0a 0d 0a 71 75  625332..93....qu
33f60 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
33f70 45 4c 45 43 54 20 32 34 20 2a 20 2b 20 63 6f 6c  ELECT 24 * + col
33f80 31 20 2b 20 28 20 63 6f 6c 30 20 29 20 41 53 20  1 + ( col0 ) AS 
33f90 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col1 FROM tab1..
33fa0 2d 2d 2d 2d 0d 0a 33 30 34 0d 0a 33 39 32 0d 0a  ----..304..392..
33fb0 36 32 37 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79  627....onlyif my
33fc0 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70  sql # use DIV op
33fd0 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67  erator for integ
33fe0 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65  er division..que
33ff0 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34000 65 6c 2d 31 35 33 31 0d 0a 53 45 4c 45 43 54 20  el-1531..SELECT 
34010 44 49 53 54 49 4e 43 54 20 63 6f 6c 30 20 44 49  DISTINCT col0 DI
34020 56 20 2b 20 63 6f 6c 30 20 2b 20 33 30 20 46 52  V + col0 + 30 FR
34030 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33  OM tab1..----..3
34040 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71  1....skipif mysq
34050 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62  l # not compatib
34060 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  le..query I rows
34070 6f 72 74 20 6c 61 62 65 6c 2d 31 35 33 31 0d 0a  ort label-1531..
34080 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34090 63 6f 6c 30 20 2f 20 2b 20 63 6f 6c 30 20 2b 20  col0 / + col0 + 
340a0 33 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  30 FROM tab1..--
340b0 2d 2d 0d 0a 33 31 0d 0a 0d 0a 6f 6e 6c 79 69 66  --..31....onlyif
340c0 20 6d 79 73 71 6c 20 23 20 73 75 70 70 6f 72 74   mysql # support
340d0 20 66 6f 72 20 4d 79 53 51 4c 20 73 70 65 63 69   for MySQL speci
340e0 66 69 63 20 73 79 73 74 65 6d 20 74 79 70 65 73  fic system types
340f0 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a 71 75 65   and syntax..que
34100 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62  ry I rowsort lab
34110 65 6c 2d 31 35 33 32 0d 0a 53 45 4c 45 43 54 20  el-1532..SELECT 
34120 2b 20 2b 20 63 6f 6c 32 20 2b 20 43 41 53 54 28  + + col2 + CAST(
34130 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20   NULL AS SIGNED 
34140 29 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a  ) * - ( col1 ) *
34150 20 2b 20 38 35 20 41 53 20 63 6f 6c 31 20 46 52   + 85 AS col1 FR
34160 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
34170 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c  .----..NULL..NUL
34180 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69  L..NULL....skipi
34190 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
341a0 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
341b0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
341c0 31 35 33 32 0d 0a 53 45 4c 45 43 54 20 2b 20 2b  1532..SELECT + +
341d0 20 63 6f 6c 32 20 2b 20 43 41 53 54 20 28 20 4e   col2 + CAST ( N
341e0 55 4c 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29  ULL AS INTEGER )
341f0 20 2a 20 2d 20 28 20 63 6f 6c 31 20 29 20 2a 20   * - ( col1 ) * 
34200 2b 20 38 35 20 41 53 20 63 6f 6c 31 20 46 52 4f  + 85 AS col1 FRO
34210 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a  M tab2 AS cor0..
34220 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c  ----..NULL..NULL
34230 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75 65 72 79 20  ..NULL....query 
34240 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34250 54 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2a 20  T col1 + col1 * 
34260 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  + col0 FROM tab0
34270 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a   AS cor0..----..
34280 32 31 35 30 0d 0a 33 34 39 32 0d 0a 38 31 39 30  2150..3492..8190
34290 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
342a0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
342b0 49 4e 43 54 20 2d 20 2b 20 63 6f 6c 30 20 41 53  INCT - + col0 AS
342c0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
342d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a  cor0..----..-7..
342e0 2d 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72  -78..-79....quer
342f0 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
34300 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30 20  ECT + cor0.col0 
34310 2a 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61  * + col1 FROM ta
34320 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34330 0d 0a 31 30 34 30 0d 0a 36 34 30 0d 0a 37 38 0d  ..1040..640..78.
34340 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34350 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 2d 20 63  rt..SELECT + - c
34360 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20 63  ol0 * col1 + + c
34370 6f 6c 30 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c  ol0 + - cor0.col
34380 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  0 FROM tab2 AS c
34390 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  or0..----..-1343
343a0 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
343b0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
343c0 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20  ..SELECT - col1 
343d0 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d  * cor0.col2 FROM
343e0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
343f0 2d 2d 2d 0d 0a 2d 31 35 33 34 0d 0a 2d 36 34 36  ---..-1534..-646
34400 0d 0a 2d 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20  ..-837....query 
34410 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34420 54 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20  T col2 + - col2 
34430 2a 20 63 6f 72 30 2e 63 6f 6c 30 20 46 52 4f 4d  * cor0.col0 FROM
34440 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d   tab1 AS cor0..-
34450 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a 2d 33 35 39 31  ---..-108..-3591
34460 0d 0a 2d 37 35 38 34 0d 0a 0d 0a 71 75 65 72 79  ..-7584....query
34470 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34480 43 54 20 41 4c 4c 20 2b 20 63 6f 6c 31 20 2b 20  CT ALL + col1 + 
34490 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 41  col1 FROM tab2 A
344a0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31  S cor0..----..11
344b0 38 0d 0a 33 34 0d 0a 36 32 0d 0a 0d 0a 71 75 65  8..34..62....que
344c0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
344d0 4c 45 43 54 20 2b 20 63 6f 72 30 2e 63 6f 6c 30  LECT + cor0.col0
344e0 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 31   + col2 * - col1
344f0 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f 6c   * - col0 AS col
34500 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  2 FROM tab2 AS c
34510 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 39 37 33  or0..----..11973
34520 30 0d 0a 35 31 31 31 33 0d 0a 35 38 36 36 0d 0a  0..51113..5866..
34530 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
34540 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
34550 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
34560 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
34570 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
34580 34 31 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  41..SELECT + col
34590 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f 6c 32 20  1 + + cor0.col2 
345a0 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 44 49  + - cor0.col0 DI
345b0 56 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20 63  V cor0.col0 AS c
345c0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol0 FROM tab1 AS
345d0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 38   cor0..----..108
345e0 0d 0a 36 36 0d 0a 37 39 0d 0a 0d 0a 73 6b 69 70  ..66..79....skip
345f0 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
34600 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
34610 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
34620 2d 31 35 34 31 0d 0a 53 45 4c 45 43 54 20 2b 20  -1541..SELECT + 
34630 63 6f 6c 31 20 2b 20 2b 20 63 6f 72 30 2e 63 6f  col1 + + cor0.co
34640 6c 32 20 2b 20 2d 20 63 6f 72 30 2e 63 6f 6c 30  l2 + - cor0.col0
34650 20 2f 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53 20   / cor0.col0 AS 
34660 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41  col0 FROM tab1 A
34670 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30  S cor0..----..10
34680 38 0d 0a 36 36 0d 0a 37 39 0d 0a 0d 0a 71 75 65  8..66..79....que
34690 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
346a0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2b 20  LECT DISTINCT + 
346b0 2d 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c 31 20  - col0 + + col1 
346c0 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
346d0 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
346e0 0a 32 0d 0a 36 32 0d 0a 0d 0a 71 75 65 72 79 20  .2..62....query 
346f0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34700 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 2b 20 63  T ALL col2 * + c
34710 6f 72 30 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  or0.col2 FROM ta
34720 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34730 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
34740 31 36 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  16....skipif pos
34750 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
34760 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
34770 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
34780 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
34790 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
347a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20  SELECT - col0 * 
347b0 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
347c0 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 33 34 33  ab2..----..-1343
347d0 0d 0a 2d 32 31 37 0d 0a 2d 34 36 30 32 0d 0a 0d  ..-217..-4602...
347e0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
347f0 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2a 20  ..SELECT col2 * 
34800 2b 20 63 6f 6c 30 20 2a 20 2d 20 63 6f 6c 30 20  + col0 * - col0 
34810 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d  FROM tab1..----.
34820 0a 2d 32 33 33 34 37 32 0d 0a 2d 34 38 36 0d 0a  .-233472..-486..
34830 2d 36 31 34 34 30 30 0d 0a 0d 0a 71 75 65 72 79  -614400....query
34840 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34850 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
34860 6c 32 20 2a 20 2d 20 63 6f 72 30 2e 63 6f 6c 32  l2 * - cor0.col2
34870 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
34880 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d  b1 AS cor0..----
34890 0d 0a 32 39 31 36 0d 0a 33 32 34 39 0d 0a 39 32  ..2916..3249..92
348a0 31 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  16....query I ro
348b0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20  wsort..SELECT - 
348c0 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32 20 46 52  + col0 * col2 FR
348d0 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d  OM tab2 AS cor0.
348e0 0a 2d 2d 2d 2d 0d 0a 2d 31 38 39 0d 0a 2d 32 30  .----..-189..-20
348f0 32 38 0d 0a 2d 33 30 30 32 0d 0a 0d 0a 71 75 65  28..-3002....que
34900 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
34910 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 31 20 2a 20  LECT ALL col1 * 
34920 2b 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63  + cor0.col1 AS c
34930 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol1 FROM tab1 AS
34940 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30   cor0..----..100
34950 0d 0a 31 36 39 0d 0a 36 37 36 0d 0a 0d 0a 71 75  ..169..676....qu
34960 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34970 45 4c 45 43 54 20 41 4c 4c 20 2d 20 2b 20 63 6f  ELECT ALL - + co
34980 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 46 52 4f 4d  l1 + - col2 FROM
34990 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
349a0 2d 2d 2d 0d 0a 2d 35 35 0d 0a 2d 35 38 0d 0a 2d  ---..-55..-58..-
349b0 38 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  85....query I ro
349c0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
349d0 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2b 20  STINCT + col0 + 
349e0 63 6f 6c 31 20 2a 20 63 6f 6c 30 20 46 52 4f 4d  col1 * col0 FROM
349f0 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
34a00 2d 2d 2d 0d 0a 31 34 32 32 0d 0a 32 32 34 0d 0a  ---..1422..224..
34a10 34 36 38 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20  4680....query I 
34a20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
34a30 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 2b 20 2b 20  col0 * col1 + + 
34a40 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
34a50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  S cor0..----..20
34a60 39 37 0d 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a  97..3396..8181..
34a70 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34a80 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34a90 43 54 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  CT - - col2 * - 
34aa0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41  col2 FROM tab0 A
34ab0 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
34ac0 0d 0a 2d 31 30 38 39 0d 0a 2d 36 37 32 34 0d 0a  ..-1089..-6724..
34ad0 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
34ae0 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
34af0 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
34b00 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
34b10 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
34b20 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34b30 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62 30  CT DISTINCT tab0
34b40 2e 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f 4d 20  .col0 col0 FROM 
34b50 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 34 0d 0a  tab0..----..24..
34b60 33 35 0d 0a 38 39 0d 0a 0d 0a 6f 6e 6c 79 69 66  35..89....onlyif
34b70 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
34b80 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
34b90 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
34ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
34bb0 6c 61 62 65 6c 2d 31 35 35 34 0d 0a 53 45 4c 45  label-1554..SELE
34bc0 43 54 20 2d 20 63 6f 6c 31 20 44 49 56 20 2d 20  CT - col1 DIV - 
34bd0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
34be0 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d  M tab1..----..0.
34bf0 0a 30 0d 0a 30 0d 0a 0d 0a 73 6b 69 70 69 66 20  .0..0....skipif 
34c00 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
34c10 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
34c20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35  rowsort label-15
34c30 35 34 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c  54..SELECT - col
34c40 31 20 2f 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  1 / - col2 AS co
34c50 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l2 FROM tab1..--
34c60 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 71  --..0..0..0....q
34c70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34c80 53 45 4c 45 43 54 20 74 61 62 30 2e 63 6f 6c 30  SELECT tab0.col0
34c90 20 2a 20 2d 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * - col0 FROM t
34ca0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 32 35  ab0..----..-1225
34cb0 0d 0a 2d 35 37 36 0d 0a 2d 37 39 32 31 0d 0a 0d  ..-576..-7921...
34cc0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
34cd0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
34ce0 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
34cf0 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
34d00 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
34d10 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
34d20 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
34d30 31 20 2b 20 63 6f 6c 32 20 63 6f 6c 32 20 46 52  1 + col2 col2 FR
34d40 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
34d50 31 39 0d 0a 31 37 33 0d 0a 39 38 0d 0a 0d 0a 71  19..173..98....q
34d60 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34d70 53 45 4c 45 43 54 20 63 6f 6c 30 20 2d 20 63 6f  SELECT col0 - co
34d80 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
34d90 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 0d  tab1..----..-16.
34da0 0a 2d 35 31 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  .-51..7....query
34db0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
34dc0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63 6f  CT + col1 * + co
34dd0 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  l2 AS col2 FROM 
34de0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 35 33 34  tab2..----..1534
34df0 0d 0a 36 34 36 0d 0a 38 33 37 0d 0a 0d 0a 71 75  ..646..837....qu
34e00 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
34e10 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
34e20 6f 6c 30 20 2a 20 63 6f 6c 32 20 2b 20 2d 20 63  ol0 * col2 + - c
34e30 6f 6c 32 20 2d 20 2b 20 63 6f 6c 32 20 41 53 20  ol2 - + col2 AS 
34e40 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 20 41  col1 FROM tab0 A
34e50 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 33 33  S cor0..----..33
34e60 0d 0a 37 31 33 34 0d 0a 37 32 36 0d 0a 0d 0a 71  ..7134..726....q
34e70 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
34e80 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
34e90 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63 6f 6c 32  col0 * tab0.col2
34ea0 20 2a 20 2d 20 63 6f 6c 32 20 46 52 4f 4d 20 74   * - col2 FROM t
34eb0 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 31 33  ab0..----..-2613
34ec0 36 0d 0a 2d 33 35 0d 0a 2d 35 39 38 34 33 36 0d  6..-35..-598436.
34ed0 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
34ee0 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62  rt..SELECT + tab
34ef0 30 2e 63 6f 6c 30 20 2a 20 63 6f 6c 31 20 41 53  0.col0 * col1 AS
34f00 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d   col1 FROM tab0.
34f10 0a 2d 2d 2d 2d 0d 0a 32 30 36 34 0d 0a 33 33 39  .----..2064..339
34f20 35 0d 0a 38 30 39 39 0d 0a 0d 0a 71 75 65 72 79  5..8099....query
34f30 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
34f40 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31  LECT * FROM tab1
34f50 20 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29 20   WHERE ( NULL ) 
34f60 3e 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  > NULL..----....
34f70 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
34f80 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
34f90 20 63 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52   col0 AS col2 FR
34fa0 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
34fb0 33 34 33 0d 0a 32 31 37 0d 0a 34 36 30 32 0d 0a  343..217..4602..
34fc0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
34fd0 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  t..SELECT DISTIN
34fe0 43 54 20 2d 20 63 6f 6c 31 20 2b 20 74 61 62 30  CT - col1 + tab0
34ff0 2e 63 6f 6c 30 20 2a 20 2b 20 74 61 62 30 2e 63  .col0 * + tab0.c
35000 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
35010 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 39 37   tab0..----..197
35020 38 0d 0a 33 32 39 38 0d 0a 38 30 30 38 0d 0a 0d  8..3298..8008...
35030 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35040 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 74  ..SELECT ALL - t
35050 61 62 32 2e 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c  ab2.col2 + - col
35060 31 20 2a 20 2d 20 63 6f 6c 32 20 41 53 20 63 6f  1 * - col2 AS co
35070 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d  l1 FROM tab2..--
35080 2d 2d 0d 0a 31 35 30 38 0d 0a 36 30 38 0d 0a 38  --..1508..608..8
35090 31 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  10....query I ro
350a0 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
350b0 53 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20  STINCT - col0 * 
350c0 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 32 20 2b 20  col1 * - col2 + 
350d0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46  + col2 AS col1 F
350e0 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
350f0 33 36 35 33 37 0d 0a 34 32 36 36 0d 0a 39 39 39  36537..4266..999
35100 33 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  36....onlyif mys
35110 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
35120 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
35130 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
35140 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
35150 6c 2d 31 35 36 37 0d 0a 53 45 4c 45 43 54 20 41  l-1567..SELECT A
35160 4c 4c 20 2b 20 63 6f 6c 30 20 44 49 56 20 63 6f  LL + col0 DIV co
35170 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l2 FROM tab1 AS 
35180 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 30  cor0..----..0..0
35190 0d 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..1....skipif my
351a0 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
351b0 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
351c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 36 37  wsort label-1567
351d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
351e0 6f 6c 30 20 2f 20 63 6f 6c 32 20 46 52 4f 4d 20  ol0 / col2 FROM 
351f0 74 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab1 AS cor0..--
35200 2d 2d 0d 0a 30 0d 0a 30 0d 0a 31 0d 0a 0d 0a 73  --..0..0..1....s
35210 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c  kipif postgresql
35220 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65   # PostgreSQL re
35230 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20 72  quires AS when r
35240 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63  enaming output c
35250 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49 20  olumns..query I 
35260 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35270 41 4c 4c 20 2b 20 2d 20 63 6f 6c 30 20 63 6f 6c  ALL + - col0 col
35280 31 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63  1 FROM tab2 AS c
35290 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 0d 0a 2d  or0..----..-7..-
352a0 37 38 0d 0a 2d 37 39 0d 0a 0d 0a 71 75 65 72 79  78..-79....query
352b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
352c0 43 54 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  CT + col1 * col1
352d0 20 2d 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c   - + col1 AS col
352e0 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d  0 FROM tab2..---
352f0 2d 0d 0a 32 37 32 0d 0a 33 34 32 32 0d 0a 39 33  -..272..3422..93
35300 30 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  0....query I row
35310 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74  sort..SELECT + t
35320 61 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61  ab1.col2 FROM ta
35330 62 31 2c 20 74 61 62 31 20 41 53 20 63 6f 72 30  b1, tab1 AS cor0
35340 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65 73  ..----..9 values
35350 20 68 61 73 68 69 6e 67 20 74 6f 20 38 30 63 61   hashing to 80ca
35360 30 61 31 63 63 33 33 37 61 37 37 31 34 61 38 39  0a1cc337a7714a89
35370 39 30 61 37 36 34 63 66 64 62 31 37 0d 0a 0d 0a  90a764cfdb17....
35380 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75  onlyif mysql # u
35390 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20  se DIV operator 
353a0 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69  for integer divi
353b0 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f  sion..query I ro
353c0 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 37 31  wsort label-1571
353d0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c  ..SELECT ALL col
353e0 31 20 44 49 56 20 2d 20 74 61 62 32 2e 63 6f 6c  1 DIV - tab2.col
353f0 31 20 2d 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  1 - + col0 FROM 
35400 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 39 0d  tab2..----..-79.
35410 0a 2d 38 0d 0a 2d 38 30 0d 0a 0d 0a 73 6b 69 70  .-8..-80....skip
35420 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
35430 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
35440 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35450 2d 31 35 37 31 0d 0a 53 45 4c 45 43 54 20 41 4c  -1571..SELECT AL
35460 4c 20 63 6f 6c 31 20 2f 20 2d 20 74 61 62 32 2e  L col1 / - tab2.
35470 63 6f 6c 31 20 2d 20 2b 20 63 6f 6c 30 20 46 52  col1 - + col0 FR
35480 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d  OM tab2..----..-
35490 37 39 0d 0a 2d 38 0d 0a 2d 38 30 0d 0a 0d 0a 71  79..-8..-80....q
354a0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
354b0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
354c0 2d 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 2d 20  - col0 * col0 - 
354d0 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
354e0 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 32 0d 0a 2d 34 31  ..----..-12..-41
354f0 36 30 0d 0a 2d 36 34 38 30 0d 0a 0d 0a 71 75 65  60..-6480....que
35500 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35510 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2b 20  LECT ALL col0 + 
35520 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2a 20 74 61  + tab1.col0 * ta
35530 62 31 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b1.col2 FROM tab
35540 31 0d 0a 2d 2d 2d 2d 0d 0a 31 36 35 0d 0a 33 37  1..----..165..37
35550 31 32 0d 0a 37 37 36 30 0d 0a 0d 0a 71 75 65 72  12..7760....quer
35560 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35570 45 43 54 20 2d 20 63 6f 6c 30 20 2a 20 2b 20 63  ECT - col0 * + c
35580 6f 6c 31 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20  ol1 - - col1 AS 
35590 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
355a0 2d 2d 2d 2d 0d 0a 2d 31 30 32 37 0d 0a 2d 35 32  ----..-1027..-52
355b0 0d 0a 2d 36 33 30 0d 0a 0d 0a 71 75 65 72 79 20  ..-630....query 
355c0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
355d0 54 20 63 6f 6c 31 20 2a 20 63 6f 6c 31 20 2d 20  T col1 * col1 - 
355e0 2d 20 63 6f 6c 32 20 2a 20 74 61 62 32 2e 63 6f  - col2 * tab2.co
355f0 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46 52 4f 4d  l1 * - col1 FROM
35600 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   tab2..----..-10
35610 36 39 33 0d 0a 2d 32 34 39 38 36 0d 0a 2d 38 37  693..-24986..-87
35620 30 32 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  025....query I r
35630 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2b  owsort..SELECT +
35640 20 63 6f 6c 31 20 2b 20 63 6f 6c 31 20 2b 20 63   col1 + col1 + c
35650 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d  ol1 AS col0 FROM
35660 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 33 30 0d   tab1..----..30.
35670 0a 33 39 0d 0a 37 38 0d 0a 0d 0a 71 75 65 72 79  .39..78....query
35680 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
35690 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2b 20 63  CT tab2.col0 + c
356a0 6f 6c 30 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d  ol0 AS col2 FROM
356b0 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 34 0d   tab2..----..14.
356c0 0a 31 35 36 0d 0a 31 35 38 0d 0a 0d 0a 71 75 65  .156..158....que
356d0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
356e0 4c 45 43 54 20 41 4c 4c 20 2b 20 74 61 62 31 2e  LECT ALL + tab1.
356f0 63 6f 6c 31 20 2b 20 2b 20 74 61 62 31 2e 63 6f  col1 + + tab1.co
35700 6c 30 20 2d 20 74 61 62 31 2e 63 6f 6c 31 20 46  l0 - tab1.col1 F
35710 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
35720 33 0d 0a 36 34 0d 0a 38 30 0d 0a 0d 0a 71 75 65  3..64..80....que
35730 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
35740 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 41  LECT cor0.col1 A
35750 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31  S col2 FROM tab1
35760 2c 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d  , tab2 cor0..---
35770 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73 68  -..9 values hash
35780 69 6e 67 20 74 6f 20 63 36 31 64 32 37 61 30 30  ing to c61d27a00
35790 32 32 65 36 64 30 32 32 33 37 31 64 63 35 38 38  22e6d022371dc588
357a0 31 39 61 62 32 37 32 0d 0a 0d 0a 71 75 65 72 79  19ab272....query
357b0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
357c0 43 54 20 2d 20 63 6f 6c 30 20 2d 20 2d 20 63 6f  CT - col0 - - co
357d0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 63 6f 72  l1 FROM tab1 cor
357e0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34 0d 0a 2d 36  0..----..-54..-6
357f0 37 0d 0a 32 33 0d 0a 0d 0a 71 75 65 72 79 20 49  7..23....query I
35800 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
35810 20 63 6f 72 30 2e 63 6f 6c 32 20 2a 20 63 6f 6c   cor0.col2 * col
35820 31 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74  1 AS col2 FROM t
35830 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
35840 2d 0d 0a 32 38 33 38 0d 0a 37 34 36 32 0d 0a 39  -..2838..7462..9
35850 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
35860 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 63 6f 72  sort..SELECT cor
35870 30 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46  0.col0 AS col1 F
35880 52 4f 4d 20 74 61 62 30 2c 20 74 61 62 30 20 41  ROM tab0, tab0 A
35890 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20  S cor0..----..9 
358a0 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74  values hashing t
358b0 6f 20 38 62 34 39 37 39 39 39 34 32 61 39 65 33  o 8b49799942a9e3
358c0 35 33 61 33 64 32 37 39 63 66 36 34 65 66 33 66  53a3d279cf64ef3f
358d0 36 33 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  63....skipif pos
358e0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
358f0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
35900 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
35910 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
35920 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
35930 53 45 4c 45 43 54 20 2b 20 2d 20 63 6f 6c 32 20  SELECT + - col2 
35940 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 32  - cor0.col0 col2
35950 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f   FROM tab0 AS co
35960 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 37 31 0d 0a  r0..----..-171..
35970 2d 33 36 0d 0a 2d 35 37 0d 0a 0d 0a 71 75 65 72  -36..-57....quer
35980 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
35990 45 43 54 20 63 6f 6c 32 20 2d 20 2d 20 63 6f 6c  ECT col2 - - col
359a0 30 20 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63  0 FROM tab0 AS c
359b0 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 31 0d 0a  or0..----..171..
359c0 33 36 0d 0a 35 37 0d 0a 0d 0a 6f 6e 6c 79 69 66  36..57....onlyif
359d0 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
359e0 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
359f0 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
35a00 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
35a10 6c 61 62 65 6c 2d 31 35 38 35 0d 0a 53 45 4c 45  label-1585..SELE
35a20 43 54 20 41 4c 4c 20 63 6f 6c 32 20 44 49 56 20  CT ALL col2 DIV 
35a30 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31  + col0 FROM tab1
35a40 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31 38  ..----..0..1..18
35a50 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
35a60 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
35a70 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
35a80 72 74 20 6c 61 62 65 6c 2d 31 35 38 35 0d 0a 53  rt label-1585..S
35a90 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 32 20 2f  ELECT ALL col2 /
35aa0 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62   + col0 FROM tab
35ab0 31 0d 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 31 0d 0a 31  1..----..0..1..1
35ac0 38 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71  8....onlyif mysq
35ad0 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72  l # use DIV oper
35ae0 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72  ator for integer
35af0 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79   division..query
35b00 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
35b10 2d 31 35 38 36 0d 0a 53 45 4c 45 43 54 20 63 6f  -1586..SELECT co
35b20 6c 32 20 44 49 56 20 63 6f 6c 30 20 2b 20 63 6f  l2 DIV col0 + co
35b30 6c 30 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c 31  l0 * - tab1.col1
35b40 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 30 20 46   + col0 * col0 F
35b50 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
35b60 2d 35 31 0d 0a 33 34 35 36 0d 0a 35 33 36 31 0d  -51..3456..5361.
35b70 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
35b80 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
35b90 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35ba0 74 20 6c 61 62 65 6c 2d 31 35 38 36 0d 0a 53 45  t label-1586..SE
35bb0 4c 45 43 54 20 63 6f 6c 32 20 2f 20 63 6f 6c 30  LECT col2 / col0
35bc0 20 2b 20 63 6f 6c 30 20 2a 20 2d 20 74 61 62 31   + col0 * - tab1
35bd0 2e 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2a 20 63  .col1 + col0 * c
35be0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d  ol0 FROM tab1..-
35bf0 2d 2d 2d 0d 0a 2d 35 31 0d 0a 33 34 35 36 0d 0a  ---..-51..3456..
35c00 35 33 36 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20  5361....query I 
35c10 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
35c20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f 6c 32 20  DISTINCT - col2 
35c30 2b 20 2b 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  + + col0 + + col
35c40 30 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d  0 FROM tab0..---
35c50 2d 0d 0a 31 35 0d 0a 36 39 0d 0a 39 36 0d 0a 0d  -..15..69..96...
35c60 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35c70 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a 20  ..SELECT col0 * 
35c80 2b 20 63 6f 6c 31 20 41 53 20 63 6f 6c 30 20 46  + col1 AS col0 F
35c90 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
35ca0 32 30 36 34 0d 0a 33 33 39 35 0d 0a 38 30 39 39  2064..3395..8099
35cb0 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ....query I rows
35cc0 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
35cd0 2b 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 32 2e  + col1 * + tab2.
35ce0 63 6f 6c 31 20 2b 20 63 6f 6c 32 20 2a 20 2d 20  col1 + col2 * - 
35cf0 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46 52 4f  col2 AS col2 FRO
35d00 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab2..----..-1
35d10 31 35 35 0d 0a 32 33 32 0d 0a 32 38 30 35 0d 0a  155..232..2805..
35d20 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
35d30 74 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31  t..SELECT - col1
35d40 20 2a 20 2d 20 63 6f 6c 32 20 2a 20 63 6f 6c 31   * - col2 * col1
35d50 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61   AS col1 FROM ta
35d60 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 38 32 0d  b2..----..10982.
35d70 0a 32 35 39 34 37 0d 0a 39 30 35 30 36 0d 0a 0d  .25947..90506...
35d80 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35d90 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43  ..SELECT DISTINC
35da0 54 20 63 6f 6c 30 20 2b 20 2d 20 63 6f 6c 31 20  T col0 + - col1 
35db0 2b 20 63 6f 6c 32 20 41 53 20 63 6f 6c 30 20 46  + col2 AS col0 F
35dc0 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab0..----..
35dd0 2d 32 39 0d 0a 2d 36 31 0d 0a 38 30 0d 0a 0d 0a  -29..-61..80....
35de0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35df0 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63 6f 6c  .SELECT tab2.col
35e00 32 20 2a 20 74 61 62 32 2e 63 6f 6c 32 20 2a 20  2 * tab2.col2 * 
35e10 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 31 20  + col1 + + col1 
35e20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62  AS col1 FROM tab
35e30 32 0d 0a 2d 2d 2d 2d 0d 0a 32 32 36 33 30 0d 0a  2..----..22630..
35e40 32 34 35 36 35 0d 0a 33 39 39 34 33 0d 0a 0d 0a  24565..39943....
35e50 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
35e60 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2a  .SELECT - col0 *
35e70 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 74 61 62 30   + col1 * + tab0
35e80 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d  .col2 FROM tab0.
35e90 0a 2d 2d 2d 2d 0d 0a 2d 33 33 39 35 0d 0a 2d 36  .----..-3395..-6
35ea0 36 34 31 31 38 0d 0a 2d 36 38 31 31 32 0d 0a 0d  64118..-68112...
35eb0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
35ec0 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
35ed0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 32 20 2a 20 2d  ol2 + - col2 * -
35ee0 20 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c 30 20 41   col2 + + col0 A
35ef0 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30  S col2 FROM tab0
35f00 0d 0a 2d 2d 2d 2d 0d 0a 31 31 34 36 0d 0a 33 37  ..----..1146..37
35f10 0d 0a 36 38 39 35 0d 0a 0d 0a 71 75 65 72 79 20  ..6895....query 
35f20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
35f30 54 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 2a 20  T col2 * col2 * 
35f40 2b 20 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46  + col0 AS col0 F
35f50 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45 20 4e  ROM tab2 WHERE N
35f60 4f 54 20 2d 20 63 6f 6c 30 20 2d 20 2b 20 63 6f  OT - col0 - + co
35f70 6c 31 20 4e 4f 54 20 49 4e 20 28 20 2b 20 63 6f  l1 NOT IN ( + co
35f80 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e  l1 )..----....on
35f90 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73 65  lyif mysql # use
35fa0 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66 6f   DIV operator fo
35fb0 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73 69  r integer divisi
35fc0 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  on..query I rows
35fd0 6f 72 74 20 6c 61 62 65 6c 2d 31 35 39 36 0d 0a  ort label-1596..
35fe0 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20  SELECT DISTINCT 
35ff0 63 6f 6c 30 20 44 49 56 20 63 6f 6c 30 20 46 52  col0 DIV col0 FR
36000 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
36010 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c  ....skipif mysql
36020 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c   # not compatibl
36030 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  e..query I rowso
36040 72 74 20 6c 61 62 65 6c 2d 31 35 39 36 0d 0a 53  rt label-1596..S
36050 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 63  ELECT DISTINCT c
36060 6f 6c 30 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20  ol0 / col0 FROM 
36070 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 0d  tab2..----..1...
36080 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
36090 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
360a0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
360b0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
360c0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 35 39  owsort label-159
360d0 37 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c 30  7..SELECT + col0
360e0 20 2a 20 63 6f 6c 32 20 44 49 56 20 63 6f 6c 31   * col2 DIV col1
360f0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
36100 0d 0a 33 36 34 0d 0a 35 39 30 0d 0a 36 0d 0a 0d  ..364..590..6...
36110 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
36120 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
36130 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
36140 6c 61 62 65 6c 2d 31 35 39 37 0d 0a 53 45 4c 45  label-1597..SELE
36150 43 54 20 2b 20 63 6f 6c 30 20 2a 20 63 6f 6c 32  CT + col0 * col2
36160 20 2f 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   / col1 FROM tab
36170 31 0d 0a 2d 2d 2d 2d 0d 0a 33 36 34 0d 0a 35 39  1..----..364..59
36180 30 0d 0a 36 0d 0a 0d 0a 71 75 65 72 79 20 49 20  0..6....query I 
36190 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
361a0 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 41 53 20 63  col1 * col2 AS c
361b0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol1 FROM tab2..-
361c0 2d 2d 2d 0d 0a 31 35 33 34 0d 0a 36 34 36 0d 0a  ---..1534..646..
361d0 38 33 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  837....query I r
361e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d  owsort..SELECT -
361f0 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 46   col2 + - col1 F
36200 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
36210 2d 31 30 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a  -109..-67..-80..
36220 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
36230 74 0d 0a 53 45 4c 45 43 54 20 63 6f 6c 30 20 2a  t..SELECT col0 *
36240 20 2b 20 74 61 62 30 2e 63 6f 6c 32 20 46 52 4f   + tab0.col2 FRO
36250 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 33 35  M tab0..----..35
36260 0d 0a 37 32 39 38 0d 0a 37 39 32 0d 0a 0d 0a 71  ..7298..792....q
36270 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36280 53 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2b 20  SELECT - col2 + 
36290 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 31 20 41 53  col1 * + col1 AS
362a0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
362b0 0a 2d 2d 2d 2d 0d 0a 32 35 31 0d 0a 33 34 35 35  .----..251..3455
362c0 0d 0a 39 33 34 0d 0a 0d 0a 71 75 65 72 79 20 49  ..934....query I
362d0 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45  II rowsort..SELE
362e0 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 31 20 57  CT * FROM tab1 W
362f0 48 45 52 45 20 4e 55 4c 4c 20 3c 3d 20 63 6f 6c  HERE NULL <= col
36300 31 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  1..----....query
36310 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36320 43 54 20 2b 20 74 61 62 31 2e 63 6f 6c 30 20 2d  CT + tab1.col0 -
36330 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 41 53 20   - tab1.col2 AS 
36340 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 0d 0a  col2 FROM tab1..
36350 2d 2d 2d 2d 0d 0a 31 32 31 0d 0a 31 37 36 0d 0a  ----..121..176..
36360 35 37 0d 0a 0d 0a 71 75 65 72 79 20 49 49 49 20  57....query III 
36370 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36380 44 49 53 54 49 4e 43 54 20 2a 20 46 52 4f 4d 20  DISTINCT * FROM 
36390 74 61 62 32 20 57 48 45 52 45 20 28 20 4e 55 4c  tab2 WHERE ( NUL
363a0 4c 20 29 20 49 4e 20 28 20 63 6f 6c 31 20 2a 20  L ) IN ( col1 * 
363b0 63 6f 6c 30 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a  col0 )..----....
363c0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
363d0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
363e0 20 2d 20 63 6f 6c 30 20 2a 20 74 61 62 30 2e 63   - col0 * tab0.c
363f0 6f 6c 32 20 2b 20 2d 20 63 6f 6c 31 20 41 53 20  ol2 + - col1 AS 
36400 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col1 FROM tab0..
36410 2d 2d 2d 2d 0d 0a 2d 31 33 32 0d 0a 2d 37 33 38  ----..-132..-738
36420 39 0d 0a 2d 38 37 38 0d 0a 0d 0a 71 75 65 72 79  9..-878....query
36430 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
36440 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74 61 62 30  LECT * FROM tab0
36450 20 57 48 45 52 45 20 4e 55 4c 4c 20 3d 20 63 6f   WHERE NULL = co
36460 6c 31 20 2d 20 2b 20 63 6f 6c 31 0d 0a 2d 2d 2d  l1 - + col1..---
36470 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  -....query I row
36480 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 74 61 62  sort..SELECT tab
36490 30 2e 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20  0.col1 + - col2 
364a0 2a 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30  * col0 FROM tab0
364b0 0d 0a 2d 2d 2d 2d 0d 0a 2d 37 30 36 0d 0a 2d 37  ..----..-706..-7
364c0 32 30 37 0d 0a 36 32 0d 0a 0d 0a 73 6b 69 70 69  207..62....skipi
364d0 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
364e0 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
364f0 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
36500 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
36510 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
36520 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  ort..SELECT DIST
36530 49 4e 43 54 20 63 6f 6c 30 20 2b 20 63 6f 6c 31  INCT col0 + col1
36540 20 2a 20 63 6f 6c 30 20 63 6f 6c 30 20 46 52 4f   * col0 col0 FRO
36550 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30  M tab0..----..20
36560 38 38 0d 0a 33 34 33 30 0d 0a 38 31 38 38 0d 0a  88..3430..8188..
36570 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65  ..skipif postgre
36580 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c  sql # PostgreSQL
36590 20 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65   requires AS whe
365a0 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75  n renaming outpu
365b0 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79  t columns..query
365c0 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
365d0 43 54 20 44 49 53 54 49 4e 43 54 20 63 6f 6c 32  CT DISTINCT col2
365e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
365f0 57 48 45 52 45 20 28 20 4e 55 4c 4c 20 29 20 3d  WHERE ( NULL ) =
36600 20 63 6f 6c 30 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71   col0..----....q
36610 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36620 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63 6f 6c  SELECT ALL + col
36630 32 20 2a 20 2b 20 63 6f 6c 31 20 41 53 20 63 6f  2 * + col1 AS co
36640 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
36650 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 34 38  cor0..----..1248
36660 0d 0a 31 34 30 34 0d 0a 35 37 30 0d 0a 0d 0a 71  ..1404..570....q
36670 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36680 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 34 35 20  SELECT ALL + 45 
36690 46 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72  FROM tab0 AS cor
366a0 30 0d 0a 2d 2d 2d 2d 0d 0a 34 35 0d 0a 34 35 0d  0..----..45..45.
366b0 0a 34 35 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .45....query I r
366c0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44  owsort..SELECT D
366d0 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c 30 20 2a  ISTINCT + col0 *
366e0 20 2d 20 63 6f 6c 32 20 2b 20 2d 20 63 6f 72 30   - col2 + - cor0
366f0 2e 63 6f 6c 30 20 41 53 20 63 6f 6c 30 20 46 52  .col0 AS col0 FR
36700 4f 4d 20 74 61 62 32 20 63 6f 72 30 0d 0a 2d 2d  OM tab2 cor0..--
36710 2d 2d 0d 0a 2d 31 39 36 0d 0a 2d 32 31 30 36 0d  --..-196..-2106.
36720 0a 2d 33 30 38 31 0d 0a 0d 0a 71 75 65 72 79 20  .-3081....query 
36730 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
36740 54 20 41 4c 4c 20 2d 20 28 20 2b 20 63 6f 6c 31  T ALL - ( + col1
36750 20 29 20 2b 20 32 30 20 46 52 4f 4d 20 74 61 62   ) + 20 FROM tab
36760 31 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 36  1 cor0..----..-6
36770 0d 0a 31 30 0d 0a 37 0d 0a 0d 0a 71 75 65 72 79  ..10..7....query
36780 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
36790 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
367a0 6c 30 20 2b 20 2d 20 63 6f 6c 30 20 2a 20 33 35  l0 + - col0 * 35
367b0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
367c0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 38 0d 0a  r0..----..-108..
367d0 2d 32 33 30 34 0d 0a 2d 32 38 38 30 0d 0a 0d 0a  -2304..-2880....
367e0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
367f0 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54  .SELECT DISTINCT
36800 20 63 6f 72 30 2e 63 6f 6c 31 20 2b 20 63 6f 6c   cor0.col1 + col
36810 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
36820 61 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a  ab2 cor0..----..
36830 35 35 0d 0a 35 38 0d 0a 38 35 0d 0a 0d 0a 71 75  55..58..85....qu
36840 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
36850 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2d 20 63  ELECT - col1 - c
36860 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
36870 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30   cor0..----..-10
36880 39 0d 0a 2d 36 37 0d 0a 2d 38 30 0d 0a 0d 0a 71  9..-67..-80....q
36890 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
368a0 53 45 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2b 20  SELECT - col1 + 
368b0 2b 20 63 6f 6c 31 20 2b 20 30 20 46 52 4f 4d 20  + col1 + 0 FROM 
368c0 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab0 AS cor0..--
368d0 2d 2d 0d 0a 30 0d 0a 30 0d 0a 30 0d 0a 0d 0a 6f  --..0..0..0....o
368e0 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20 75 73  nlyif mysql # us
368f0 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72 20 66  e DIV operator f
36900 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76 69 73  or integer divis
36910 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ion..query I row
36920 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 31 38 0d  sort label-1618.
36930 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 44 49 56  .SELECT col2 DIV
36940 20 2d 20 74 61 62 31 2e 63 6f 6c 32 20 46 52 4f   - tab1.col2 FRO
36950 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
36960 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69 70  ..-1..-1....skip
36970 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63  if mysql # not c
36980 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79  ompatible..query
36990 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c   I rowsort label
369a0 2d 31 36 31 38 0d 0a 53 45 4c 45 43 54 20 63 6f  -1618..SELECT co
369b0 6c 32 20 2f 20 2d 20 74 61 62 31 2e 63 6f 6c 32  l2 / - tab1.col2
369c0 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d   FROM tab1..----
369d0 0d 0a 2d 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a  ..-1..-1..-1....
369e0 71 75 65 72 79 20 49 49 49 20 72 6f 77 73 6f 72  query III rowsor
369f0 74 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  t..SELECT * FROM
36a00 20 74 61 62 31 20 57 48 45 52 45 20 4e 4f 54 20   tab1 WHERE NOT 
36a10 63 6f 6c 32 20 2d 20 63 6f 6c 32 20 42 45 54 57  col2 - col2 BETW
36a20 45 45 4e 20 28 20 63 6f 6c 32 20 2b 20 63 6f 6c  EEN ( col2 + col
36a30 30 20 29 20 41 4e 44 20 4e 55 4c 4c 0d 0a 2d 2d  0 ) AND NULL..--
36a40 2d 2d 0d 0a 39 20 76 61 6c 75 65 73 20 68 61 73  --..9 values has
36a50 68 69 6e 67 20 74 6f 20 38 64 36 36 39 32 65 36  hing to 8d6692e6
36a60 64 34 31 35 30 35 63 33 61 64 34 32 64 39 31 39  d41505c3ad42d919
36a70 62 64 39 65 63 64 30 64 0d 0a 0d 0a 71 75 65 72  bd9ecd0d....quer
36a80 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
36a90 45 43 54 20 41 4c 4c 20 2b 20 2b 20 63 6f 6c 30  ECT ALL + + col0
36aa0 20 2a 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20 74   * + col0 FROM t
36ab0 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab0 AS cor0..---
36ac0 2d 0d 0a 31 32 32 35 0d 0a 35 37 36 0d 0a 37 39  -..1225..576..79
36ad0 32 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  21....skipif pos
36ae0 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
36af0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
36b00 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
36b10 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71  utput columns..q
36b20 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
36b30 53 45 4c 45 43 54 20 2b 20 63 6f 6c 32 20 2b 20  SELECT + col2 + 
36b40 63 6f 6c 31 20 63 6f 6c 32 20 46 52 4f 4d 20 74  col1 col2 FROM t
36b50 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 30 39 0d 0a  ab1..----..109..
36b60 36 37 0d 0a 38 30 0d 0a 0d 0a 6f 6e 6c 79 69 66  67..80....onlyif
36b70 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49 56   mysql # use DIV
36b80 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e   operator for in
36b90 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a  teger division..
36ba0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
36bb0 6c 61 62 65 6c 2d 31 36 32 32 0d 0a 53 45 4c 45  label-1622..SELE
36bc0 43 54 20 2b 20 74 61 62 30 2e 63 6f 6c 31 20 44  CT + tab0.col1 D
36bd0 49 56 20 63 6f 6c 31 20 2b 20 63 6f 6c 30 20 2b  IV col1 + col0 +
36be0 20 63 6f 6c 32 20 2a 20 2b 20 63 6f 6c 32 20 41   col2 * + col2 A
36bf0 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 30  S col1 FROM tab0
36c00 0d 0a 2d 2d 2d 2d 0d 0a 31 31 31 34 0d 0a 33 37  ..----..1114..37
36c10 0d 0a 36 38 31 34 0d 0a 0d 0a 73 6b 69 70 69 66  ..6814....skipif
36c20 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
36c30 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
36c40 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36c50 36 32 32 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61  622..SELECT + ta
36c60 62 30 2e 63 6f 6c 31 20 2f 20 63 6f 6c 31 20 2b  b0.col1 / col1 +
36c70 20 63 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2b   col0 + col2 * +
36c80 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31 20 46 52   col2 AS col1 FR
36c90 4f 4d 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab0..----..1
36ca0 31 31 34 0d 0a 33 37 0d 0a 36 38 31 34 0d 0a 0d  114..37..6814...
36cb0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
36cc0 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f 72  use DIV operator
36cd0 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69 76   for integer div
36ce0 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20 72  ision..query I r
36cf0 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 32  owsort label-162
36d00 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54 49 4e  3..SELECT DISTIN
36d10 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a 20 63  CT tab2.col0 * c
36d20 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 44 49 56  ol1 + - col2 DIV
36d30 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
36d40 0a 2d 2d 2d 2d 0d 0a 31 33 34 31 0d 0a 32 31 37  .----..1341..217
36d50 0d 0a 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..4602....skipif
36d60 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d   mysql # not com
36d70 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49  patible..query I
36d80 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
36d90 36 32 33 0d 0a 53 45 4c 45 43 54 20 44 49 53 54  623..SELECT DIST
36da0 49 4e 43 54 20 74 61 62 32 2e 63 6f 6c 30 20 2a  INCT tab2.col0 *
36db0 20 63 6f 6c 31 20 2b 20 2d 20 63 6f 6c 32 20 2f   col1 + - col2 /
36dc0 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 0d   col1 FROM tab2.
36dd0 0a 2d 2d 2d 2d 0d 0a 31 33 34 31 0d 0a 32 31 37  .----..1341..217
36de0 0d 0a 34 36 30 32 0d 0a 0d 0a 73 6b 69 70 69 66  ..4602....skipif
36df0 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50 6f   postgresql # Po
36e00 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72 65  stgreSQL require
36e10 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d 69  s AS when renami
36e20 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d 6e  ng output column
36e30 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  s..query I rowso
36e40 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 63  rt..SELECT ALL c
36e50 6f 6c 30 20 2a 20 2b 20 63 6f 6c 31 20 2d 20 2d  ol0 * + col1 - -
36e60 20 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20   col2 col1 FROM 
36e70 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 32 30 39 37  tab0..----..2097
36e80 0d 0a 33 33 39 36 0d 0a 38 31 38 31 0d 0a 0d 0a  ..3396..8181....
36e90 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73 71  skipif postgresq
36ea0 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20 72  l # PostgreSQL r
36eb0 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e 20  equires AS when 
36ec0 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74 20  renaming output 
36ed0 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20 49  columns..query I
36ee0 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
36ef0 20 2b 20 63 6f 6c 32 20 2a 20 63 6f 6c 32 20 63   + col2 * col2 c
36f00 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41 53  ol0 FROM tab2 AS
36f10 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 34 34   cor0..----..144
36f20 34 0d 0a 36 37 36 0d 0a 37 32 39 0d 0a 0d 0a 71  4..676..729....q
36f30 75 65 72 79 20 49 49 49 49 49 49 20 72 6f 77 73  uery IIIIII rows
36f40 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20  ort..SELECT ALL 
36f50 2a 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61 62  * FROM tab0, tab
36f60 30 20 41 53 20 63 6f 72 30 20 57 48 45 52 45 20  0 AS cor0 WHERE 
36f70 4e 55 4c 4c 20 4e 4f 54 20 42 45 54 57 45 45 4e  NULL NOT BETWEEN
36f80 20 4e 55 4c 4c 20 41 4e 44 20 4e 55 4c 4c 0d 0a   NULL AND NULL..
36f90 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49 20  ----....query I 
36fa0 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20  rowsort..SELECT 
36fb0 41 4c 4c 20 63 6f 6c 30 20 2b 20 2b 20 63 6f 6c  ALL col0 + + col
36fc0 31 20 2a 20 2d 20 63 6f 6c 30 20 41 53 20 63 6f  1 * - col0 AS co
36fd0 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f 72  l0 FROM tab0 cor
36fe0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 30 34 30 0d 0a  0..----..-2040..
36ff0 2d 33 33 36 30 0d 0a 2d 38 30 31 30 0d 0a 0d 0a  -3360..-8010....
37000 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d  query I rowsort.
37010 0a 53 45 4c 45 43 54 20 63 6f 6c 31 20 2a 20 2b  .SELECT col1 * +
37020 20 63 6f 72 30 2e 63 6f 6c 32 20 2b 20 63 6f 72   cor0.col2 + cor
37030 30 2e 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  0.col2 AS col2 F
37040 52 4f 4d 20 74 61 62 30 20 41 53 20 63 6f 72 30  ROM tab0 AS cor0
37050 0d 0a 2d 2d 2d 2d 0d 0a 32 38 37 31 0d 0a 37 35  ..----..2871..75
37060 34 34 0d 0a 39 38 0d 0a 0d 0a 71 75 65 72 79 20  44..98....query 
37070 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  III rowsort..SEL
37080 45 43 54 20 41 4c 4c 20 2a 20 46 52 4f 4d 20 74  ECT ALL * FROM t
37090 61 62 31 20 41 53 20 63 6f 72 30 20 57 48 45 52  ab1 AS cor0 WHER
370a0 45 20 4e 55 4c 4c 20 4e 4f 54 20 49 4e 20 28 20  E NULL NOT IN ( 
370b0 2d 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c 30 20  - col2 * - col0 
370c0 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79  )..----....query
370d0 20 49 49 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45   III rowsort..SE
370e0 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2a 20  LECT DISTINCT * 
370f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
37100 30 20 57 48 45 52 45 20 4e 55 4c 4c 20 49 4e 20  0 WHERE NULL IN 
37110 28 20 63 6f 6c 31 20 29 0d 0a 2d 2d 2d 2d 0d 0a  ( col1 )..----..
37120 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
37130 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74 6f   use DIV operato
37140 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64 69  r for integer di
37150 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49 20  vision..query I 
37160 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
37170 33 31 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f 72  31..SELECT - cor
37180 30 2e 63 6f 6c 30 20 44 49 56 20 63 6f 72 30 2e  0.col0 DIV cor0.
37190 63 6f 6c 31 20 41 53 20 63 6f 6c 32 20 46 52 4f  col1 AS col2 FRO
371a0 4d 20 74 61 62 30 2c 20 74 61 62 32 20 63 6f 72  M tab0, tab2 cor
371b0 30 0d 0a 2d 2d 2d 2d 0d 0a 39 20 76 61 6c 75 65  0..----..9 value
371c0 73 20 68 61 73 68 69 6e 67 20 74 6f 20 31 39 63  s hashing to 19c
371d0 34 39 63 31 31 63 63 39 62 35 34 38 62 65 32 31  49c11cc9b548be21
371e0 62 63 36 34 64 65 33 36 31 30 62 64 65 0d 0a 0d  bc64de3610bde...
371f0 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20  .skipif mysql # 
37200 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a  not compatible..
37210 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
37220 6c 61 62 65 6c 2d 31 36 33 31 0d 0a 53 45 4c 45  label-1631..SELE
37230 43 54 20 2d 20 63 6f 72 30 2e 63 6f 6c 30 20 2f  CT - cor0.col0 /
37240 20 63 6f 72 30 2e 63 6f 6c 31 20 41 53 20 63 6f   cor0.col1 AS co
37250 6c 32 20 46 52 4f 4d 20 74 61 62 30 2c 20 74 61  l2 FROM tab0, ta
37260 62 32 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 39  b2 cor0..----..9
37270 20 76 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20   values hashing 
37280 74 6f 20 31 39 63 34 39 63 31 31 63 63 39 62 35  to 19c49c11cc9b5
37290 34 38 62 65 32 31 62 63 36 34 64 65 33 36 31 30  48be21bc64de3610
372a0 62 64 65 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  bde....query I r
372b0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 41  owsort..SELECT A
372c0 4c 4c 20 2b 20 63 6f 6c 31 20 2a 20 63 6f 6c 31  LL + col1 * col1
372d0 20 2a 20 2d 20 63 6f 6c 31 20 2b 20 2b 20 63 6f   * - col1 + + co
372e0 6c 31 20 2f 20 63 6f 6c 30 20 46 52 4f 4d 20 74  l1 / col0 FROM t
372f0 61 62 32 20 57 48 45 52 45 20 2b 20 63 6f 6c 32  ab2 WHERE + col2
37300 20 3c 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d   < NULL..----...
37310 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37320 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63  ..SELECT ALL - c
37330 6f 6c 30 20 2a 20 2d 20 74 61 62 31 2e 63 6f 6c  ol0 * - tab1.col
37340 30 20 2d 20 2d 20 63 6f 6c 31 20 41 53 20 63 6f  0 - - col1 AS co
37350 6c 31 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d  l1 FROM tab1..--
37360 2d 2d 0d 0a 33 35 0d 0a 34 31 30 36 0d 0a 36 34  --..35..4106..64
37370 31 33 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f  13....query I ro
37380 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49  wsort..SELECT DI
37390 53 54 49 4e 43 54 20 63 6f 6c 31 20 2a 20 2d 20  STINCT col1 * - 
373a0 63 6f 6c 31 20 2b 20 2b 20 74 61 62 32 2e 63 6f  col1 + + tab2.co
373b0 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20  l0 AS col1 FROM 
373c0 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 31 30  tab2..----..-210
373d0 0d 0a 2d 33 34 30 33 0d 0a 2d 39 35 34 0d 0a 0d  ..-3403..-954...
373e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
373f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
37400 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
37410 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
37420 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
37430 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37440 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 63 6f 6c  T ALL col2 * col
37450 31 20 2b 20 63 6f 6c 31 20 63 6f 6c 32 20 46 52  1 + col1 col2 FR
37460 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31  OM tab2..----..1
37470 35 39 33 0d 0a 36 36 33 0d 0a 38 36 38 0d 0a 0d  593..663..868...
37480 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37490 0d 0a 53 45 4c 45 43 54 20 41 4c 4c 20 2b 20 63  ..SELECT ALL + c
374a0 6f 6c 31 20 2a 20 2b 20 63 6f 6c 30 20 2f 20 63  ol1 * + col0 / c
374b0 6f 6c 32 20 2b 20 63 6f 6c 31 20 46 52 4f 4d 20  ol2 + col1 FROM 
374c0 74 61 62 32 20 57 48 45 52 45 20 2d 20 63 6f 6c  tab2 WHERE - col
374d0 30 20 49 4e 20 28 20 2b 20 63 6f 6c 30 20 2f 20  0 IN ( + col0 / 
374e0 63 6f 6c 30 20 2b 20 74 61 62 32 2e 63 6f 6c 32  col0 + tab2.col2
374f0 20 29 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72   )..----....quer
37500 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
37510 45 43 54 20 44 49 53 54 49 4e 43 54 20 74 61 62  ECT DISTINCT tab
37520 32 2e 63 6f 6c 31 20 2a 20 63 6f 6c 32 20 2b 20  2.col1 * col2 + 
37530 2d 20 63 6f 6c 32 20 41 53 20 63 6f 6c 32 20 46  - col2 AS col2 F
37540 52 4f 4d 20 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab2..----..
37550 31 35 30 38 0d 0a 36 30 38 0d 0a 38 31 30 0d 0a  1508..608..810..
37560 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37570 74 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 31  t..SELECT + tab1
37580 2e 63 6f 6c 31 20 2a 20 2d 20 63 6f 6c 31 20 46  .col1 * - col1 F
37590 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a  ROM tab1..----..
375a0 2d 31 30 30 0d 0a 2d 31 36 39 0d 0a 2d 36 37 36  -100..-169..-676
375b0 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c  ....onlyif mysql
375c0 20 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61   # use DIV opera
375d0 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20  tor for integer 
375e0 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20  division..query 
375f0 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
37600 31 36 33 39 0d 0a 53 45 4c 45 43 54 20 63 6f 6c  1639..SELECT col
37610 32 20 44 49 56 20 2b 20 74 61 62 30 2e 63 6f 6c  2 DIV + tab0.col
37620 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
37630 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 0d 0a 31 0d  ab0..----..1..1.
37640 0a 31 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73  .1....skipif mys
37650 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
37660 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
37670 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 33 39 0d  sort label-1639.
37680 0a 53 45 4c 45 43 54 20 63 6f 6c 32 20 2f 20 2b  .SELECT col2 / +
37690 20 74 61 62 30 2e 63 6f 6c 32 20 41 53 20 63 6f   tab0.col2 AS co
376a0 6c 31 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l1 FROM tab0..--
376b0 2d 2d 0d 0a 31 0d 0a 31 0d 0a 31 0d 0a 0d 0a 71  --..1..1..1....q
376c0 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
376d0 53 45 4c 45 43 54 20 41 4c 4c 20 74 61 62 32 2e  SELECT ALL tab2.
376e0 63 6f 6c 32 20 2b 20 63 6f 6c 30 20 41 53 20 63  col2 + col0 AS c
376f0 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32 20 57 48  ol1 FROM tab2 WH
37700 45 52 45 20 4e 4f 54 20 28 20 63 6f 6c 30 20 29  ERE NOT ( col0 )
37710 20 4e 4f 54 20 49 4e 20 28 20 2d 20 74 61 62 32   NOT IN ( - tab2
37720 2e 63 6f 6c 32 20 2f 20 2d 20 63 6f 6c 30 20 29  .col2 / - col0 )
37730 0d 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20  ..----....query 
37740 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
37750 54 20 74 61 62 32 2e 63 6f 6c 30 20 2f 20 74 61  T tab2.col0 / ta
37760 62 32 2e 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62  b2.col2 FROM tab
37770 32 20 57 48 45 52 45 20 4e 4f 54 20 63 6f 6c 30  2 WHERE NOT col0
37780 20 3d 20 4e 55 4c 4c 0d 0a 2d 2d 2d 2d 0d 0a 0d   = NULL..----...
37790 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
377a0 0d 0a 53 45 4c 45 43 54 20 2b 20 74 61 62 30 2e  ..SELECT + tab0.
377b0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 57  col2 FROM tab0 W
377c0 48 45 52 45 20 63 6f 6c 32 20 49 4e 20 28 20 63  HERE col2 IN ( c
377d0 6f 6c 31 20 2a 20 63 6f 6c 32 20 2f 20 2d 20 63  ol1 * col2 / - c
377e0 6f 6c 30 20 2b 20 2b 20 63 6f 6c 32 20 29 0d 0a  ol0 + + col2 )..
377f0 2d 2d 2d 2d 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d  ----....onlyif m
37800 79 73 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f  ysql # use DIV o
37810 70 65 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65  perator for inte
37820 67 65 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75  ger division..qu
37830 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
37840 62 65 6c 2d 31 36 34 33 0d 0a 53 45 4c 45 43 54  bel-1643..SELECT
37850 20 2d 20 63 6f 6c 31 20 44 49 56 20 2b 20 63 6f   - col1 DIV + co
37860 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a 2d 2d  l2 FROM tab0..--
37870 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39 37 0d  --..-1..-2..-97.
37880 0a 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20  ...skipif mysql 
37890 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65  # not compatible
378a0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
378b0 74 20 6c 61 62 65 6c 2d 31 36 34 33 0d 0a 53 45  t label-1643..SE
378c0 4c 45 43 54 20 2d 20 63 6f 6c 31 20 2f 20 2b 20  LECT - col1 / + 
378d0 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 0d 0a  col2 FROM tab0..
378e0 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 32 0d 0a 2d 39  ----..-1..-2..-9
378f0 37 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  7....query I row
37900 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 74  sort..SELECT - t
37910 61 62 31 2e 63 6f 6c 32 20 2b 20 2b 20 63 6f 6c  ab1.col2 + + col
37920 30 20 46 52 4f 4d 20 74 61 62 31 0d 0a 2d 2d 2d  0 FROM tab1..---
37930 2d 0d 0a 2d 31 36 0d 0a 2d 35 31 0d 0a 37 0d 0a  -..-16..-51..7..
37940 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37950 74 0d 0a 53 45 4c 45 43 54 20 74 61 62 32 2e 63  t..SELECT tab2.c
37960 6f 6c 30 20 2b 20 63 6f 6c 32 20 2a 20 2b 20 63  ol0 + col2 * + c
37970 6f 6c 31 20 2b 20 63 6f 6c 30 20 46 52 4f 4d 20  ol1 + col0 FROM 
37980 74 61 62 32 0d 0a 2d 2d 2d 2d 0d 0a 31 36 39 30  tab2..----..1690
37990 0d 0a 38 30 34 0d 0a 38 35 31 0d 0a 0d 0a 71 75  ..804..851....qu
379a0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
379b0 45 4c 45 43 54 20 41 4c 4c 20 63 6f 6c 30 20 2a  ELECT ALL col0 *
379c0 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 63 6f 6c 32   + col1 + + col2
379d0 20 46 52 4f 4d 20 74 61 62 32 20 57 48 45 52 45   FROM tab2 WHERE
379e0 20 4e 55 4c 4c 20 3c 3e 20 2d 20 63 6f 6c 30 0d   NULL <> - col0.
379f0 0a 2d 2d 2d 2d 0d 0a 0d 0a 71 75 65 72 79 20 49  .----....query I
37a00 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54   rowsort..SELECT
37a10 20 41 4c 4c 20 63 6f 6c 30 20 2b 20 63 6f 6c 31   ALL col0 + col1
37a20 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
37a30 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 31 30 0d 0a 31  b0..----..110..1
37a40 33 32 0d 0a 31 38 30 0d 0a 0d 0a 71 75 65 72 79  32..180....query
37a50 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45   I rowsort..SELE
37a60 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20 63 6f  CT DISTINCT - co
37a70 6c 30 20 2d 20 2d 20 63 6f 6c 32 20 2a 20 2d 20  l0 - - col2 * - 
37a80 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32 0d 0a  col2 FROM tab2..
37a90 2d 2d 2d 2d 0d 0a 2d 31 35 32 33 0d 0a 2d 37 33  ----..-1523..-73
37aa0 36 0d 0a 2d 37 35 34 0d 0a 0d 0a 6f 6e 6c 79 69  6..-754....onlyi
37ab0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
37ac0 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
37ad0 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
37ae0 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
37af0 20 6c 61 62 65 6c 2d 31 36 34 39 0d 0a 53 45 4c   label-1649..SEL
37b00 45 43 54 20 44 49 53 54 49 4e 43 54 20 38 38 20  ECT DISTINCT 88 
37b10 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30 20 41 53  DIV cor0.col0 AS
37b20 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 31 2c   col1 FROM tab1,
37b30 20 74 61 62 30 20 63 6f 72 30 2c 20 74 61 62 32   tab0 cor0, tab2
37b40 20 41 53 20 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a   AS cor1..----..
37b50 30 0d 0a 32 0d 0a 33 0d 0a 0d 0a 73 6b 69 70 69  0..2..3....skipi
37b60 66 20 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f  f mysql # not co
37b70 6d 70 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20  mpatible..query 
37b80 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d  I rowsort label-
37b90 31 36 34 39 0d 0a 53 45 4c 45 43 54 20 44 49 53  1649..SELECT DIS
37ba0 54 49 4e 43 54 20 38 38 20 2f 20 63 6f 72 30 2e  TINCT 88 / cor0.
37bb0 63 6f 6c 30 20 41 53 20 63 6f 6c 31 20 46 52 4f  col0 AS col1 FRO
37bc0 4d 20 74 61 62 31 2c 20 74 61 62 30 20 63 6f 72  M tab1, tab0 cor
37bd0 30 2c 20 74 61 62 32 20 41 53 20 63 6f 72 31 0d  0, tab2 AS cor1.
37be0 0a 2d 2d 2d 2d 0d 0a 30 0d 0a 32 0d 0a 33 0d 0a  .----..0..2..3..
37bf0 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72  ..query I rowsor
37c00 74 0d 0a 53 45 4c 45 43 54 20 33 35 20 2a 20 63  t..SELECT 35 * c
37c10 6f 6c 30 20 46 52 4f 4d 20 74 61 62 30 20 63 6f  ol0 FROM tab0 co
37c20 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 32 35 0d 0a  r0..----..1225..
37c30 33 31 31 35 0d 0a 38 34 30 0d 0a 0d 0a 71 75 65  3115..840....que
37c40 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37c50 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d 20  LECT DISTINCT - 
37c60 37 30 20 2a 20 63 6f 72 30 2e 63 6f 6c 32 20 41  70 * cor0.col2 A
37c70 53 20 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 32  S col2 FROM tab2
37c80 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38   cor0..----..-18
37c90 32 30 0d 0a 2d 31 38 39 30 0d 0a 2d 32 36 36 30  20..-1890..-2660
37ca0 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73 74 67  ....skipif postg
37cb0 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72 65 53  resql # PostgreS
37cc0 51 4c 20 72 65 71 75 69 72 65 73 20 41 53 20 77  QL requires AS w
37cd0 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74  hen renaming out
37ce0 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65  put columns..que
37cf0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37d00 4c 45 43 54 20 2b 20 37 34 20 2b 20 63 6f 6c 31  LECT + 74 + col1
37d10 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 31 20   col0 FROM tab1 
37d20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 31 30 30 0d  cor0..----..100.
37d30 0a 38 34 0d 0a 38 37 0d 0a 0d 0a 73 6b 69 70 69  .84..87....skipi
37d40 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23 20 50  f postgresql # P
37d50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75 69 72  ostgreSQL requir
37d60 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e 61 6d  es AS when renam
37d70 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c 75 6d  ing output colum
37d80 6e 73 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ns..query I rows
37d90 6f 72 74 0d 0a 53 45 4c 45 43 54 20 2d 20 2b 20  ort..SELECT - + 
37da0 63 6f 6c 31 20 2a 20 2b 20 63 6f 6c 32 20 2a 20  col1 * + col2 * 
37db0 63 6f 6c 32 20 63 6f 6c 31 20 46 52 4f 4d 20 74  col2 col1 FROM t
37dc0 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab2 AS cor0..---
37dd0 2d 0d 0a 2d 32 32 35 39 39 0d 0a 2d 32 34 35 34  -..-22599..-2454
37de0 38 0d 0a 2d 33 39 38 38 34 0d 0a 0d 0a 71 75 65  8..-39884....que
37df0 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45  ry I rowsort..SE
37e00 4c 45 43 54 20 63 6f 72 30 2e 63 6f 6c 31 20 46  LECT cor0.col1 F
37e10 52 4f 4d 20 74 61 62 31 2c 20 74 61 62 31 20 41  ROM tab1, tab1 A
37e20 53 20 63 6f 72 30 2c 20 74 61 62 30 20 41 53 20  S cor0, tab0 AS 
37e30 63 6f 72 31 0d 0a 2d 2d 2d 2d 0d 0a 32 37 20 76  cor1..----..27 v
37e40 61 6c 75 65 73 20 68 61 73 68 69 6e 67 20 74 6f  alues hashing to
37e50 20 64 36 37 31 61 30 36 34 65 32 64 61 37 30 39   d671a064e2da709
37e60 63 61 34 63 64 66 65 61 33 31 37 62 38 65 38 39  ca4cdfea317b8e89
37e70 32 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  2....query I row
37e80 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 44 49 53  sort..SELECT DIS
37e90 54 49 4e 43 54 20 2d 20 63 6f 6c 30 20 2a 20 63  TINCT - col0 * c
37ea0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 30 20 41 53  ol2 FROM tab0 AS
37eb0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 35   cor0..----..-35
37ec0 0d 0a 2d 37 32 39 38 0d 0a 2d 37 39 32 0d 0a 0d  ..-7298..-792...
37ed0 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
37ee0 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
37ef0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
37f00 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
37f10 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
37f20 6f 72 74 20 6c 61 62 65 6c 2d 31 36 35 36 0d 0a  ort label-1656..
37f30 53 45 4c 45 43 54 20 2b 20 63 6f 6c 31 20 2b 20  SELECT + col1 + 
37f40 2b 20 43 41 53 54 28 20 36 30 20 41 53 20 53 49  + CAST( 60 AS SI
37f50 47 4e 45 44 20 29 20 63 6f 6c 31 20 46 52 4f 4d  GNED ) col1 FROM
37f60 20 74 61 62 30 20 41 53 20 63 6f 72 30 0d 0a 2d   tab0 AS cor0..-
37f70 2d 2d 2d 0d 0a 31 34 36 0d 0a 31 35 31 0d 0a 31  ---..146..151..1
37f80 35 37 0d 0a 0d 0a 73 6b 69 70 69 66 20 70 6f 73  57....skipif pos
37f90 74 67 72 65 73 71 6c 20 23 20 50 6f 73 74 67 72  tgresql # Postgr
37fa0 65 53 51 4c 20 72 65 71 75 69 72 65 73 20 41 53  eSQL requires AS
37fb0 20 77 68 65 6e 20 72 65 6e 61 6d 69 6e 67 20 6f   when renaming o
37fc0 75 74 70 75 74 20 63 6f 6c 75 6d 6e 73 0d 0a 73  utput columns..s
37fd0 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
37fe0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
37ff0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
38000 62 65 6c 2d 31 36 35 36 0d 0a 53 45 4c 45 43 54  bel-1656..SELECT
38010 20 2b 20 63 6f 6c 31 20 2b 20 2b 20 43 41 53 54   + col1 + + CAST
38020 20 28 20 36 30 20 41 53 20 49 4e 54 45 47 45 52   ( 60 AS INTEGER
38030 20 29 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62   ) col1 FROM tab
38040 30 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d  0 AS cor0..----.
38050 0a 31 34 36 0d 0a 31 35 31 0d 0a 31 35 37 0d 0a  .146..151..157..
38060 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23  ..onlyif mysql #
38070 20 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53   support for MyS
38080 51 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74  QL specific syst
38090 65 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e  em types and syn
380a0 74 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  tax..query I row
380b0 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 35 37 0d  sort label-1657.
380c0 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c 32 20 2b  .SELECT ( col2 +
380d0 20 2b 20 43 41 53 54 28 20 4e 55 4c 4c 20 41 53   + CAST( NULL AS
380e0 20 53 49 47 4e 45 44 20 29 20 29 20 41 53 20 63   SIGNED ) ) AS c
380f0 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 0d 0a 2d  ol0 FROM tab2..-
38100 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d  ---..NULL..NULL.
38110 0a 4e 55 4c 4c 0d 0a 0d 0a 73 6b 69 70 69 66 20  .NULL....skipif 
38120 6d 79 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70  mysql # not comp
38130 61 74 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20  atible..query I 
38140 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36  rowsort label-16
38150 35 37 0d 0a 53 45 4c 45 43 54 20 28 20 63 6f 6c  57..SELECT ( col
38160 32 20 2b 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  2 + + CAST ( NUL
38170 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 29  L AS INTEGER ) )
38180 20 41 53 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61   AS col0 FROM ta
38190 62 32 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  b2..----..NULL..
381a0 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 71 75  NULL..NULL....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 2b 20 28 20 2b 20 63 6f 6c 31  ELECT + ( + col1
381d0 20 29 20 2b 20 2b 20 63 6f 6c 31 20 46 52 4f 4d   ) + + col1 FROM
381e0 20 74 61 62 30 0d 0a 2d 2d 2d 2d 0d 0a 31 37 32   tab0..----..172
381f0 0d 0a 31 38 32 0d 0a 31 39 34 0d 0a 0d 0a 71 75  ..182..194....qu
38200 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38210 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
38220 20 37 31 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d   71 AS col1 FROM
38230 20 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d   tab2 AS cor0..-
38240 2d 2d 2d 0d 0a 2d 37 31 0d 0a 0d 0a 71 75 65 72  ---..-71....quer
38250 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c  y I rowsort..SEL
38260 45 43 54 20 41 4c 4c 20 2d 20 28 20 63 6f 6c 32  ECT ALL - ( col2
38270 20 29 20 46 52 4f 4d 20 74 61 62 32 20 63 6f 72   ) FROM tab2 cor
38280 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 32 36 0d 0a 2d 32  0..----..-26..-2
38290 37 0d 0a 2d 33 38 0d 0a 0d 0a 71 75 65 72 79 20  7..-38....query 
382a0 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
382b0 54 20 2d 20 2b 20 63 6f 6c 31 20 2a 20 2b 20 63  T - + col1 * + c
382c0 6f 6c 31 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  ol1 + col0 AS co
382d0 6c 31 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l1 FROM tab1 AS 
382e0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 36 0d  cor0..----..-36.
382f0 0a 2d 36 37 33 0d 0a 2d 38 39 0d 0a 0d 0a 71 75  .-673..-89....qu
38300 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38310 45 4c 45 43 54 20 44 49 53 54 49 4e 43 54 20 2d  ELECT DISTINCT -
38320 20 63 6f 72 30 2e 63 6f 6c 31 20 2a 20 63 6f 6c   cor0.col1 * col
38330 31 20 2a 20 63 6f 6c 32 20 41 53 20 63 6f 6c 31  1 * col2 AS col1
38340 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
38350 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 36 32 32 34  r0..----..-16224
38360 0d 0a 2d 33 36 35 30 34 0d 0a 2d 35 37 30 30 0d  ..-36504..-5700.
38370 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20  ...onlyif mysql 
38380 23 20 75 73 65 20 44 49 56 20 6f 70 65 72 61 74  # use DIV operat
38390 6f 72 20 66 6f 72 20 69 6e 74 65 67 65 72 20 64  or for integer d
383a0 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72 79 20 49  ivision..query I
383b0 20 72 6f 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31   rowsort label-1
383c0 36 36 33 0d 0a 53 45 4c 45 43 54 20 2d 20 63 6f  663..SELECT - co
383d0 6c 30 20 44 49 56 20 63 6f 72 30 2e 63 6f 6c 30  l0 DIV cor0.col0
383e0 20 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20   col0 FROM tab2 
383f0 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d  AS cor0..----..-
38400 31 0d 0a 2d 31 0d 0a 2d 31 0d 0a 0d 0a 73 6b 69  1..-1..-1....ski
38410 70 69 66 20 70 6f 73 74 67 72 65 73 71 6c 20 23  pif postgresql #
38420 20 50 6f 73 74 67 72 65 53 51 4c 20 72 65 71 75   PostgreSQL requ
38430 69 72 65 73 20 41 53 20 77 68 65 6e 20 72 65 6e  ires AS when ren
38440 61 6d 69 6e 67 20 6f 75 74 70 75 74 20 63 6f 6c  aming output col
38450 75 6d 6e 73 0d 0a 73 6b 69 70 69 66 20 6d 79 73  umns..skipif mys
38460 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74 69  ql # not compati
38470 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f 77  ble..query I row
38480 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 36 33 0d  sort label-1663.
38490 0a 53 45 4c 45 43 54 20 2d 20 63 6f 6c 30 20 2f  .SELECT - col0 /
384a0 20 63 6f 72 30 2e 63 6f 6c 30 20 63 6f 6c 30 20   cor0.col0 col0 
384b0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
384c0 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 0d 0a 2d 31 0d  0..----..-1..-1.
384d0 0a 2d 31 0d 0a 0d 0a 71 75 65 72 79 20 49 20 72  .-1....query I r
384e0 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43 54 20 39  owsort..SELECT 9
384f0 35 20 2b 20 63 6f 6c 32 20 2d 20 63 6f 6c 31 20  5 + col2 - col1 
38500 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72  FROM tab1 AS cor
38510 30 0d 0a 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a 31 34  0..----..123..14
38520 32 0d 0a 31 37 38 0d 0a 0d 0a 71 75 65 72 79 20  2..178....query 
38530 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38540 54 20 2b 20 63 6f 6c 32 20 2a 20 2d 20 63 6f 6c  T + col2 * - col
38550 32 20 41 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74  2 AS col1 FROM t
38560 61 62 31 20 41 53 20 63 6f 72 30 0d 0a 2d 2d 2d  ab1 AS cor0..---
38570 2d 0d 0a 2d 32 39 31 36 0d 0a 2d 33 32 34 39 0d  -..-2916..-3249.
38580 0a 2d 39 32 31 36 0d 0a 0d 0a 71 75 65 72 79 20  .-9216....query 
38590 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
385a0 54 20 44 49 53 54 49 4e 43 54 20 2d 20 2b 20 34  T DISTINCT - + 4
385b0 30 20 2b 20 2b 20 63 6f 6c 30 20 41 53 20 63 6f  0 + + col0 AS co
385c0 6c 30 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20  l0 FROM tab1 AS 
385d0 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 33 37 0d  cor0..----..-37.
385e0 0a 32 34 0d 0a 34 30 0d 0a 0d 0a 6f 6e 6c 79 69  .24..40....onlyi
385f0 66 20 6d 79 73 71 6c 20 23 20 75 73 65 20 44 49  f mysql # use DI
38600 56 20 6f 70 65 72 61 74 6f 72 20 66 6f 72 20 69  V operator for i
38610 6e 74 65 67 65 72 20 64 69 76 69 73 69 6f 6e 0d  nteger division.
38620 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38630 20 6c 61 62 65 6c 2d 31 36 36 37 0d 0a 53 45 4c   label-1667..SEL
38640 45 43 54 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d  ECT + - col1 + -
38650 20 28 20 63 6f 6c 30 20 29 20 44 49 56 20 2b 20   ( col0 ) DIV + 
38660 63 6f 6c 30 20 46 52 4f 4d 20 74 61 62 32 20 41  col0 FROM tab2 A
38670 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  S cor0..----..-1
38680 38 0d 0a 2d 33 32 0d 0a 2d 36 30 0d 0a 0d 0a 73  8..-32..-60....s
38690 6b 69 70 69 66 20 6d 79 73 71 6c 20 23 20 6e 6f  kipif mysql # no
386a0 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d 0a 71 75  t compatible..qu
386b0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61  ery I rowsort la
386c0 62 65 6c 2d 31 36 36 37 0d 0a 53 45 4c 45 43 54  bel-1667..SELECT
386d0 20 2b 20 2d 20 63 6f 6c 31 20 2b 20 2d 20 28 20   + - col1 + - ( 
386e0 63 6f 6c 30 20 29 20 2f 20 2b 20 63 6f 6c 30 20  col0 ) / + col0 
386f0 46 52 4f 4d 20 74 61 62 32 20 41 53 20 63 6f 72  FROM tab2 AS cor
38700 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 38 0d 0a 2d 33  0..----..-18..-3
38710 32 0d 0a 2d 36 30 0d 0a 0d 0a 71 75 65 72 79 20  2..-60....query 
38720 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38730 54 20 41 4c 4c 20 63 6f 6c 32 20 2a 20 28 20 63  T ALL col2 * ( c
38740 6f 6c 30 20 2b 20 2d 20 63 6f 6c 32 20 29 20 41  ol0 + - col2 ) A
38750 53 20 63 6f 6c 31 20 46 52 4f 4d 20 74 61 62 32  S col1 FROM tab2
38760 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 35 34   cor0..----..-54
38770 30 0d 0a 31 33 35 32 0d 0a 31 35 35 38 0d 0a 0d  0..1352..1558...
38780 0a 6f 6e 6c 79 69 66 20 6d 79 73 71 6c 20 23 20  .onlyif mysql # 
38790 73 75 70 70 6f 72 74 20 66 6f 72 20 4d 79 53 51  support for MySQ
387a0 4c 20 73 70 65 63 69 66 69 63 20 73 79 73 74 65  L specific syste
387b0 6d 20 74 79 70 65 73 20 61 6e 64 20 73 79 6e 74  m types and synt
387c0 61 78 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73  ax..query I rows
387d0 6f 72 74 20 6c 61 62 65 6c 2d 31 36 36 39 0d 0a  ort label-1669..
387e0 53 45 4c 45 43 54 20 2b 20 43 41 53 54 28 20 4e  SELECT + CAST( N
387f0 55 4c 4c 20 41 53 20 53 49 47 4e 45 44 20 29 20  ULL AS SIGNED ) 
38800 2f 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e  / + col2 + cor0.
38810 63 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41  col2 FROM tab1 A
38820 53 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55  S cor0..----..NU
38830 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a  LL..NULL..NULL..
38840 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
38850 20 6e 6f 74 20 63 6f 6d 70 61 74 69 62 6c 65 0d   not compatible.
38860 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74  .query I rowsort
38870 20 6c 61 62 65 6c 2d 31 36 36 39 0d 0a 53 45 4c   label-1669..SEL
38880 45 43 54 20 2b 20 43 41 53 54 20 28 20 4e 55 4c  ECT + CAST ( NUL
38890 4c 20 41 53 20 49 4e 54 45 47 45 52 20 29 20 2f  L AS INTEGER ) /
388a0 20 2b 20 63 6f 6c 32 20 2b 20 63 6f 72 30 2e 63   + col2 + cor0.c
388b0 6f 6c 32 20 46 52 4f 4d 20 74 61 62 31 20 41 53  ol2 FROM tab1 AS
388c0 20 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c   cor0..----..NUL
388d0 4c 0d 0a 4e 55 4c 4c 0d 0a 4e 55 4c 4c 0d 0a 0d  L..NULL..NULL...
388e0 0a 73 6b 69 70 69 66 20 70 6f 73 74 67 72 65 73  .skipif postgres
388f0 71 6c 20 23 20 50 6f 73 74 67 72 65 53 51 4c 20  ql # PostgreSQL 
38900 72 65 71 75 69 72 65 73 20 41 53 20 77 68 65 6e  requires AS when
38910 20 72 65 6e 61 6d 69 6e 67 20 6f 75 74 70 75 74   renaming output
38920 20 63 6f 6c 75 6d 6e 73 0d 0a 71 75 65 72 79 20   columns..query 
38930 49 20 72 6f 77 73 6f 72 74 0d 0a 53 45 4c 45 43  I rowsort..SELEC
38940 54 20 44 49 53 54 49 4e 43 54 20 2b 20 63 6f 6c  T DISTINCT + col
38950 30 20 2b 20 63 6f 6c 30 20 63 6f 6c 31 20 46 52  0 + col0 col1 FR
38960 4f 4d 20 74 61 62 31 20 41 53 20 63 6f 72 30 0d  OM tab1 AS cor0.
38970 0a 2d 2d 2d 2d 0d 0a 31 32 38 0d 0a 31 36 30 0d  .----..128..160.
38980 0a 36 0d 0a 0d 0a 6f 6e 6c 79 69 66 20 6d 79 73  .6....onlyif mys
38990 71 6c 20 23 20 75 73 65 20 44 49 56 20 6f 70 65  ql # use DIV ope
389a0 72 61 74 6f 72 20 66 6f 72 20 69 6e 74 65 67 65  rator for intege
389b0 72 20 64 69 76 69 73 69 6f 6e 0d 0a 71 75 65 72  r division..quer
389c0 79 20 49 20 72 6f 77 73 6f 72 74 20 6c 61 62 65  y I rowsort labe
389d0 6c 2d 31 36 37 31 0d 0a 53 45 4c 45 43 54 20 36  l-1671..SELECT 6
389e0 37 20 44 49 56 20 2b 20 32 34 20 41 53 20 63 6f  7 DIV + 24 AS co
389f0 6c 32 20 46 52 4f 4d 20 74 61 62 32 20 41 53 20  l2 FROM tab2 AS 
38a00 63 6f 72 30 0d 0a 2d 2d 2d 2d 0d 0a 32 0d 0a 32  cor0..----..2..2
38a10 0d 0a 32 0d 0a 0d 0a 73 6b 69 70 69 66 20 6d 79  ..2....skipif my
38a20 73 71 6c 20 23 20 6e 6f 74 20 63 6f 6d 70 61 74  sql # not compat
38a30 69 62 6c 65 0d 0a 71 75 65 72 79 20 49 20 72 6f  ible..query I ro
38a40 77 73 6f 72 74 20 6c 61 62 65 6c 2d 31 36 37 31  wsort label-1671
38a50 0d 0a 53 45 4c 45 43 54 20 36 37 20 2f 20 2b 20  ..SELECT 67 / + 
38a60 32 34 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20  24 AS col2 FROM 
38a70 74 61 62 32 20 41 53 20 63 6f 72 30 0d 0a 2d 2d  tab2 AS cor0..--
38a80 2d 2d 0d 0a 32 0d 0a 32 0d 0a 32 0d 0a 0d 0a 71  --..2..2..2....q
38a90 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a  uery I rowsort..
38aa0 53 45 4c 45 43 54 20 41 4c 4c 20 2d 20 63 6f 6c  SELECT ALL - col
38ab0 31 20 2a 20 63 6f 6c 30 20 41 53 20 63 6f 6c 31  1 * col0 AS col1
38ac0 20 46 52 4f 4d 20 74 61 62 31 20 41 53 20 63 6f   FROM tab1 AS co
38ad0 72 30 0d 0a 2d 2d 2d 2d 0d 0a 2d 31 30 34 30 0d  r0..----..-1040.
38ae0 0a 2d 36 34 30 0d 0a 2d 37 38 0d 0a 0d 0a 71 75  .-640..-78....qu
38af0 65 72 79 20 49 20 72 6f 77 73 6f 72 74 0d 0a 53  ery I rowsort..S
38b00 45 4c 45 43 54 20 2d 20 63 6f 6c 32 20 2d 20 28  ELECT - col2 - (
38b10 20 36 33 20 29 20 2a 20 63 6f 6c 31 20 46 52 4f   63 ) * col1 FRO
38b20 4d 20 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 2d 31  M tab1..----..-1
38b30 36 39 32 0d 0a 2d 36 38 37 0d 0a 2d 39 31 35 0d  692..-687..-915.
38b40 0a 0d 0a 71 75 65 72 79 20 49 20 72 6f 77 73 6f  ...query I rowso
38b50 72 74 0d 0a 53 45 4c 45 43 54 20 2b 20 63 6f 6c  rt..SELECT + col
38b60 30 20 2a 20 28 20 31 34 20 29 20 46 52 4f 4d 20  0 * ( 14 ) FROM 
38b70 74 61 62 31 0d 0a 2d 2d 2d 2d 0d 0a 31 31 32 30  tab1..----..1120
38b80 0d 0a 34 32 0d 0a 38 39 36 0d 0a 0d 0a 6f 6e 6c  ..42..896....onl
38b90 79 69 66 20 6d 79 73 71 6c 20 23 20 73 75 70 70  yif mysql # supp
38ba0 6f 72 74 20 66 6f 72 20 4d 79 53 51 4c 20 73 70  ort for MySQL sp
38bb0 65 63 69 66 69 63 20 73 79 73 74 65 6d 20 74 79  ecific system ty
38bc0 70 65 73 20 61 6e 64 20 73 79 6e 74 61 78 0d 0a  pes and syntax..
38bd0 71 75 65 72 79 20 49 20 72 6f 77 73 6f 72 74 20  query I rowsort 
38be0 6c 61 62 65 6c 2d 31 36 37 35 0d 0a 53 45 4c 45  label-1675..SELE
38bf0 43 54 20 44 49 53 54 49 4e 43 54 20 43 41 53 54  CT DISTINCT CAST
38c00 28 20 4e 55 4c 4c 20 41 53 20 53 49 47 4e 45 44  ( NULL AS SIGNED
38c10 20 29 20 41 53 20 63 6f 6c 32 20 46 52 4f 4d 20   ) AS col2 FROM 
38c20 74 61 62 30 2c 20 74 61 62 31 20 41 53 20 63 6f  tab0, tab1 AS co
38c30 72 30 0d 0a 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a  r0..----..NULL..
38c40 0d 0a 73 6b 69 70 69 66 20 6d 79 73 71 6c 20 23  ..skipif mysql #
38c50 20 6e 6f 74 20 63 6f 6d 70